summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f350129)
raw | patch | inline | side by side (parent: f350129)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 Jul 2006 08:39:30 +0000 (08:39 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 Jul 2006 08:39:30 +0000 (08:39 +0000) |
* Disabled old ACL's added dummy directory
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4023 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4023 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_plugin.inc | patch | blob | history | |
plugins/admin/acl/class_acl.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/groups/class_groupAcl.inc | [deleted file] | patch | blob | history |
index b2977082c63c0e9436fc6e780a700c2da7fe68aa..1cab881b410202f1926c35ce4d7c3e048c2a21d3 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
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
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+class acl extends plugin
+{
+
+ /* constructor, if 'dn' is set, the node loads the given
+ 'dn' from LDAP */
+ function acl ($config, $dn= NULL)
+ {
+ $this->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
+++ /dev/null
@@ -1,249 +0,0 @@
-<?php
-
-
-/* FIXME: the complete acl stuff will be redesigned to be more intuitive,
- which will be possible after introducing templates for html pages.
- just be patient. */
-
-
-class acl extends plugin
-{
- /* CLI vars */
- var $cli_summary= "Manage group ACL's";
- var $cli_description= "Some longer text\nfor help";
- var $cli_parameters= array("eins" => "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= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\"> <b>".
- _("This 'dn' is no acl container.")."</b>";
- 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= "<input type=checkbox name=\"all\" value=\"1\"";
- if (chkacl ($this->acl, "all") == ""){
- $display.= " checked";
- }
- $display.= "><b>"._("All fields are writeable")."</b><br>";
-
- # Put strings in right order
- asort ($name);
-
- # Generate checklist
- $display.= "<table summary=\"\" style=\"width:100%;\">\n";
- $switch= 0;
- foreach ($name as $key => $val){
- if ($switch == 0){
- $display.= " <tr>\n";
- }
-
- if (is_integer($key)){
- $display.= "<td><input type=checkbox name=\"$val\" value=\"1\" ";
- if (chkacl ($this->acl, "$val") == ""){
- $display.= "checked";
- }
- $display.= ">$val</td>";
- } else {
- $display.= "<td><input type=checkbox name=\"$key\" value=\"1\"";
- if (chkacl ($this->acl, "$key") == ""){
- $display.= "checked";
- }
- $display.= ">"._($val)."</td>";
- }
-
- if ($switch++ == 1){
- $display.= " </tr>\n";
- $switch= 0;
- }
- }
-
- if ($switch == 1){
- $display.= "<td></td></tr>";
- }
- $display.= "</table>\n";
-
- return ($display);
- }
-
-}
-
-?>