Code

fixes: #1179
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 May 2012 08:23:12 +0000 (08:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 2 May 2012 08:23:12 +0000 (08:23 +0000)
Fixed problems with writeable login restrictions in user plugin, even no acls where given or edit mode wasn't entered yet.
Thanks to 'tmack0'

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@21131 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/generic/class_user.inc
gosa-core/plugins/personal/generic/generic.tpl

index 437ac728f0bb1b865800784cff628dc179ca62fd..7fd7c4019f4b01e7169ad8b1e94e5b792edf840a 100644 (file)
@@ -283,11 +283,12 @@ class user extends plugin
     plugin::execute();
 
     /* Set list ACL */
+    $restrict_writeable = $this->acl_is_writeable('gosaLoginRestriction', (!is_object($this->parent) && !session::is_set('edit')));
     $this->gosaLoginRestrictionWidget->setAcl($this->getacl('gosaLoginRestriction', (!is_object($this->parent) && !session::is_set('edit'))));
     $this->gosaLoginRestrictionWidget->update();
 
     /* Handle add/delete for restriction mode */
-    if (isset($_POST['add_res']) && isset($_POST['res']){
+    if (isset($_POST['add_res']) && isset($_POST['res']) && $restrict_writeable){
       $val= validate($_POST['res']);
       if (preg_match('/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/', $val) ||
           preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\/([0-9]+)$/', $val) ||
@@ -625,13 +626,13 @@ class user extends plugin
     /* Set acls */
     $tmp = $this->plinfo();
     foreach($tmp['plProvidedAcls'] as $val => $translation){
-      $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !session::is_set('edit'))));
+        $smarty->assign("$val"."ACL", $this->getacl($val,(!is_object($this->parent) && !session::is_set('edit'))));
     }
 
     // Special ACL for gosaLoginRestrictions - 
     // In case of multiple edit, we need a readonly ACL for the list. 
     $smarty->assign('gosaLoginRestriction_ONLY_R_ACL', 
-      preg_replace("/[^r]/i","", $this->getacl($val,(!is_object($this->parent) && !session::is_set('edit')))));
+      preg_replace("/[^r]/i","", $this->getacl("gosaLoginRestriction",(!is_object($this->parent) && !session::is_set('edit')))));
 
     $smarty->assign("pwmode", $pwd_methods);
     $smarty->assign("pwmode_select", $this->pw_storage);
@@ -1683,7 +1684,7 @@ class user extends plugin
 
           "userPicture"       => _("User picture"),
 
-          "gosaLoginRestriction" => _("Login restrictions"),         
+          "gosaLoginRestriction" => _("Login restrictions"),
 
           "o"                 => _("Organization"),
           "ou"                => _("Department"),
@@ -1705,7 +1706,8 @@ class user extends plugin
           "homePostalAddress" => _("Home postal address"),
           "homePhone"         => _("Home phone number"),
           "labeledURI"        => _("Homepage"),
-          "userPassword"      => _("User password method"), 
+         "userPassword"      => _("User password method"), 
+                       
           "Certificate"       => _("User certificates"))
 
         );
index 985cc80ea18360ac5bc232d822d31b3559be9002..448b2677044dc92af958ddcb7c80fc8cac455123 100644 (file)
      <td>
      
      {if !$multiple_support}
-       {$gosaLoginRestrictionWidget}
-       <input type="text" id="res" name="res" size=22 maxlength=33 
-        value="{t}IP or network{/t}" onFocus='document.getElementById("res").value=""'>
-       <input id="add_res" type="submit" name="add_res" value="{t}Add{/t}">
+        {render acl=$gosaLoginRestrictionACL}
+          {$gosaLoginRestrictionWidget}
+        {/render}
+        {render acl=$gosaLoginRestrictionACL}
+          <input type="text" id="res" name="res" size=22 maxlength=33 
+            value="{t}IP or network{/t}" onFocus='document.getElementById("res").value=""'>
+        {/render}
+        {render acl=$gosaLoginRestrictionACL}
+           <input id="add_res" type="submit" name="add_res" value="{t}Add{/t}">
+        {/render}
      {else}
       <input type='checkbox' name='use_gosaLoginRestriction' {if $use_gosaLoginRestriction} checked {/if}
         onClick='document.mainform.submit();'