From: hickert Date: Thu, 2 Jul 2009 06:24:17 +0000 (+0000) Subject: Updated roles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a204ff48aa3fe8c20a3fafb00b58eb0136afb7e0;p=gosa.git Updated roles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13871 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc index 18058ceaa..8aafe8ecf 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_divListRole.inc @@ -104,7 +104,7 @@ class divListRole extends MultiSelectWindow $add_sep = false; /* Get copy & paste icon */ - $acls = $ui->get_permissions($this->selectedBase,"roles/role"); + $acls = $ui->get_permissions($this->selectedBase,"roles/roleGeneric"); $acl_all= $ui->has_complete_category_acls($this->selectedBase,"roles"); /* Add default header */ @@ -163,7 +163,7 @@ class divListRole extends MultiSelectWindow foreach($list as $key => $val){ // Get object permissions - $acl = $ui->get_permissions($val['dn'],"roles/role"); + $acl = $ui->get_permissions($val['dn'],"roles/roleGeneric"); $acl_all= $ui->has_complete_category_acls($val['dn'],"roles"); // Create edit and remove icon buttons diff --git a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc index dc914b0b5..37842a7ef 100644 --- a/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc +++ b/gosa-plugins/roleManagement/admin/roleManagement/class_roleGeneric.inc @@ -23,6 +23,7 @@ class roleGeneric extends plugin { + // The variables this plugin takes care of. var $cn = ""; var $description =""; var $telephoneNumber = ""; @@ -30,43 +31,59 @@ class roleGeneric extends plugin { var $x121Address = ""; var $roleOccupant = array(); + // The objects base var $base = ""; + + // Keep track if possible ng aming modifications var $orig_dn = ""; var $orig_cn = ""; var $orig_base = ""; + // The object classes written by this plugin var $objectclasses = array("top","organizationalRole"); + + // A list of attributes managed by this plugin var $attributes = array("cn","x121Address","description", "telephoneNumber","facsimileTelephoneNumber","roleOccupant"); - + + + /* Initialize the class + */ function __construct($config,$dn){ plugin::plugin($config,$dn); $this->is_account = TRUE; - $this->orig_dn = $dn; - $this->orig_cn = $this->cn; - /* Set base */ + // Detect the objects base if ($this->dn == "new"){ $this->base = session::get('CurrentMainBase'); } else { - $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("roleRDN"), '/')."/","",$this->dn); + $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("roleRDN"), '/i')."/","",$this->dn); } + + // Keep track of naming attribute modifications $this->orig_base = $this->base; + $this->orig_dn = $dn; + $this->orig_cn = $this->cn; } + /* Generate HTML output of this plugin. + */ function execute() { - $smarty = get_smarty(); - - /* Create base acls */ + // Get list of possible ldap bases, will be selectable in the ui. $tmp = $this->allowedBasesToMoveTo(); + + // Get smarty instance and assign required variables. + $smarty = get_smarty(); $smarty->assign("bases", $tmp); $smarty->assign("base_select",$this->base); $smarty->assign("members",$this->convert_list()); foreach($this->attributes as $attr){ $smarty->assign($attr,$this->$attr); } + + // Assign current permissions for each attribute. $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $attr => $desc){ $smarty->assign($attr."ACL",$this->getacl($attr)); @@ -75,17 +92,18 @@ class roleGeneric extends plugin { } + /* Check user input and return a list of 'invalid input' messages. + */ function check() { $message = plugin::check(); - /* Set the new acl base */ + // Set the new acl base if($this->dn == "new") { $this->set_acl_base($this->base); } - /* Check if we are allowed to create/move this user - */ + // Check if we are allowed to create/move this user if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){ $message[]= msgPool::permCreate(); }elseif($this->orig_dn != "new" && @@ -94,7 +112,7 @@ class roleGeneric extends plugin { $message[]= msgPool::permMove(); } - /* Name already used? */ + // Check if this name is uniq for roles. $ldap= $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); $ldap->search("(&(objectClass=organizationalRole)(cn=$this->cn))", array("cn")); @@ -102,12 +120,12 @@ class roleGeneric extends plugin { if ($ldap->count() != 0 && ( $this->dn == 'new' || $this->cn != $this->orig_cn)){ $message[]= msgPool::duplicated(_("Name")); } - - return($message); } + /* Returns list of occupants as