From 9c8c3ca6a344900eecac4720976b1556fa62c33f Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 2 May 2012 08:23:12 +0000 Subject: [PATCH] fixes: #1179 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 | 12 +++++++----- gosa-core/plugins/personal/generic/generic.tpl | 14 ++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gosa-core/plugins/personal/generic/class_user.inc b/gosa-core/plugins/personal/generic/class_user.inc index 437ac728f..7fd7c4019 100644 --- a/gosa-core/plugins/personal/generic/class_user.inc +++ b/gosa-core/plugins/personal/generic/class_user.inc @@ -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")) ); diff --git a/gosa-core/plugins/personal/generic/generic.tpl b/gosa-core/plugins/personal/generic/generic.tpl index 985cc80ea..448b26770 100644 --- a/gosa-core/plugins/personal/generic/generic.tpl +++ b/gosa-core/plugins/personal/generic/generic.tpl @@ -247,10 +247,16 @@ {if !$multiple_support} - {$gosaLoginRestrictionWidget} - - + {render acl=$gosaLoginRestrictionACL} + {$gosaLoginRestrictionWidget} + {/render} + {render acl=$gosaLoginRestrictionACL} + + {/render} + {render acl=$gosaLoginRestrictionACL} + + {/render} {else}