From 04483fb77173f0e3104045bc5785d0658e4bc429 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 4 Jul 2006 08:39:30 +0000 Subject: [PATCH] * Moved to commonly used variable names * Disabled old ACL's added dummy directory git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4023 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 20 +- plugins/admin/acl/class_acl.inc | 20 ++ plugins/admin/groups/class_groupAcl.inc | 249 ------------------------ 3 files changed, 31 insertions(+), 258 deletions(-) create mode 100644 plugins/admin/acl/class_acl.inc delete mode 100644 plugins/admin/groups/class_groupAcl.inc diff --git a/include/class_plugin.inc b/include/class_plugin.inc index b2977082c..1cab881b4 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -109,15 +109,17 @@ class plugin var $saved_attributes= array(); /* Plugin identifier */ - var $pl_object_name= ""; - var $pl_provided_acls= array(); - var $pl_self_modify= FALSE; - var $pl_options= array(); - var $pl_section= ""; - var $pl_task= array(); - var $pl_priority= 0; - var $pl_depends= array(); - var $pl_conflicts= array(); + var $plHeadline= ""; + var $plDescription= ""; + var $plObject_name= ""; + var $plProvided_acls= array(); + var $plSelf_modify= FALSE; + var $plOptions= array(); + var $plSection= ""; + var $plTask= array(); + var $plPriority= 0; + var $plDepends= array(); + var $plConflicts= array(); /*! \brief plugin constructor diff --git a/plugins/admin/acl/class_acl.inc b/plugins/admin/acl/class_acl.inc new file mode 100644 index 000000000..a5f37b78e --- /dev/null +++ b/plugins/admin/acl/class_acl.inc @@ -0,0 +1,20 @@ +config= $config; + + /* Load base attributes */ + plugin::plugin ($config, $dn); + + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/plugins/admin/groups/class_groupAcl.inc b/plugins/admin/groups/class_groupAcl.inc deleted file mode 100644 index 54a91713b..000000000 --- a/plugins/admin/groups/class_groupAcl.inc +++ /dev/null @@ -1,249 +0,0 @@ - "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - /* Helpers */ - var $department= ""; - var $objects= array(); - var $object= ""; - var $current_acl= ""; - var $selfflag= FALSE; - - var $gosaSubtreeACL; - - /* attribute list for save action */ - var $attributes= array("gosaSubtreeACL"); - var $objectclasses= array("gosaObject"); - - function acl ($config, $dn= NULL) - { - plugin::plugin($config, $dn); - - /* WorkAround */ - include "acl_definition.inc"; - $this->objects= $ACLD; - $tmp= array_keys($this->objects); - $this->object= reset($tmp); - - $this->selfflag= FALSE; - if (isset($this->attrs['gosaSubtreeACL'][0])){ - $this->current_acl= preg_replace("/^[^:]*:/", "", $this->attrs['gosaSubtreeACL'][0]); - if (preg_match("/^!:/", $this->attrs['gosaSubtreeACL'][0])){ - $this->selfflag= TRUE; - } - } - - /* This is allways true */ - $this->is_account= TRUE; - } - - function execute() - { - /* Call parent execute */ - plugin::execute(); - - /* Do we represent a valid group? */ - if (!$this->is_account && $this->parent == NULL){ - $display= "\"\" ". - _("This 'dn' is no acl container.").""; - return ($display); - } - - /* Show main page */ - $smarty= get_smarty(); - if ($_SESSION['js']==FALSE){ - $smarty->assign("javascript", "false"); - } else { - $smarty->assign("javascript", "true"); - } - $smarty->assign("object", $this->object); - $obj= array(); - foreach($this->objects as $key => $value){ - $obj[$key]= $key; - } - if ($this->selfflag){ - $smarty->assign("selfflag", "checked"); - } else { - $smarty->assign("selfflag", ""); - } - $smarty->assign("objects", $obj); - $display= $smarty->fetch (get_template_path('acl.tpl', TRUE)); - - /* Show acl stuff */ - $this->acl= get_module_permission (array($this->current_acl), $this->object, ""); - $display.= $this->print_attributes ($this->objects[$this->object]); - return ($display); - } - - - function remove_from_parent() - { - plugin::remove_from_parent(); - - $this->attrs['gosaSubtreeACL']= array(); - - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of groups/acl with dn '%s' failed."),$this->dn)); - } - - - /* Save data to object */ - function save_object() - { - plugin::save_object(); - - if (!isset($_POST['object'])){ - return; - } - - /* Strip of old information */ - if ($this->object == "all"){ - $this->current_acl= preg_replace ( "/[,]?all[,]?/", "", $this->current_acl); - } - $this->current_acl= preg_replace ( "/(^|[^a-z0-9A-Z])$this->object#[^,]*[,]?/", "", $this->current_acl); - - /* assemble new attributes */ - $attrs= ""; - if (isset($_POST['all'])){ - $attrs.= "#all"; - } - if ($this->object != "all" && !isset($_POST['all']) && $this->object != ""){ - foreach ($this->objects[$this->object] as $key => $val){ - if (is_integer($key)){ - $aname= $val; - } else { - $aname= $key; - } - if (isset($_POST[$aname])){ - $attrs.= "#$aname"; - } - } - } - - /* append information */ - if ($attrs != ""){ - $tmp= $this->object; - $attrs= $tmp.$attrs; - } - if ($this->current_acl != "" && $attrs != ""){ - $this->current_acl.= ","; - } - $this->current_acl.= $attrs; - if (preg_match("/all#all/", $this->current_acl)){ - $this->current_acl= "all"; - } - if (preg_match("/^all,/", $this->current_acl)){ - $this->current_acl= "all"; - } - - /* Save current object selection */ - if (isset($_POST['object'])){ - $this->object= $_POST['object']; - } - if (isset($_POST['selfflag'])){ - $this->selfflag= TRUE; - } else { - $this->selfflag= FALSE; - } - } - - - /* Save to LDAP */ - function save() - { - /* Write back to LDAP */ - $ldap= $this->config->get_ldap_link(); - - /* Read stuff and only modify subtreeACL entries */ - plugin::save(); - - if ($this->current_acl != ""){ - if ($this->selfflag){ - $this->attrs['gosaSubtreeACL']= "!:".$this->current_acl; - } else { - $this->attrs['gosaSubtreeACL']= ":".$this->current_acl; - } - } else { - $objectclasses= array(); - foreach ($this->attrs['objectClass'] as $oc){ - if (!preg_match('/gosaObject/i', $oc)){ - $objectclasses[]= $oc; - } - } - $this->attrs['objectClass']= $objectclasses; - $this->attrs['gosaSubtreeACL']= array(); - } - - /* Modify class */ - $ldap->cd($this->dn); - $this->cleanup(); - $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error(), sprintf(_("Saving of groups/acl with dn '%s' failed."),$this->dn)); - } - - - function print_attributes ($name) - { - $display= "acl, "all") == ""){ - $display.= " checked"; - } - $display.= ">"._("All fields are writeable")."
"; - - # Put strings in right order - asort ($name); - - # Generate checklist - $display.= "\n"; - $switch= 0; - foreach ($name as $key => $val){ - if ($switch == 0){ - $display.= " \n"; - } - - if (is_integer($key)){ - $display.= ""; - } else { - $display.= ""; - } - - if ($switch++ == 1){ - $display.= " \n"; - $switch= 0; - } - } - - if ($switch == 1){ - $display.= ""; - } - $display.= "
acl, "$val") == ""){ - $display.= "checked"; - } - $display.= ">$valacl, "$key") == ""){ - $display.= "checked"; - } - $display.= ">"._($val)."
\n"; - - return ($display); - } - -} - -?> -- 2.30.2