123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- <?php
- $user_id = $userIdViewed;
- if ($mainUserInfo['status'] == 1) {
- $course_admin = 1;
- }
- include_once('permissions_functions.inc.php');
- include_once('all_permissions.inc.php');
- include_once (api_get_library_path()."/groupmanager.lib.php");
- include_once (api_get_library_path()."/blog.lib.php");
- if ($_POST['StoreUserPermissions'] and $setting_visualisation == 'checkbox') {
- $result_message = store_permissions('user', $user_id);
- if ($result_message) {
- echo Display::return_message($result_message);
- }
- }
- if (isset($_GET['action'])) {
- if (isset($_GET['permission']) AND isset($_GET['tool']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
- {
- $result_message = store_one_permission('user', $_GET['action'], $user_id, $_GET['tool'], $_GET['permission']);
- }
- if (isset($_GET['role']) AND ($_GET['action'] == 'grant' OR $_GET['action'] == 'revoke'))
- {
- $result_message = assign_role('user', $_GET['action'], $user_id, $_GET['role'], $_GET['scope']);
- }
- }
- if (isset($result_message)) {
- echo Display::return_message($result_message);
- }
- $current_user_permissions = array();
- $current_user_permissions = get_permissions('user', $user_id);
- $groups_of_user = array();
- $groups_of_user = GroupManager::get_group_ids($_course['real_id'], $user_id);
- foreach ($groups_of_user as $group)
- {
- $this_group_permissions = get_permissions('group', $group);
- foreach ($this_group_permissions as $tool=>$permissions)
- {
- foreach ($permissions as $permission)
- {
- $inherited_group_permissions[$tool][] = $permission;
- }
- }
- }
- $inherited_permissions = $inherited_group_permissions;
- if (api_get_setting('user_roles') == 'true') {
-
- $current_user_role_permissions_of_user = get_roles_permissions('user', $user_id);
- $inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
-
-
-
-
-
-
-
-
-
- $current_user_role_permissions_of_user = get_roles_permissions('user', $user_id, 'platform');
- $inherited_permissions = permission_array_merge($inherited_permissions, $current_user_role_permissions_of_user);
- }
- if (api_get_setting('group_roles') == 'true')
- {
-
- foreach ($groups_of_user as $group)
- {
- $this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id);
-
- }
- }
- $current_user_permissions = limited_or_full($current_user_permissions);
- $inherited_permissions = limited_or_full($inherited_permissions);
- if (api_get_setting('permissions') == 'limited')
- {
- $header_array = $rights_limited;
- }
- if (api_get_setting('permissions') == 'full')
- {
- $header_array = $rights_full;
- }
- echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">";
- if (api_get_setting('user_roles') == 'true')
- {
-
- echo '<strong>'.get_lang('UserRoles').'</strong><br />';
- $current_user_course_roles = get_roles('user', $user_id);
- $current_user_platform_roles = get_roles('user', $user_id, 'platform');
- display_role_list($current_user_course_roles, $current_user_platform_roles);
- echo '<br />';
- }
- echo '<strong>'.get_lang('UserPermissions').'</strong>';
- echo "<table class=\"data_table\">\n";
- echo "\t<tr>\n";
- echo "\t\t<th>".get_lang('Module')."</th>\n";
- foreach ($header_array as $header_key=>$header_value)
- {
- echo "\t\t<th>".get_lang($header_value)."</th>\n";
- }
- echo "\t</tr>\n";
- foreach ($tool_rights as $tool => $rights) {
- echo "\t<tr>\n";
- echo "\t\t<td>\n";
- if (strstr($tool, 'BLOG')) {
-
-
- $tmp = strpos($tool, '_') + 1;
- $blog_id = substr($tool, $tmp, strlen($tool));
-
- echo get_lang('Blog').": ".Blog::getBlogTitle($blog_id);
- } else {
- echo get_lang($tool);
- }
- echo "\t\t</td>\n";
- foreach ($header_array as $key => $value) {
- echo "\t\t<td align='center'>\n";
- if (in_array($value, $rights)) {
- if ($setting_visualisation == 'checkbox') {
- display_checkbox_matrix(
- $current_user_permissions,
- $tool,
- $value,
- $inherited_permissions,
- $course_admin
- );
- }
- if ($setting_visualisation == 'image') {
- display_image_matrix(
- $current_user_permissions,
- $tool,
- $value,
- $inherited_permissions,
- $course_admin
- );
- }
- }
-
-
-
-
- echo "\t\t</td>\n";
- }
- echo "\t</tr>\n";
- }
- echo "</table>\n";
- if ($setting_visualisation == 'checkbox') {
- echo "<input type=\"Submit\" name=\"StoreUserPermissions\" value=\"".get_lang('StorePermissions')."\">";
- }
- echo "</form><br />";
- echo '<strong>'.get_lang('Legend').'</strong><br />';
- echo '<img src="../img/wrong.gif" /> '.get_lang('UserHasPermissionNot').'<br />';
- echo '<img src="../img/checkbox_on2.gif" /> '.get_lang('UserHasPermission').'<br />';
- echo '<img src="../img/checkbox_on3.gif" /> '.get_lang('UserHasPermissionByRoleGroup').'<br />';
|