From 62ceaa5e960907754c9e00c64280207c23a000a7 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 15 Oct 2010 10:09:26 +0000 Subject: [PATCH] Added check to folder editor dialog git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20057 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../FolderWidget/class_FolderEditDialog.inc | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc index ec54aa69c..ef8556130 100644 --- a/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc +++ b/gosa-plugins/groupware/personal/groupware/FolderWidget/class_FolderEditDialog.inc @@ -59,6 +59,7 @@ class FolderEditDialog extends plugin // Name or ACL modified? if(isset($_POST["permission_{$id}_name"])) { + $name = get_post("permission_{$id}_name"); $this->folderItem['acls'][$id]['name'] = get_post("permission_{$id}_name"); } if(isset($_POST["permission_{$id}_acl"])) { @@ -75,16 +76,42 @@ class FolderEditDialog extends plugin if(isset($_POST['permission_add'])){ $this->folderItem['acls'][] = array('name' => '', 'acl' => 0, 'type' => 'user'); } + $this->folderItem['acls'] = array_values($this->folderItem['acls']); } + function isNew() { return($this->isNew); } + + function check() + { + $message = array(); + + // Check if we've duplicate ACL definitions for a user + $aclNames = array(); + foreach($this->folderItem['acls'] as $entry){ + if(!isset($aclNames[$entry['name']])){ + $aclNames[$entry['name']] = TRUE; + }else{ + $message[] = sprintf(_("Duplicate permission setting for user '%s'."), $entry['name']); + } + } + + return($message); + } + + function save() { + // Remove empty ACL defintions + foreach($this->folderItem['acls'] as $id => $entry){ + if(empty($entry['name'])) unset($this->folderItem['acls'][$id]); + } + return($this->folderItem); } } -- 2.30.2