From 92f80e5d799aa7fef5f00cbf5c27e32f92c4b2ea Mon Sep 17 00:00:00 2001 From: rvelices Date: Tue, 11 Sep 2007 02:24:51 +0000 Subject: feature 731: permissions at image level - this is the first version - I wait for feedback before changing help files git-svn-id: http://piwigo.org/svn/trunk@2084 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/user_list.php | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'admin/user_list.php') diff --git a/admin/user_list.php b/admin/user_list.php index 1c7a752d4..8e3e06d65 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -97,7 +97,8 @@ SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, u.'.$conf['user_fields']['email'].' AS email, ui.status, ui.adviser, - ui.enabled_high + ui.enabled_high, + ui.level FROM '.USERS_TABLE.' AS u INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.'.$conf['user_fields']['id'].' = ui.user_id @@ -256,7 +257,7 @@ if (isset($_POST['delete']) and count($collection) > 0) { array_push($page['errors'], l10n('Guest cannot be deleted')); } - if (($conf['guest_id'] != $conf['default_user_id']) and + if (($conf['guest_id'] != $conf['default_user_id']) and in_array($conf['default_user_id'], $collection)) { array_push($page['errors'], l10n('Default user cannot be deleted')); @@ -351,9 +352,10 @@ DELETE FROM '.USER_GROUP_TABLE.' $formfields = array('nb_image_line', 'nb_line_page', 'template', 'language', 'recent_period', 'maxwidth', 'expand', 'show_nb_comments', - 'show_nb_hits', 'maxheight', 'status', 'enabled_high'); + 'show_nb_hits', 'maxheight', 'status', 'enabled_high', + 'level'); - $true_false_fields = array('expand', 'show_nb_comments', + $true_false_fields = array('expand', 'show_nb_comments', 'show_nb_hits', 'enabled_high'); if ($conf['allow_adviser']) { @@ -756,6 +758,19 @@ foreach ($groups as $group_id => $group_name) )); } +// user level options +$blockname = 'level_option'; +foreach ($conf['available_permission_levels'] as $level) +{ + $template->assign_block_vars( + $blockname, + array( + 'VALUE' => $level, + 'CONTENT' => l10n( sprintf('Level %d', $level) ), + 'SELECTED' => $level==$default_user['level'] ? 'selected="selected"' : '', + )); +} + // +-----------------------------------------------------------------------+ // | navigation bar | // +-----------------------------------------------------------------------+ @@ -818,6 +833,13 @@ foreach ($visible_user_list as $num => $local_user) $checked = ''; } + $properties = array(); + $properties[] = + (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) + ? $lang['is_high_enabled'] : $lang['is_high_disabled']; + + $properties[] = l10n( sprintf('Level %d', $local_user['level']) ); + $template->assign_block_vars( 'user', array( @@ -836,9 +858,8 @@ foreach ($visible_user_list as $num => $local_user) ? '
['.l10n('adviser').']' : ''), 'EMAIL' => get_email_address_as_display_text($local_user['email']), 'GROUPS' => $groups_string, - 'PROPERTIES' => - (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) - ? $lang['is_high_enabled'] : $lang['is_high_disabled'] + 'PROPERTIES' => implode( ',', $properties), + ) ); trigger_action('loc_assign_block_var_local_user_list', $local_user); -- cgit v1.2.3