summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f4142a)
raw | patch | inline | side by side (parent: 1f4142a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 24 Apr 2007 08:03:55 +0000 (08:03 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 24 Apr 2007 08:03:55 +0000 (08:03 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6181 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/acl/class_aclRole.inc | patch | blob | history |
index 03cc4562321a77b556b46f6620ebd9e325661976..7d257502eec03162adb073498b0ec23a6ebd98e0 100644 (file)
function remove_from_parent()
{
- echo "Role should be deleted here- What happens with assigned roles ... ";
+ $ldap = $this->config->get_ldap_link();
+ $serach_for = "*:role:".base64_encode($this->dn).":*";
+ $ldap->search ("(&(objectClass=gosaACL)(gosaAclEntry=".$serach_for."))",array('dn','cn','sn','givenName','uid'));
+ $all_names = "";
+
+
+ $cnt = 3;
+ while(($attrs = $ldap->fetch()) && $cnt){
+ $name = $attrs['dn'];
+ $name = preg_replace("/[ ]/"," ",$name);
+ $name = "<i>'".$name."'</i>";
+ $all_names .= $name.", ";
+ $cnt --;
+ }
+
+ if(!empty($all_names)){
+ $all_names = preg_replace("/, $/","",$all_names);
+ if(!$cnt){
+ $all_names .= ", ...";
+ }
+ $all_names = "<span style='text-align:left;'>".$all_names."</span>";
+ print_red(sprintf(_("This role can't be removed while it is in use. Follwing objects are using this role %s"),$all_names));
+ return;
+ }
+
+
+ $ldap->rmDir($this->dn);
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing of aclRole with dn '%s' failed."),$this->dn));
+
+ /* Optionally execute a command after we're done */
+ $this->handle_post_events("remove");
+
+ /* Delete references to object groups */
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+ while ($ldap->fetch()){
+ $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));
+ }
}
+
function save_object()
{
plugin::save_object();