X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Facl%2Fclass_aclRole.inc;h=2f90c41900d5a5467948e1659901ff33d8cb1757;hb=fa5d22666fd9d7d2b6fce4c546b37b0071e59cdc;hp=01581ab9bb67b4ed5619f3c9b15bcd99ed31b9f6;hpb=5ceeec7a235bded42e4eea8b82e544e4825e9796;p=gosa.git diff --git a/gosa-core/plugins/admin/acl/class_aclRole.inc b/gosa-core/plugins/admin/acl/class_aclRole.inc index 01581ab9b..2f90c4190 100644 --- a/gosa-core/plugins/admin/acl/class_aclRole.inc +++ b/gosa-core/plugins/admin/acl/class_aclRole.inc @@ -1,10 +1,30 @@ aclObjects); /* Fill acl types */ - $this->aclTypes= array( "reset" => _("Reset ACLs"), + $this->aclTypes= array( "reset" => _("Reset ACL"), "one" => _("One level"), "base" => _("Current object"), "sub" => _("Complete subtree"), @@ -116,6 +137,8 @@ class aclrole extends acl /* Finally - we want to get saved... */ $this->is_account= TRUE; + $this->orig_base = $this->base; + $this->orig_dn = $this->dn; } @@ -232,7 +255,7 @@ class aclrole extends acl continue; } - /* Ordinary ACLs */ + /* Ordinary ACL */ if (!isset($new_acl[$object])){ $new_acl[$object]= array(); } @@ -335,10 +358,10 @@ class aclrole extends acl foreach ($this->gosaAclTemplate as $key => $entry){ $field1= array("string" => $this->aclTypes[$entry['type']], "attach" => "style='width:100px'"); $field2= array("string" => $this->assembleAclSummary($entry)); - $action= ""; - $action.= ""; - $action.= ""; - $action.= ""; + $action= ""; + $action.= ""; + $action.= ""; + $action.= ""; $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px;text-align:right;'"); $aclList->AddEntry(array($field1, $field2, $field3)); @@ -377,13 +400,13 @@ class aclrole extends acl if ($summary == ""){ $summary= ''._("No ACL settings for this category").''; } else { - $summary= sprintf(_("Contains ACLs for these objects: %s"), preg_replace('/, $/', '', $summary)); + $summary= sprintf(_("ACL for these objects: %s"), preg_replace('/, $/', '', $summary)); } $field1= array("string" => $dsc, "attach" => "style='width:140px'"); $field2= array("string" => $summary); - $action= ""; - $action.= ""; + $action= ""; + $action.= ""; $field3= array("string" => $action, "attach" => "style='border-right:0px;width:50px'"); $aclList->AddEntry(array($field1, $field2, $field3)); } @@ -561,9 +584,11 @@ class aclrole extends acl new log("create","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving ACLs with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class())); + } - /* Refresh users ACLs */ + /* Refresh users ACL */ $ui= get_userinfo(); $ui->loadACL(); session::set('ui',$ui); @@ -593,13 +618,15 @@ class aclrole extends acl $all_names .= ", ..."; } $all_names = "".$all_names.""; - print_red(sprintf(_("This role can't be removed while it is in use. Follwing objects are using this role %s"),$all_names)); + msg_dialog::display(_("Object in use"), sprintf(_("This role cannot be removed while it is in use by these objects:")."

%s", $all_names), WARNING_DIALOG); return; } $ldap->rmDir($this->dn); new log("remove","aclroles/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of aclRole with dn '%s' failed."),$this->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, "", get_class())); + } /* Optionally execute a command after we're done */ $this->handle_post_events("remove"); @@ -611,7 +638,9 @@ class aclrole extends acl $og= new ogroup($this->config, $ldap->getDN()); unset($og->member[$this->dn]); $og->save (); - show_ldap_error($ldap->get_error(), sprintf(_("Removing aclRole from objectgroup '%s' failed"), $og->dn)); + if (!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $og->dn, "", get_class())); + } } } @@ -666,12 +695,12 @@ class aclrole extends acl { return (array( "plShortName" => _("Role"), - "plDescription" => _("ACL roles"), + "plDescription" => _("Access control roles"), "plSelfModify" => FALSE, "plDepends" => array(), "plPriority" => 0, "plSection" => array("admin"), - "plCategory" => array("aclroles" => array("objectClass" => "gosaRole", "description" => _("Acl roles"))), + "plCategory" => array("aclroles" => array("objectClass" => "gosaRole", "description" => _("Access control roles"))), "plProvidedAcls" => array( "cn" => _("Name"), @@ -680,6 +709,29 @@ class aclrole extends acl )); } + function check() + { + $message = plugin::check(); + + if(empty($this->cn)){ + $message[] = msgPool::required(_("Name")); + } + + if(!count($this->gosaAclTemplate)){ + $message[] = msgPool::required(_("ACL")); + } + + /* Check if we are allowed to create or move this object + */ + if($this->orig_dn == "new" && !$this->acl_is_createable($this->base)){ + $message[] = msgPool::permCreate(); + }elseif($this->orig_dn != "new" && $this->base != $this->orig_base && !$this->acl_is_moveable($this->base)){ + $message[] = msgPool::permMove(); + } + + return($message); + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: