From 2903f1138ef76833c34bdbcbcac04262cef3a455 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 27 May 2015 05:31:16 +0000 Subject: [PATCH] =?UTF-8?q?*=20Addressbook:=20visualize=20own=20account=20?= =?UTF-8?q?ACL=20for=20non-admin=20users=20by=20making=20all=20other=20fie?= =?UTF-8?q?lds=20readonly=20fixes=20#9669=20-=20Eigenes=20Profil=20=C3=A4n?= =?UTF-8?q?dern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addressbook/inc/class.addressbook_ui.inc.php | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 30dd34d1d0..89e143b345 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1967,13 +1967,13 @@ window.egw_LAB.wait(function() { } break; } - // type change + $view = !$this->check_perms(EGW_ACL_EDIT, $content); } else { $content = array(); $contact_id = $_GET['contact_id'] ? $_GET['contact_id'] : ((int)$_GET['account_id'] ? 'account:'.(int)$_GET['account_id'] : 0); - $view = $_GET['view']; + $view = (boolean)$_GET['view']; // new contact --> set some defaults if ($contact_id && is_array($content = $this->read($contact_id))) { @@ -2174,6 +2174,11 @@ window.egw_LAB.wait(function() { $readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content); $readonlys['button[copy]'] = $readonlys['button[edit]'] = $readonlys['button[vcard]'] = true; $readonlys['button[save]'] = $readonlys['button[apply]'] = $view; + if ($view) + { + $readonlys['__ALL__'] = true; + $readonlys['button[cancel]'] = false; + } $sel_options['fileas_type'] = $this->fileas_options($content); $sel_options['adr_one_countrycode']['-custom-'] = lang('Custom'); @@ -2194,7 +2199,18 @@ window.egw_LAB.wait(function() { { $readonlys[$field] = true; } - if ($readonlys['n_fileas']) $readonlys['fileas_type'] = true; + // for editing own account, make all fields not allowed by own_account_acl readonly + if (!$this->is_admin() && !$content['owner'] && $content['account_id'] == $this->user && $this->own_account_acl && !$view) + { + $readonlys['__ALL__'] = true; + $readonlys['button[cancel]'] = false; + + foreach($this->own_account_acl as $field) + { + $readonlys[$field] = false; + } + } + if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas']; // disable not needed tabs $readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']); $readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts;