function get_user_privdesc(&$user) { global $priv_list; $privs = array(); $user_privs = $user['priv']; if (!is_array($user_privs)) { $user_privs = array(); } $names = local_user_get_groups($user, true); foreach ($names as $name) { $group = getGroupEntry($name); $group_privs = $group['priv']; if (!is_array($group_privs)) { continue; } foreach ($group_privs as $pname) { if (in_array($pname, $user_privs)) { continue; } if (!$priv_list[$pname]) { continue; } $priv = $priv_list[$pname]; $priv['group'] = $group['name']; $privs[] = $priv; } } foreach ($user_privs as $pname) { if ($priv_list[$pname]) { $privs[] = $priv_list[$pname]; } } return $privs; }
function getUserGroups($username, $authcfg) { global $config; $member_groups = array(); $user = getUserEntry($username); if ($user !== false) { $allowed_groups = local_user_get_groups($user, true); if (isset($config['system']['group'])) { foreach ($config['system']['group'] as $group) { if (in_array($group['name'], $allowed_groups)) { $member_groups[] = $group['name']; } } } } return $member_groups; }
function get_user_privdesc(&$user) { global $priv_list; $privs = array(); if (!isset($user['priv']) || !is_array($user['priv'])) { $user_privs = array(); } else { $user_privs = $user['priv']; } $names = local_user_get_groups($user, true); foreach ($names as $name) { $group = getGroupEntry($name); if (isset($group['priv']) && is_array($group['priv'])) { foreach ($group['priv'] as $pname) { if (in_array($pname, $user_privs)) { continue; } if (empty($priv_list[$pname])) { continue; } $priv = $priv_list[$pname]; $priv['group'] = $group['name']; $priv['id'] = $pname; $privs[] = $priv; } } } foreach ($user_privs as $pname) { if (!empty($priv_list[$pname])) { $priv_list[$pname]['id'] = $pname; $privs[] = $priv_list[$pname]; } } legacy_html_escape_form_data($privs); return $privs; }
<?php echo htmlspecialchars($userent['name']); ?> </td> <td><?php echo htmlspecialchars($userent['descr']); ?> </td> <td><?php if (isset($userent['disabled'])) { echo "*"; } ?> </td> <td><?php echo implode(",", local_user_get_groups($userent)); ?> </td> <td> <a class="fa fa-pencil" title="<?php echo gettext("Edit user"); ?> " href="?act=edit&userid=<?php echo $i; ?> "></a> <?php if ($userent['scope'] != "system") { ?> <a class="fa fa-trash" title="<?php echo gettext("Delete user");