From 3837eb0b5e5811a22d056681984b58b86f46d522 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 28 Sep 2006 11:01:13 +0000 Subject: [PATCH] Added acls to terminals git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4814 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_terminalGeneric.inc | 83 ++++++++++--------- .../admin/systems/class_terminalService.inc | 2 +- .../admin/systems/class_terminalStartup.inc | 2 +- plugins/admin/systems/tabs_terminal.inc | 21 +++-- plugins/admin/systems/terminal.tpl | 53 ++++++++---- 5 files changed, 100 insertions(+), 61 deletions(-) diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 69a5872fd..de00c606e 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -119,6 +119,18 @@ class termgeneric extends plugin $this->orig_dn= $this->dn; } + function set_acl_base($base) + { + plugin::set_acl_base($base); + $this->netConfigDNS->set_acl_base($base); + } + + function set_acl_category($cat) + { + plugin::set_acl_category($cat); + $this->netConfigDNS->set_acl_category($cat); + } + function execute() { /* Call parent execute */ @@ -129,7 +141,7 @@ class termgeneric extends plugin $this->is_account= !$this->is_account; } - if (isset($_POST['action'])){ + if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){ /* Set FAIstate */ $ldap = $this->config->get_ldap_link(); @@ -202,7 +214,7 @@ class termgeneric extends plugin /* Base select dialog */ $once = true; foreach($_POST as $name => $value){ - if(preg_match("/^chooseBase/",$name) && $once){ + if(preg_match("/^chooseBase/",$name) && $once && $this->acl_is_moveable()){ $once = false; $this->dialog = new baseSelectDialog($this->config,$this); $this->dialog->setCurrentBase($this->base); @@ -232,12 +244,12 @@ class termgeneric extends plugin } /* Add new ntp Server to our list */ - if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers']))){ + if((isset($_POST['addNtpServer'])) && (isset($_POST['gotoNtpServers'])) && $this->acl_is_writeable("gotoNtpServer")){ $this->gotoNtpServer[$_POST['gotoNtpServers']] = $_POST['gotoNtpServers']; } /* Delete selected NtpServer for list of used servers */ - if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected']))){ + if((isset($_POST['delNtpServer'])) && (isset($_POST['gotoNtpServerSelected'])) && $this->acl_is_writeable("gotoNtpServer")){ foreach($_POST['gotoNtpServerSelected'] as $name){ unset($this->gotoNtpServer[$name]); } @@ -245,6 +257,12 @@ class termgeneric extends plugin /* Fill templating stuff */ $smarty= get_smarty(); + + $tmp = $this->plInfo(); + foreach($tmp['plProvidedAcls'] as $name => $translation){ + $smarty->assign($name."ACL",$this->getacl($name)); + } + $smarty->assign("cn", $this->cn); $smarty->assign("staticAddress", ""); @@ -294,40 +312,37 @@ class termgeneric extends plugin $smarty->assign("ntpservers", $tmp); /* Variables */ - foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer", - "gotoSyslogServer", "gotoNtpServer") as $val){ - + foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer","gotoSyslogServer", "gotoNtpServer") as $val){ $smarty->assign($val."_select", $this->$val); - $smarty->assign($val."ACL", chkacl($this->acl, $val)); } /* Show main page */ $smarty->assign("netconfig", $this->netConfigDNS->execute()); - $smarty->assign("actionACL", chkacl($this->acl, 'action')); return($smarty->fetch (get_template_path('terminal.tpl', TRUE))); } function remove_from_parent() { - - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->cat($this->dn, array('dn')); - if($ldap->count()){ - $this->netConfigDNS->remove_from_parent(); - $ldap->rmDir($this->dn); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn)); - - /* Optionally execute a command after we're done */ - $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress)); - - /* 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 (); + if($this->acl_is_removeable()){ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->cat($this->dn, array('dn')); + if($ldap->count()){ + $this->netConfigDNS->remove_from_parent(); + $ldap->rmDir($this->dn); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of object system terminal/generic with dn '%s' failed."),$this->dn)); + + /* Optionally execute a command after we're done */ + $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress)); + + /* 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 (); + } } } } @@ -338,10 +353,6 @@ class termgeneric extends plugin { plugin::save_object(); $this->netConfigDNS->save_object(); - /* Save base, since this is no LDAP attribute */ - if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){ - $this->base= $_POST['base']; - } /* Save terminal path to parent since it is used by termstartup, too */ $this->parent->by_object['termstartup']->gotoTerminalPath= @@ -368,13 +379,11 @@ class termgeneric extends plugin $this->dn= "cn=".$this->cn."ou=terminals,ou=systems,".$this->base; $ui= get_userinfo(); - $acl= get_permissions ($this->dn, $ui->subtreeACL); - $acl= get_module_permission($acl, "group", $this->dn); - if (chkacl($acl, "create") != ""){ + if ($this->dn == "new" && !$this->acl_is_createable()){ $message[]= _("You have no permissions to create a terminal on this 'Base'."); } - if ($this->cn == "" && chkacl ($this->acl, "cn") == ""){ + if ($this->cn == ""){ $message[]= _("The required field 'Terminal name' is not set."); } @@ -488,7 +497,7 @@ class termgeneric extends plugin "plDescription" => _("Terminal generic"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 1, "plSection" => array("administration"), "plCategory" => array("terminal" => array( "description" => _("Terminal"), "objectClass" => "gotoTerminal")), diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index 7ffe10bce..cc4b868ca 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -426,7 +426,7 @@ class termservice extends plugin "plDescription" => _("Terminal service"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 3, "plSection" => array("administration"), "plCategory" => array("terminal"), diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index 3fce2c28e..3ec5c115c 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -442,7 +442,7 @@ class termstartup extends plugin "plDescription" => _("Terminal startup"), "plSelfModify" => FALSE, "plDepends" => array(), - "plPriority" => 0, + "plPriority" => 5, "plSection" => array("administration"), "plCategory" => array("terminal"), diff --git a/plugins/admin/systems/tabs_terminal.inc b/plugins/admin/systems/tabs_terminal.inc index 7614608df..78bf16d45 100644 --- a/plugins/admin/systems/tabs_terminal.inc +++ b/plugins/admin/systems/tabs_terminal.inc @@ -9,16 +9,21 @@ class termtabs extends tabs $this->dn= $dn; $this->config= $config; + $baseobject= NULL; + foreach ($data as $tab){ - if($tab['CLASS'] == "printgeneric"){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $category); - $this->by_object[$tab['CLASS']]->parent= &$this; - }else{ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $category); - $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject == NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + /* Initialize current */ if ($this->current == ""){ $this->current= $tab['CLASS']; diff --git a/plugins/admin/systems/terminal.tpl b/plugins/admin/systems/terminal.tpl index 152c9dc19..794a27ed8 100644 --- a/plugins/admin/systems/terminal.tpl +++ b/plugins/admin/systems/terminal.tpl @@ -9,22 +9,25 @@ {else} {$must} +{render acl=$cnACL} +{/render} {/if} {$must} - {html_options options=$bases selected=$base_select} - {if $baseACL == ""} - - {else} - - {/if} - +{/render} +{render acl=$baseACL disable_picture='images/folder_gray.png'} + +{/render} + @@ -33,17 +36,21 @@ - {html_options options=$modes selected=$gotoMode_select} +{/render} - {html_options options=$syslogservers selected=$gotoSyslogServer_select} +{/render} @@ -58,17 +65,21 @@ - {html_options options=$nfsservers selected=$gotoTerminalPath_select} +{/render} - {html_options options=$nfsservers selected=$gotoSwapServer_select} +{/render} @@ -77,6 +88,7 @@
+{render acl=$gotoNtpServerACL} {t}Inherit time server attributes{/t} +{/render}

+{render acl=$gotoNtpServerACL} +{/render}
- {html_options values=$ntpservers output=$ntpservers } +{/render} +{render acl=$gotoNtpServerACL} +{/render} +{render acl=$gotoNtpServerACL} +{/render}
@@ -116,13 +137,17 @@
- {html_options options=$actions} +{/render} +{render acl=$gotoNtpServerACL} +{/render}
-- 2.30.2