本文整理汇总了PHP中Roles::is_roletask_exist方法的典型用法代码示例。如果您正苦于以下问题:PHP Roles::is_roletask_exist方法的具体用法?PHP Roles::is_roletask_exist怎么用?PHP Roles::is_roletask_exist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Roles
的用法示例。
在下文中一共展示了Roles::is_roletask_exist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Roles
for ($i = 1; $i <= $count_role; $i++) {
$role_id = $_POST['link_id' . $i];
$role = new Roles();
$task_count = (int) $_POST['taskcount'];
for ($j = 1; $j <= $task_count; $j++) {
$task_id = $_POST['taskid' . $j];
$chk = $role_id . '~' . $task_id;
if ($_POST[$chk]) {
try {
$role->assign_tasks_to_role($task_id, $role_id);
} catch (PAException $e) {
$msg = "{$e->message}";
$error = TRUE;
}
} else {
$task_exist = Roles::is_roletask_exist($role_id, $task_id);
if ($task_exist) {
Roles::delete_taskrole($role_id, $task_id);
}
}
}
}
header("Location:assign_tasks.php?msg=9015");
exit;
}
$permission_denied_msg = '';
if (!$configure_permission) {
$error = TRUE;
$permission_denied_msg = "Sorry! you are not authorized to view the content of this page";
}
$page = new PageRenderer("setup_module", PAGE_TASK_MANAGE, "", 'container_two_column.tpl', 'header.tpl', PRI, HOMEPAGE, $network_info);
示例2: check_permission
/**
Purpose : this function checks if a given user has permission to given task
@param : $uid, $task_id
@return : TRUE, FALSE
**/
public static function check_permission($uid, $task_id)
{
Logger::log("Enter: function Roles::check_permission");
if (SUPER_USER_ID == $uid) {
return TRUE;
//TODO:same holds true for network owner
}
$role_obj = Roles::get_user_role($uid);
if (empty($role)) {
Logger::log("Exit: function Roles::check_permission");
return FALSE;
}
$role = $role_obj->role_id;
$perm = Roles::is_roletask_exist($role, $task_id);
//dont support multiple roles of user
Logger::log("Exit: function Roles::check_permission");
return $perm;
}
示例3: check_permission
public static function check_permission($uid, $task_id)
{
$result = false;
Logger::log("Enter: function Roles::check_permission");
if (SUPER_USER_ID == $uid) {
return TRUE;
//TODO:same holds true for network owner
}
$role_obj = Roles::get_user_roles($uid);
foreach ($role_obj as $r_obj) {
$result = Roles::is_roletask_exist($r_obj->role_id, $task_id);
if ($result) {
break;
}
// user have permission for this task!
}
Logger::log("Exit: function Roles::check_permission");
return $result;
}