summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 522ec25)
raw | patch | inline | side by side (parent: 522ec25)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Jul 2006 07:14:09 +0000 (07:14 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Jul 2006 07:14:09 +0000 (07:14 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4304 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/personal/connectivity/class_proxyAccount.inc | patch | blob | history | |
plugins/personal/connectivity/proxy.tpl | patch | blob | history |
diff --git a/plugins/personal/connectivity/class_proxyAccount.inc b/plugins/personal/connectivity/class_proxyAccount.inc
index 6f0447335294eb7620010ab94f5f7cd4c79c0862..495924237642e95bad6c192c2d61270e93e2efdd 100644 (file)
/* Prepare templating */
$smarty= get_smarty();
- $smarty->assign("proxyAccountACL", chkacl($this->acl, "proxyAccount"));
- $smarty->assign("gosaProxyAcctFlagsACL", chkacl($this->acl, "gosaProxyAcctFlags"));
- $smarty->assign("gosaProxyWorkingStartACL", chkacl($this->acl, "gosaProxyWorkingStart"));
- $smarty->assign("gosaProxyWorkingStopACL", chkacl($this->acl, "gosaProxyWorkingStop"));
- $smarty->assign("gosaProxyQuotaACL", chkacl($this->acl, "gosaProxyQuota"));
+
+
+ if(($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) {
+ $smarty->assign('proxyAccountACL', "");
+ }else{
+ $smarty->assign('proxyAccountACL', " disabled ");
+ }
/* Assign radio boxes */
foreach (array("F", "T", "B", "N") as $val){
+
if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) {
$smarty->assign("filter$val", "checked");
}
}
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $acl => $desc){
+ $smarty->assign($acl."ACL",$this->getacl($acl));
+ $smarty->assign($acl."_W",$this->acl_is_writeable($acl));
+ }
+
/* Assign working time */
$smarty->assign("starthour", (int)($this->gosaProxyWorkingStart / 60));
$smarty->assign("startminute", (int)($this->gosaProxyWorkingStart % 60));
$changeA = "";
- if(chkacl($this->acl,"gosaProxyAcctFlags")==""){
+ if($this->acl_is_writeable("gosaProxyFlag_F")){
$changeA .="changeState('filterF');\n";
}
- $smarty->assign("Working_allowedACL","disabled");
- if((chkacl($this->acl,"gosaProxyWorkingStart")=="")||(chkacl($this->acl,"gosaProxyWorkingStop")=="")){
- $smarty->assign("Working_allowedACL","");
+ $ProxyWorkingStateChange ="\n";
+ if($this->acl_is_writeable("gosaProxyWorkingTime")){
$changeA .= "changeState('filterT');\n";
+ $ProxyWorkingStateChange.= "changeState('startHour'); \n";
+ $ProxyWorkingStateChange.= "changeState('startMinute'); \n";
+ $ProxyWorkingStateChange.= "changeState('stopHour'); \n";
+ $ProxyWorkingStateChange.= "changeState('stopMinute'); \n";
}
- $ProxyWorkingStateChange ="";
- if(chkacl($this->acl,"gosaProxyWorkingStart")==""){
- $ProxyWorkingStateChange.= "changeState('startHour');\n";
- $ProxyWorkingStateChange.= "changeState('startMinute');\n";
- }
-
- if(chkacl($this->acl,"gosaProxyWorkingStop")=="") {
- $ProxyWorkingStateChange.= "changeState('stopHour');\n";
- $ProxyWorkingStateChange.= "changeState('stopMinute');\n";
- }
-
$changeA .= $ProxyWorkingStateChange;
$smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange);
$changeB = "";
- if(chkacl($this->acl,"gosaProxyQuota")==""){
+ if($this->acl_is_writeable("gosaProxyQuota")){
$changeA .= "changeState('filterB');";
$changeB =
"changeSubselectState('filterB', 'quota_size');
function remove_from_parent()
{
- /* Cancel if there's nothing to do here */
- if (!$this->initially_was_account){
- return;
- }
-
- plugin::remove_from_parent();
+ if($this->acl_is_removeable()){
- $ldap= $this->config->get_ldap_link();
- @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
- $this->attributes, "Save");
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
+ plugin::remove_from_parent();
- show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn));
+ $ldap= $this->config->get_ldap_link();
+ @DEBUG (DEBUG_LDAP, __LINE__, __FUNCTION__, __FILE__,
+ $this->attributes, "Save");
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
- /* Optionally execute a command after we're done */
- $this->handle_post_events("remove");
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of user/proxy account with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->handle_post_events("remove");
+ }
}
/* Check values */
/* We've got only one value to check for positive integer or emtpy field */
if ($this->is_account){
- if (isset($_POST["quota_size"])){
- if ($_POST["quota_size"] == ""){
- $message[]= _("Numerical value for Quota Setting is empty.");
- }
- else if ($_POST["quota_size"] <= 0){
- $message[]= _("Numerical value for Quota Setting is not valid.");
+ if($this->acl_is_writeable("gosaProxyQuota")){
+ if (isset($_POST["quota_size"])){
+ if ($_POST["quota_size"] == "gosaProxyQuota"){
+ $message[]= _("Numerical value for Quota Setting is empty.");
+ }elseif ($_POST["quota_size"] <= 0){
+ $message[]= _("Numerical value for Quota Setting is not valid.");
+ }
}
}
}
if (isset($_POST['connectivityTab'])){
if (isset($_POST['proxy'])){
if (!$this->is_account && $_POST['proxy'] == "B"){
- $this->is_account= TRUE;
+ if($this->acl_is_createable()){
+ $this->is_account= TRUE;
+ }
}
} else {
- $this->is_account= FALSE;
+ if($this->acl_is_removeable()){
+ $this->is_account= FALSE;
+ }
}
}
}
- if(isset($_POST['proxy'])){
- $this->is_account = TRUE;
- }else{
- $this->is_account = FALSE;
- }
-
/* Save flag value */
if ($this->is_account){
- if (chkacl ($this->acl, "gosaProxyAcctFlags") == ""){
- $flags= "";
- foreach(array("F", "T", "B") as $key){
+
+
+ $flags= "";
+ $acl= "";
+ foreach(array("F", "T", "B") as $key){
+ if($this->acl_is_writeable("gosaProxyFlag".$key)){
+
+ /* Add acl */
if (isset($_POST["filter$key"])){
$flags.= $key;
}
+ }else{
+
+ /* Keep all flags that can't be written*/
+ if(preg_match("/".$key."/",$this->gosaProxyAcctFlags)){
+ $flags .=$key;
+ }
}
- if ("[$flags]" != $this->gosaProxyAcctFlags){
- $this->is_modified= TRUE;
- }
- $this->gosaProxyAcctFlags= "[$flags]";
}
+ if ("[$flags]" != $this->gosaProxyAcctFlags){
+ $this->is_modified= TRUE;
+ }
+ $this->gosaProxyAcctFlags= "[$flags]";
/* Save time values */
- if ((chkacl ($this->acl, "gosaProxyWorkingStart") == "")&&(isset($_POST['startMinute']))){
- $old= $this->gosaProxyWorkingStart;
- $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
- $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified;
- }
-
- if ((chkacl ($this->acl, "gosaProxyWorkingStop") == "")&&(isset($_POST['stopMinute']))){
- $old= $this->gosaProxyWorkingStop;
- $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"];
- $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified;
+ if ($this->acl_is_writeable("gosaProxyWorkingTime")){
+ if(isset($_POST['startMinute'])){
+ $old= $this->gosaProxyWorkingStart;
+ $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
+ $this->is_modified= ($old != $this->gosaProxyWorkingStart)?TRUE:$this->is_modified;
+ }
+
+ if (isset($_POST['stopMinute'])){
+ $old= $this->gosaProxyWorkingStop;
+ $this->gosaProxyWorkingStop = $_POST["stopHour"] * 60 + $_POST["stopMinute"];
+ $this->is_modified= ($old != $this->gosaProxyWorkingStop)?TRUE:$this->is_modified;
+ }
}
/* Save quota values */
- if (chkacl ($this->acl, "gosaProxyQuota") == ""){
- $old= $this->gosaProxyQuota;
+ if ($this->acl_is_writeable("gosaProxyQuota")){
if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
$this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
}
- $this->is_modified= ($old != $this->gosaProxyQuota)?TRUE:$this->is_modified;
- $old= $this->gosaProxyQuotaPeriod;
+ }
+
+ /*Save quota period */
+ if($this->acl_is_writeable("gosaProxyQuotaPeriod")){
if(isset($_POST["gosaProxyQuotaPeriod"])){
$this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
}
- $this->is_modified= ($old != $this->gosaProxyQuotaPeriod)?TRUE:$this->is_modified;
}
}
-
}
"plShortName" => _("Proxy"),
"plDescription" => _("Proxy account"),
"plSelfModify" => TRUE,
- "plDepends" => array("connectivity"),
+ "plDepends" => array("user"),
"plPriority" => 7, // Position in tabs
"plSection" => "personal", // This belongs to personal
- "plCategory" => array("gosaAccount"),
+ "plCategory" => array("users"),
"plOptions" => array(),
"plProvidedAcls" => array(
- "gosaProxyID" => "!!! FIXME "._("gosaProxyID"),
+ "gosaProxyID" => _("gosaProxyID"),
- "gosaProxyFlag_F" => _("Filter unwanted content"),
- "gosaProxyFlag_T" => _("Limit proxy access"),
- "gosaProxyFlag_B" => _("Restrict proxy usage by quota"),
+ "gosaProxyFlagF" => _("Filter unwanted content"),
+ "gosaProxyFlagT" => _("Limit proxy access"),
+ "gosaProxyFlagB" => _("Restrict proxy usage by quota"),
"gosaProxyWorkingTime" => _("Limit proxy access"),
"gosaProxyQuota" => _("Limit quota"),
index b8243cda6af70964a8235cf08e897c5ba47f3827..e4687fc4f5639efdc4ed1d46e9b2e7c1e8515fc0 100644 (file)
<h2>
- <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$proxyAccountACL}
- onClick="
- {$changeA}
-
- changeTripleSelectState('proxy', 'filterB', 'quota_size');
- changeTripleSelectState('proxy', 'filterB', 'quota_unit');
- changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
- ">
- {t}Proxy account{/t}</h2>
+ <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$proxyAccountACL}
+ onClick="
+ {$changeA}
+ {if $gosaProxyFlagB_W}
+ changeTripleSelectState('proxy', 'filterB', 'quota_size');
+ {/if}
+ {if $gosaProxyQuotaPeriod_W}
+ changeTripleSelectState('proxy', 'filterB', 'quota_unit');
+ changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
+ {/if}
+ ">
+ {t}Proxy account{/t}</h2>
<table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
<tr>
<td>
<table summary="" border=0 width="100%" cellpadding=0>
<tr><td colspan=2>
- <input type="checkbox" name="filterF" id="filterF" value="F" {$filterF} {$gosaProxyAcctFlagsACL} {$pstate}>
+
+{render acl=$gosaProxyFlagFACL}
+ <input type="checkbox" name="filterF" id="filterF" value="F" {$filterF} {$pstate}>
+{/render}
{t}Filter unwanted content (i.e. pornographic or violence related){/t}
</td></tr>
<tr>
<td width="50%">
- <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$Working_allowedACL} {$pstate}
- onClick="{$ProxyWorkingStateChange}">
+
+{render acl=$gosaProxyFlagTACL}
+ <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$pstate} onClick="javascript:
+ {$ProxyWorkingStateChange}">
+{/render}
+
<LABEL for="startHour">{t}Limit proxy access to working time{/t}</LABEL>
<br>
<table summary="" style="margin-left:20px;">
<tr>
<td>
- <select size="1" id="startHour" name="startHour"
- {if $gosaProxyWorkingStartACL!="" || $Tstate!=""}
- disabled
- {/if}>
+
+{render acl=$gosaProxyWorkingTimeACL}
+ <select size="1" id="startHour" name="startHour" {if $Tstate!=""} disabled {/if}>
{html_options values=$hours output=$hours selected=$starthour}
</select>
+{/render}
:
- <select size="1" id="startMinute" name="startMinute"
- {if $gosaProxyWorkingStartACL!="" || $Tstate!=""}
- disabled
- {/if}>
+{render acl=$gosaProxyWorkingTimeACL}
+ <select size="1" id="startMinute" name="startMinute" {if $Tstate!=""} disabled {/if}>
{html_options values=$minutes output=$minutes selected=$startminute}
</select>
+{/render}
-
- <select size="1" id="stopHour" name="stopHour"
- {if $gosaProxyWorkingStopACL!="" || $Tstate!=""}
- disabled
- {/if}>
- {html_options values=$hours output=$hours selected=$stophour}
+{render acl=$gosaProxyWorkingTimeACL}
+ <select size="1" id="stopHour" name="stopHour" {if $Tstate!=""}disabled {/if}>
+ {html_options values=$hours output=$hours selected=$stophour}
</select>
+{/render}
:
- <select size="1" id="stopMinute" name="stopMinute"
- {if $gosaProxyWorkingStopACL!="" || $Tstate!=""}
- disabled
- {/if}>
+{render acl=$gosaProxyWorkingTimeACL}
+ <select size="1" id="stopMinute" name="stopMinute" {if $Tstate!=""} disabled {/if}>
{html_options values=$minutes output=$minutes selected=$stopminute}
</select>
+{/render}
</td>
</tr>
</table>
</td>
<td>
- <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB}
- {if $pstate=="disabled" || $gosaProxyAcctFlagsACL=="disabled" || $gosaProxyQuotaACL=="disabled"}
- disabled
- {/if}
- onClick="{$changeB}">
+{render acl=$gosaProxyFlagBACL}
+ <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB} {if $pstate=="disabled"} disabled {/if} onClick="{$changeB}">
+{/render}
<LABEL for="quota_size">{t}Restrict proxy usage by quota{/t}</LABEL>
<br>
<table summary="" style="margin-left:20px;">
<tr>
<td>
- <input name="quota_size" id="quota_size" size=7 maxlength=10 value="{$quota_size}"
- {if $Bstate=="disabled" || $gosaProxyQuotaACL=="disabled"}
- disabled
- {/if}>
+{render acl=$gosaProxyFlagBACL}
+ <input name="quota_size" id="quota_size" size=7 maxlength=10 value="{$quota_size}" {if $Bstate=="disabled"} disabled {/if}>
+{/render}
- <select size="1" name="quota_unit" id="quota_unit"
- {if $Bstate=="disabled" || $gosaProxyQuotaACL=="disabled"}
- disabled
- {/if}>
- {html_options options=$quota_unit selected=$quota_u}
+{render acl=$gosaProxyQuotaPeriodACL}
+ <select size="1" name="quota_unit" id="quota_unit" {if $Bstate=="disabled" } disabled {/if}>
+ {html_options options=$quota_unit selected=$quota_u}
</select>
-
+{/render}
+
<LABEL for="gosaProxyQuotaPeriod">{t}per{/t}</LABEL>
- <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod"
- {if $Bstate=="disabled" || $gosaProxyQuotaACL=="disabled"}
- disabled
- {/if}>
+{render acl=$gosaProxyQuotaPeriodACL}
+ <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {if $Bstate=="disabled"} disabled {/if}>
{html_options options=$quota_time selected=$gosaProxyQuotaPeriod}
</select>
+{/render}
</td>
</tr>
</table>