die('You should not access this file directly.'); } $user_id = (int) w2PgetParam($_GET, 'user_id', 0); $contact_id = (int) w2PgetParam($_GET, 'contact_id', 0); if ($user_id == 0) { $canEdit = $canAuthor; } if ($canEdit) { $canEdit = $perms->checkModuleItem('users', $user_id ? 'edit' : 'add', $user_id); } // check permissions if (!$canEdit && $user_id != $AppUI->user_id) { $AppUI->redirect('m=public&a=access_denied'); } $perms =& $AppUI->acl(); $crole = new CSystem_Role(); $roles = $crole->getRoles(); // Format the roles for use in arraySelect $roles_arr = array(); foreach ($roles as $role) { if ($role['name'] != 'Administrator') { $roles_arr[$role['id']] = $role['name']; } else { if ($perms->checkModuleItem('system', 'edit')) { $roles_arr[$role['id']] = $role['name']; } } } $roles_arr = arrayMerge(array(0 => ''), $roles_arr); //TODO: These queries should be replaced with the standard load methods. if ($contact_id) {
public function __construct($name = '', $description = '') { parent::__construct($name, $description); trigger_error("CRole has been deprecated in v3.0 and will be removed by v4.0. Please use CSystem_Role instead.", E_USER_NOTICE); }
<?php if (!defined('W2P_BASE_DIR')) { die('You should not access this file directly.'); } // check permissions $perms =& $AppUI->acl(); if (!canEdit('roles')) { $AppUI->redirect(ACCESS_DENIED); } $del = (int) w2PgetParam($_POST, 'del', 0); $copy_role_id = w2PgetParam($_POST, 'copy_role_id', null); $role = new CSystem_Role(); if (!$role->bind($_POST)) { $AppUI->setMsg($msg, UI_MSG_ERROR); $AppUI->redirect('m=system&u=roles'); } $action = $del ? 'deleted' : 'stored'; $success = $del ? $role->delete() : $role->store(); if ($success) { $AppUI->setMsg('Role ' . $action, UI_MSG_OK, true); if ($copy_role_id) { $role->copyPermissions($copy_role_id, $role->role_id); } } else { $AppUI->setMsg($role->getError(), UI_MSG_ERROR); } $AppUI->redirect('m=system&u=roles');