38 |
|
|
39 |
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"]; |
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"]; |
40 |
|
|
41 |
|
// Defini si peux modifier utilisateurs et permisssions |
42 |
|
$caneditperms=($user->admin || $user->rights->user->user->creer); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
/** |
/** |
47 |
* Actions |
* Actions |
48 |
*/ |
*/ |
49 |
if ($_GET["action"] == 'addrights' && $user->admin) |
if ($_GET["action"] == 'addrights' && $caneditperms) |
50 |
{ |
{ |
51 |
$edituser = new User($db,$_GET["id"]); |
$edituser = new User($db,$_GET["id"]); |
52 |
$edituser->addrights($_GET["rights"],$module); |
$edituser->addrights($_GET["rights"],$module); |
53 |
} |
} |
54 |
|
|
55 |
if ($_GET["action"] == 'delrights' && $user->admin) |
if ($_GET["action"] == 'delrights' && $caneditperms) |
56 |
{ |
{ |
57 |
$edituser = new User($db,$_GET["id"]); |
$edituser = new User($db,$_GET["id"]); |
58 |
$edituser->delrights($_GET["rights"],$module); |
$edituser->delrights($_GET["rights"],$module); |
200 |
print '<table width="100%" class="noborder">'; |
print '<table width="100%" class="noborder">'; |
201 |
print '<tr class="liste_titre">'; |
print '<tr class="liste_titre">'; |
202 |
print '<td>'.$langs->trans("Module").'</td>'; |
print '<td>'.$langs->trans("Module").'</td>'; |
203 |
if ($user->admin) print '<td width="24"> </td>'; |
if ($caneditperms) print '<td width="24"> </td>'; |
204 |
print '<td align="center" width="24"> </td>'; |
print '<td align="center" width="24"> </td>'; |
205 |
print '<td>'.$langs->trans("Permissions").'</td>'; |
print '<td>'.$langs->trans("Permissions").'</td>'; |
206 |
print '</tr>'; |
print '</tr>'; |
236 |
$objMod=$modules[$obj->module]; |
$objMod=$modules[$obj->module]; |
237 |
$picto=($objMod->picto?$objMod->picto:'generic'); |
$picto=($objMod->picto?$objMod->picto:'generic'); |
238 |
|
|
239 |
print '<tr '. $bc[$var].'>'; |
if ($caneditperms && ($obj->module != 'user' || ! $user->admin)) |
240 |
print '<td>'.img_object('',$picto).' '.$objMod->getName(); |
{ |
241 |
print '<a name="'.$objMod->getName().'"> </a></td>'; |
// On affiche ligne pour modifier droits |
242 |
print '<td align="center" nowrap>'; |
print '<tr '. $bc[$var].'>'; |
243 |
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fuser->id.'&action=addrights&module='.$obj->module.'">'.$langs->trans("All")."</a>"; |
print '<td>'.img_object('',$picto).' '.$objMod->getName(); |
244 |
print '/'; |
print '<a name="'.$objMod->getName().'"> </a></td>'; |
245 |
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$fuser->id.'&action=delrights&module='.$obj->module.'">'.$langs->trans("None")."</a>"; |
print '<td align="center" nowrap>'; |
246 |
print '</td>'; |
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fuser->id.'&action=addrights&module='.$obj->module.'">'.$langs->trans("All")."</a>"; |
247 |
print '<td colspan="2"> </td>'; |
print '/'; |
248 |
print '</tr>'; |
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$fuser->id.'&action=delrights&module='.$obj->module.'">'.$langs->trans("None")."</a>"; |
249 |
|
print '</td>'; |
250 |
|
print '<td colspan="2"> </td>'; |
251 |
|
print '</tr>'; |
252 |
|
} |
253 |
} |
} |
254 |
|
|
255 |
print '<tr '. $bc[$var].'>'; |
print '<tr '. $bc[$var].'>'; |
257 |
print '<td>'.img_object('',$picto).' '.$objMod->getName(); |
print '<td>'.img_object('',$picto).' '.$objMod->getName(); |
258 |
print '</td>'; |
print '</td>'; |
259 |
|
|
260 |
if (in_array($obj->id, $permsuser)) |
if ($fuser->admin && $obj->module == 'user') |
261 |
|
{ |
262 |
|
// Permission own because admin |
263 |
|
if ($caneditperms) |
264 |
|
{ |
265 |
|
print '<td align="center">'.img_picto($langs->trans("Administrator"),'star').'</td>'; |
266 |
|
} |
267 |
|
print '<td align="center" nowrap>'; |
268 |
|
print img_tick(); |
269 |
|
print '</td>'; |
270 |
|
} |
271 |
|
else if (in_array($obj->id, $permsuser)) |
272 |
{ |
{ |
273 |
// Own permission by user |
// Permission own by user |
274 |
if ($user->admin) |
if ($caneditperms) |
275 |
{ |
{ |
276 |
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>'; |
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>'; |
277 |
} |
} |
280 |
print '</td>'; |
print '</td>'; |
281 |
} |
} |
282 |
else if (in_array($obj->id, $permsgroup)) { |
else if (in_array($obj->id, $permsgroup)) { |
283 |
// Own permission by group |
// Permission own by group |
284 |
if ($user->admin) |
if ($caneditperms) |
285 |
{ |
{ |
286 |
print '<td align="center">'.$langs->trans("Group").'</td>'; |
print '<td align="center">'.$langs->trans("Group").'</td>'; |
287 |
} |
} |
288 |
print '<td align="left" nowrap>'; |
print '<td align="center" nowrap>'; |
289 |
print img_tick(); |
print img_tick(); |
290 |
print '</td>'; |
print '</td>'; |
291 |
} |
} |
292 |
else |
else |
293 |
{ |
{ |
294 |
// Do not own permission |
// Do not own permission |
295 |
if ($user->admin) |
if ($caneditperms) |
296 |
{ |
{ |
297 |
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>'; |
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>'; |
298 |
} |
} |