diff options
Diffstat (limited to '')
-rw-r--r-- | admin/user_perm.php | 51 | ||||
-rw-r--r-- | doc/ChangeLog | 6 | ||||
-rw-r--r-- | template/default/admin/user_perm.tpl | 22 | ||||
-rw-r--r-- | template/default/default.css | 8 |
4 files changed, 82 insertions, 5 deletions
diff --git a/admin/user_perm.php b/admin/user_perm.php index 56af243bb..400678ce2 100644 --- a/admin/user_perm.php +++ b/admin/user_perm.php @@ -141,12 +141,56 @@ $template->assign_vars( ) ); + +// retrieve category ids authorized to the groups the user belongs to +$group_authorized = array(); + +$query = ' +SELECT DISTINCT cat_id, c.uppercats, c.global_rank + FROM '.USER_GROUP_TABLE.' AS ug + INNER JOIN '.GROUP_ACCESS_TABLE.' AS ga + ON ug.group_id = ga.group_id + INNER JOIN '.CATEGORIES_TABLE.' AS c + ON c.id = ga.cat_id + WHERE ug.user_id = '.$page['user'].' +;'; +$result = pwg_query($query); + +if (mysql_num_rows($result) > 0) +{ + $template->assign_block_vars('groups', array()); + + $cats = array(); + while ($row = mysql_fetch_array($result)) + { + array_push($cats, $row); + array_push($group_authorized, $row['cat_id']); + } + usort($cats, 'global_rank_compare'); + + foreach ($cats as $category) + { + $template->assign_block_vars( + 'groups.category', + array( + 'NAME' => get_cat_display_name_cache($category['uppercats'], '', false) + ) + ); + } +} + // only private categories are listed $query_true = ' SELECT id,name,uppercats,global_rank FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_ACCESS_TABLE.' ON cat_id = id WHERE status = \'private\' - AND user_id = '.$page['user'].' + AND user_id = '.$page['user']; +if (count($group_authorized) > 0) +{ + $query_true.= ' + AND cat_id NOT IN ('.implode(',', $group_authorized).')'; +} +$query_true.= ' ;'; display_select_cat_wrapper($query_true,array(),'category_option_true'); @@ -166,6 +210,11 @@ if (count($authorized_ids) > 0) $query_false.= ' AND id NOT IN ('.implode(',', $authorized_ids).')'; } +if (count($group_authorized) > 0) +{ + $query_false.= ' + AND id NOT IN ('.implode(',', $group_authorized).')'; +} $query_false.= ' ;'; display_select_cat_wrapper($query_false,array(),'category_option_false'); diff --git a/doc/ChangeLog b/doc/ChangeLog index 8b7603164..5664c19dd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,11 @@ 2005-08-17 Pierrick LE GALL + * improvement : in admin/user_perm, already authorized categories + thanks to group associations are displayed and not taken into + account for user specific permissions. + +2005-08-17 Pierrick LE GALL + * modification : major simplification of admin.php. Titles are managed by included page, localized items are managed directly in the template. diff --git a/template/default/admin/user_perm.tpl b/template/default/admin/user_perm.tpl index ebb4be2e7..108885d1e 100644 --- a/template/default/admin/user_perm.tpl +++ b/template/default/admin/user_perm.tpl @@ -1,7 +1,21 @@ <h1>{TITLE}</h1> -<form method="post" action="{F_ACTION}"> - {DOUBLE_SELECT} -</form> +<!-- BEGIN groups --> +<fieldset> + <legend>{lang:Categories authorized thanks to group associations}</legend> -<p>{lang:Only private categories are listed}</p> + <ul> + <!-- BEGIN category --> + <li>{groups.category.NAME}</li> + <!-- END category --> + </ul> +</fieldset> +<!-- END groups --> + +<fieldset> + <legend>{lang:Other private categories}</legend> + + <form method="post" action="{F_ACTION}"> + {DOUBLE_SELECT} + </form> +</fieldset> diff --git a/template/default/default.css b/template/default/default.css index 4ac6caa96..ac65a076b 100644 --- a/template/default/default.css +++ b/template/default/default.css @@ -596,4 +596,12 @@ div#theNavbar>dl>dd>ul { list-style-type: square; padding-left: 15px; margin: 5px; +} + +div#adminMain>fieldset { + margin: 10px; +} + +fieldset>legend { + font-style: italic; }
\ No newline at end of file |