- improvement : in admin/user_perm, already authorized categories thanks to
group associations are displayed and not taken into account for user specific permissions. git-svn-id: http://piwigo.org/svn/trunk@818 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
20f0541697
commit
3cf427b4d6
4 changed files with 82 additions and 5 deletions
|
@ -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');
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue