From: hickert
Date: Fri, 20 Apr 2007 12:02:35 +0000 (+0000)
Subject: ACL changes:
X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3d2f057ca57d65d2a21753d0bb241af70ed7a521;p=gosa.git
ACL changes:
Management -> Added functionality to remove acl roles. This is currently not working, roles can't be deleted right now.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6154 594d385d-05f5-0310-b6e9-bd551577e9d8
---
diff --git a/plugins/admin/acl/class_aclManagement.inc b/plugins/admin/acl/class_aclManagement.inc
index 429cdeab4..7eb673fa2 100644
--- a/plugins/admin/acl/class_aclManagement.inc
+++ b/plugins/admin/acl/class_aclManagement.inc
@@ -56,7 +56,7 @@ class aclManagement extends plugin
/* Call parent execute */
plugin::execute();
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^list/","/^id_/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^list/","/^id_/","/^list_acl_role_del/");
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to be taken
@@ -199,6 +199,71 @@ class aclManagement extends plugin
}
+ /********************
+ Delete entry requested, display confirm dialog
+ ********************/
+
+ /* Remove acl was requested */
+ if ($s_action=="del_role"){
+
+ /* Get 'dn' from posted acl */
+ $this->dn= $this->list[trim($s_entry)]['dn'];
+
+ /* Check permissions */
+ if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
+
+ /* Check locking, save current plugin in 'back_plugin', so
+ the dialog knows where to return. */
+ if (($acl= get_lock($this->dn)) != ""){
+ return(gen_locked_message ($acl, $this->dn));
+ }
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ add_lock ($this->dn, $this->ui->dn);
+ $smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
+ $smarty->assign("is_role",true);
+
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ } else {
+
+ /* Obviously the acl isn't allowed to delete. Show message and
+ clean session. */
+ print_red (_("You are not allowed to delete this acl!"));
+ }
+ }
+
+
+ /********************
+ Delete entry confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. Acl should be deleted. */
+ if (isset($_POST['delete_acl_role_confirmed'])){
+
+ /* Check permissions */
+ if(preg_match("/d/",$this->ui->get_permissions($this->dn,"aclroles/aclrole"))){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->acltabs= new aclroletab($this->config, NULL,$this->dn);
+ $this->acltabs->delete();
+ gosa_log ("ACL role object '".$this->dn."' has been removed");
+ unset ($this->acltabs);
+ $this->acltabs= NULL;
+ } else {
+
+ /* Normally this shouldn't be reached, send some extra
+ logs to notify the administrator */
+ print_red (_("You are not allowed to delete this acl role!"));
+
+ if(isset($this->ui->uid)){
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick acl role deletion.");
+ }
+ }
+
+ /* Remove lock file after successfull deletion */
+ del_lock ($this->dn);
+ }
+
/********************
Delete entry requested, display confirm dialog
********************/
@@ -221,6 +286,7 @@ class aclManagement extends plugin
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
$smarty->assign("info", sprintf(_("You're about to delete the acl %s."), @LDAP::fix($this->dn)));
+ $smarty->assign("is_role",false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
diff --git a/plugins/admin/acl/class_aclRole.inc b/plugins/admin/acl/class_aclRole.inc
index 0b318d062..76878da0c 100644
--- a/plugins/admin/acl/class_aclRole.inc
+++ b/plugins/admin/acl/class_aclRole.inc
@@ -905,6 +905,7 @@ class aclrole extends plugin
function remove_from_parent()
{
+ echo "Role should be deleted here- What happens with assigned roles ... ";
}
function save_object()
diff --git a/plugins/admin/acl/remove.tpl b/plugins/admin/acl/remove.tpl
index 047b2adc9..0b5323df4 100755
--- a/plugins/admin/acl/remove.tpl
+++ b/plugins/admin/acl/remove.tpl
@@ -11,7 +11,13 @@
+{if $is_role}
+
+
+
+{else}
+{/if}