/**
 * @package chamilo.permissions
 */
/**
 * Code
 */
include_once 'permissions_functions.inc.php';
include_once 'all_permissions.inc.php';
$group_id = $_SESSION['_gid'];
echo $group_id;
// ---------------------------------------------------
// 			ACTIONS
// ---------------------------------------------------
if ($_POST['StoreGroupPermissions'] and $setting_visualisation == 'checkbox') {
    $result_message = store_permissions('group', $group_id);
    if ($result_message) {
        Display::display_normal_message($result_message);
    }
}
if (isset($_GET['action'])) {
    if (($_GET['action'] == 'grant' or $_GET['action'] == 'revoke') and isset($_GET['permission']) and isset($_GET['tool'])) {
        $result_message = store_one_permission('group', $_GET['action'], $group_id, $_GET['tool'], $_GET['permission']);
    }
    if (isset($_GET['role']) and ($_GET['action'] == 'grant' or $_GET['action'] == 'revoke')) {
        $result_message = assign_role('group', $_GET['action'], $group_id, $_GET['role'], $_GET['scope']);
        echo 'hier';
    }
}
if (isset($result_message)) {
    Display::display_normal_message($result_message);
 */
/**
 * Code
 */
$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() . "/blog.lib.php";
// ---------------------------------------------------
// 			ACTIONS
// ---------------------------------------------------
if ($_POST['StoreUserPermissions'] and $setting_visualisation == 'checkbox') {
    $result_message = store_permissions('user', $user_id);
    if ($result_message) {
        Display::display_normal_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)) {
    Display::display_normal_message($result_message);
}
Example #3
0
 */
require '../inc/global.inc.php';
require_once 'permissions_functions.inc.php';
require_once 'all_permissions.inc.php';
$tool_name = get_lang('Roles');
// title of the page (should come from the language file)
Display::display_header($tool_name);
// 			ACTIONS
// storing all the permission for a given role when the checkbox approach is used
if ($_POST['StoreRolePermissions']) {
    if (!empty($_POST['role_name'])) {
        $table_role = Database::get_course_table(TABLE_ROLE);
        $sql = "INSERT INTO {$table_role} (role_name, role_comment, default_role)\n\t\t\t\t\tVALUES ('" . Database::escape_string($_POST['role_name']) . "','" . Database::escape_string($_POST['role_comment']) . "','" . Database::escape_string($_POST['default_role']) . "')";
        $result = Database::query($sql);
        $role_id = Database::insert_id();
        $result_message = store_permissions('role', $role_id);
    } else {
        $result_message = get_lang('ErrorPleaseGiveRoleName');
    }
}
// storing a permission for a given role when the image approach is used
if (isset($_GET['action']) and isset($_GET['permission']) and isset($_GET['tool'])) {
    if ($_GET['action'] == 'grant' or $_GET['action'] == 'revoke') {
        $result_message = store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']);
    }
}
// deleting a role
if (isset($_GET['action']) and isset($_GET['role_id']) and $_GET['action'] == 'delete') {
    //deleting the assignments fo this role: users
    $table = Database::get_course_table(TABLE_ROLE_USER);
    $sql = "DELETE FROM {$table} WHERE role_id='" . Database::escape_string($_GET['role_id']) . "'";
Example #4
0
    $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
    bb_die($message);
} else {
    if ($submit && $mode == 'group' && is_array(@$_POST['auth'])) {
        if (!($group_data = get_group_data($group_id))) {
            bb_die($lang['GROUP_NOT_EXIST']);
        }
        $auth = array();
        array_deep($_POST['auth'], 'intval');
        foreach ($_POST['auth'] as $f_id => $bf_ary) {
            if (array_sum($bf_ary)) {
                $auth[$f_id] = bit2dec(array_keys($bf_ary, 1));
            }
        }
        delete_permissions($group_id, null, $cat_id);
        store_permissions($group_id, $auth);
        update_user_level('all');
        $l_auth_return = $lang['CLICK_RETURN_GROUPAUTH'];
        $message = $lang['AUTH_UPDATED'] . '<br /><br />';
        $message .= sprintf($l_auth_return, '<a href="admin_ug_auth.php?mode=' . $mode . '">', '</a>') . '<br /><br />';
        $message .= sprintf($lang['CLICK_RETURN_ADMIN_INDEX'], '<a href="index.php?pane=right">', '</a>');
        bb_die($message);
    }
}
//
// Front end (changing permissions)
//
if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) {
    $page_cfg['quirks_mode'] = true;
    if (!empty($_POST['username'])) {
        $this_userdata = get_userdata($_POST['username'], true);