Exemplo n.º 1
0
 */
$fieldset_data = array('title' => _l('User Security'), 'class' => 'tableclass tableclass_form tableclass_full', 'elements' => array());
if (module_user::can_i('edit', 'Users Permissions', 'Config')) {
    if ($user_id == 1) {
        $fieldset_data['elements']['role'] = array('title' => _l('User Role'), 'fields' => array(_l('All Permissions')));
    } else {
        $user_roles = isset($user['roles']) && is_array($user['roles']) ? $user['roles'] : array();
        $roles = module_security::get_roles();
        $roles_attributes = array();
        foreach ($roles as $role) {
            $roles_attributes[$role['security_role_id']] = $role['name'];
        }
        $current_role = current($user_roles);
        $fieldset_data['elements']['role'] = array('title' => _l('User Role'), 'fields' => array(array('type' => 'select', 'name' => 'role_id', 'value' => isset($current_role['security_role_id']) ? $current_role['security_role_id'] : false, 'options' => $roles_attributes)));
        if (module_security::can_i('view', 'Security Roles', 'Security')) {
            $fieldset_data['elements']['role']['fields'][] = ' <a href="' . module_security::link_open_role($current_role['security_role_id']) . '">edit</a> ';
        }
        $fieldset_data['elements']['role']['fields'][] = _hr('You can setup a list of permissions to re-use over and over again under Settings > Roles. This will control what parts of the application this user can access (if any). ');
    }
}
$fieldset_data['elements']['username'] = array('title' => _l('Username'), 'fields' => array(_l('(same as email address)')));
?>
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input style="display:none" type="text" name="fakeusernameremembered"/>
<input style="display:none" type="password" name="fakepasswordremembered"/>
<?php 
if ($user_id == module_security::get_loggedin_id() || module_user::can_i('edit', 'Users Passwords', 'Config')) {
    // do we allow this user to create a password ? or do they have to enter their old password first to change it.
    if (!$user['password'] || module_user::can_i('create', 'Users Passwords', 'Config') || isset($_REQUEST['reset_password']) && $_REQUEST['reset_password'] == module_security::get_auto_login_string($user['user_id'])) {
        $fieldset_data['elements']['password'] = array('title' => _l('Set Password'), 'fields' => array(array('type' => 'password', 'name' => 'password_new', 'autocomplete' => 'off', 'value' => '', 'class' => 'no_permissions', 'help' => 'Giving this user a password and login permissions will let them gain access to this system. Depending on the permissions you give them will decide what parts of the system they can access.')));
    } else {
Exemplo n.º 2
0
/** 
 * Copyright: dtbaker 2012
 * Licence: Please check CodeCanyon.net for licence details. 
 * More licence clarification available here:  http://codecanyon.net/wiki/support/legal-terms/licensing-terms/ 
 * Deploy: 9809 f200f46c2a19bb98d112f2d32a8de0c4
 * Envato: 4ffca17e-861e-4921-86c3-8931978c40ca
 * Package Date: 2015-11-25 02:55:20 
 * IP Address: 67.79.165.254
 */
if (!module_config::can_i('view', 'Settings') || !module_security::can_i('view', 'Security Roles', 'Security')) {
    redirect_browser(_BASE_HREF);
}
$search = isset($_REQUEST['search']) && is_array($_REQUEST['search']) ? $_REQUEST['search'] : array();
$roles = $module->get_roles($search);
$header = array('type' => 'h2', 'title' => _l('Security Roles'), 'main' => true, 'button' => array('title' => 'Add New Role', 'type' => 'add', 'url' => module_security::link_open_role('new')));
print_heading($header);
?>



<form action="" method="post">


<?php 
/** START TABLE LAYOUT **/
$table_manager = module_theme::new_table_manager();
$columns = array();
$columns['name'] = array('title' => 'Name', 'callback' => function ($role) use(&$module) {
    echo $module->link_open_role($role['security_role_id'], true);
}, 'cell_class' => 'row_action');
Exemplo n.º 3
0
        $security_role_id = 'new';
    }
}
if ($security_role_id == 'new' || !$security_role_id) {
    if (class_exists('module_security', false)) {
        module_security::check_page(array('category' => 'Security', 'page_name' => 'Security Roles', 'module' => 'security', 'feature' => 'create'));
    }
    $security_role = array('security_role_id' => 'new', 'name' => '');
}
if (module_security::can_i('edit', 'Security Roles', 'Security') && isset($_REQUEST['delete_security_permission_id'])) {
    $id = (int) $_REQUEST['delete_security_permission_id'];
    if ($id > 0) {
        delete_from_db('security_permission', 'security_permission_id', $id);
        delete_from_db('security_role_perm', 'security_permission_id', $id);
    }
    redirect_browser(module_security::link_open_role($security_role_id) . '&advanced');
}
if (isset($_REQUEST['export_json'])) {
    $export_json = array();
}
?>


	
<form action="" method="post">
	<input type="hidden" name="_process" value="save_security_role" />
	<input type="hidden" name="security_role_id" value="<?php 
echo $security_role_id;
?>
" />