本文整理汇总了PHP中removePermission函数的典型用法代码示例。如果您正苦于以下问题:PHP removePermission函数的具体用法?PHP removePermission怎么用?PHP removePermission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了removePermission函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lang
if (permissionNameExists($permission)) {
$errors[] = lang("ACCOUNT_PERMISSIONNAME_IN_USE", array($permission));
} elseif (minMaxRange(1, 50, $permission)) {
$errors[] = lang("ACCOUNT_PERMISSION_CHAR_LIMIT", array(1, 50));
} else {
if (updatePermissionName($permissionId, $permission)) {
$successes[] = lang("PERMISSION_NAME_UPDATE", array($permission));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove access to pages
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($permissionId, $remove)) {
$successes[] = lang("PERMISSION_REMOVE_USERS", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($permissionId, $add)) {
$successes[] = lang("PERMISSION_ADD_USERS", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove access to pages
示例2: trim
$title = trim($_POST['title']);
//Validate title
if (minMaxRange(1, 50, $title)) {
$errors[] = lang("ACCOUNT_TITLE_CHAR_LIMIT", array(1, 50));
} else {
if (updateTitle($userId, $title)) {
$successes[] = lang("ACCOUNT_TITLE_UPDATED", array($displayname, $title));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove permission level
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($remove, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_REMOVED", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($add, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_ADDED", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
$userdetails = fetchUserDetails(NULL, NULL, $userId);
}
示例3: dirname
require_once dirname(__FILE__) . '/../../../api_v3/bootstrap.php';
KalturaLog::setLogger(new KalturaStdoutLogger());
DbManager::setConfig(kConf::getDB());
DbManager::initialize();
// load configurations from ini file
$ini = new Zend_Config_Ini($iniFile);
// add new permissions
$oldPermissionsCfg = $ini->permissions;
if ($oldPermissionsCfg) {
foreach ($oldPermissionsCfg as $permCfg) {
if (is_null($permCfg->partnerId) || $permCfg->partnerId === '') {
throw new Exception('Permission partner id must be set');
} else {
$partnerIds = explode(",", $permCfg->partnerId);
foreach ($partnerIds as $partnerId) {
removePermission($permCfg, $partnerId);
}
}
}
}
// add new api action permission items
$oldActionItemsCfg = $ini->action_permission_items;
if ($oldActionItemsCfg) {
foreach ($oldActionItemsCfg as $itemCfg) {
removeActionPermissionItem($itemCfg);
}
}
// add new api parameters permission items
$oldParameterItemsCfg = $ini->parameter_permission_items;
if ($oldParameterItemsCfg) {
foreach ($oldParameterItemsCfg as $itemCfg) {
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:removePermissionsAndItems.php
示例4: S3QLaction
//.........这里部分代码省略.........
#this means the highest scored element does NOT have permission to delete
$ids = array_keys($permission2delete);
#some ids can be swapped, that is class is swapped with rule "hasUID" and instance is swapped with statement of rule "hasUID"
$swap = array('C' => 'rule_id', 'I' => 'statement_id');
foreach ($ids as $to_swap) {
if (in_array(substr($to_swap, 0, 1), array_keys($swap))) {
$letter = substr($to_swap, 0, 1);
$new_id = strtoupper(substr($swap[$letter], 0, 1)) . $info[$to_swap][$swap[$letter]];
} else {
$new_id = $to_swap;
}
$ids1[] = $new_id;
}
$ids = $ids1;
$recalc_permission2delete = $permission2delete;
$has_permission = has_permission(array('uid' => $ids[0], 'shared_with' => $ids[1]), $db);
if (ereg('2$', $has_permission) || ereg('1$', $has_permission) && $element_info['created_by'] == $user_id) {
}
#does the idB have insert permission on idA? Change the score :-)
$recalc_permission2delete[$ids[0]] = substr($has_permission, 2, 1);
#check again the result
$recalc_result = array_combine($core_score, $recalc_permission2delete);
#score as index and permissions as values
#echo '<pre>';print_r($recalc_result);exit;
if ($recalc_result[max(array_keys($recalc_result))] == '0') {
return formatReturn($GLOBALS['error_codes']['no_permission_message'], 'User does not have permission to delete in resource ' . array_search('0', $permission2delete), $format, '');
}
#return ($GLOBALS['messages']['no_permission_message'].'<message>User does not have permission to delete in resource '.array_search('0', $permission2delete).'</message>');
}
}
#still there? Ok, we are ready to remove resource from another resource
$shared_with = array_search(max($core_score), $core_score);
$uid = array_search(min($core_score), $core_score);
$return_message = removePermission(compact('uid', 'shared_with', 'db', 'info', 'user_id'));
insertLogs($uid, $info, $user_id, $db);
return $return_message;
}
#begin cases not considered in "deleteable" and those that need extra operations like rule_log and statement_log insertions
switch ($element) {
case 'key':
#DELETE KEY
#does this key belong to this user?
if ($user_id != '1' && $e_info['account_id'] != $user_id) {
return formatReturn($GLOBALS['error_codes']['no_permission_message'], 'This key cannot be deleted', $format, '');
#return $no_permission_message."<message>This key cannot be deleted</message>";
}
$D['table'] = 'access_keys';
$D['element'] = 'key';
$D['element_id'] = $element_id;
$deleted = delete_element($D);
if ($deleted) {
return formatReturn($GLOBALS['error_codes']['success'], $element . " " . $element_id . " deleted", $format, '');
#$output .= $success;
#$output .= $element." deleted<BR>";
#$query = S3QLRestWrapper(array('key'=>$key));
#$output .= '<a href =" '.$query['url'].$query['s3ql'].'<select>*</select><from>'.$element.'s</from></S3QL>">List '.$element.'s</a>';
#return ($output);
} else {
return formatReturn($GLOBALS['error_codes']['something_went_wrong'], "Failed to delete key", $format, '');
}
break;
case 'permission':
#DELETE PERMISSION
#permission to delete this permission was checked before switch
#it will delete permission from downstream resources via upstream but NOT the other way around.
$permission_info['shared_with'] = $s3ql['where']['user_id'] != '' ? 'U' . $s3ql['where']['user_id'] : array_search(max($core_score), $core_score);
示例5: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
global $baseURL;
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
$permissionId = $_GET['id'];
//Check if selected permission level exists
if (!permissionIdExists($permissionId)) {
header("Location: " . site_url('admin_permissions'));
die;
}
$permissionDetails = fetchPermissionDetails($permissionId);
//Fetch information specific to permission level
//Forms posted
if (!empty($_POST)) {
//Delete selected permission level
if (!empty($_POST['delete'])) {
$deletions = $_POST['delete'];
if ($deletion_count = deletePermission($deletions)) {
$successes[] = lang("PERMISSION_DELETIONS_SUCCESSFUL", array($deletion_count));
header("Location: " . site_url('admin_permissions'));
} else {
$errors[] = lang("SQL_ERROR");
}
} else {
//Update permission level name
if ($permissionDetails[0]['name'] != $_POST['name']) {
$permission = trim($_POST['name']);
//Validate new name
if (permissionNameExists($permission)) {
$errors[] = lang("ACCOUNT_PERMISSIONNAME_IN_USE", array($permission));
} elseif (minMaxRange(1, 50, $permission)) {
$errors[] = lang("ACCOUNT_PERMISSION_CHAR_LIMIT", array(1, 50));
} else {
if (updatePermissionName($permissionId, $permission)) {
$successes[] = lang("PERMISSION_NAME_UPDATE", array($permission));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove access to pages
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($permissionId, $remove)) {
$successes[] = lang("PERMISSION_REMOVE_USERS", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($permissionId, $add)) {
$successes[] = lang("PERMISSION_ADD_USERS", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove access to pages
if (!empty($_POST['removePage'])) {
$remove = $_POST['removePage'];
if ($deletion_count = removePage($remove, $permissionId)) {
$successes[] = lang("PERMISSION_REMOVE_PAGES", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if (!empty($_POST['addPage'])) {
$add = $_POST['addPage'];
if ($addition_count = addPage($add, $permissionId)) {
$successes[] = lang("PERMISSION_ADD_PAGES", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
$permissionDetails = fetchPermissionDetails($permissionId);
}
}
$pagePermissions = fetchPermissionPages($permissionId);
//Retrieve list of accessible pages
$permissionUsers = fetchPermissionUsers($permissionId);
//Retrieve list of users with membership
$userData = fetchAllUsers();
//Fetch all users
$pageData = fetchAllPages();
//Fetch all pages
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Permissions</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminPermission' action='" . $_SERVER['PHP_SELF'] . "?id=" . $permissionId . "' method='post'>\r\n<table class='admin'>\r\n<tr><td>\r\n<h3>Permission Information</h3>\r\n<div id='regbox'>\r\n<p>\r\n<label>ID:</label>\r\n" . $permissionDetails[0]['id'] . "\r\n</p>\r\n<p>\r\n<label>Name:</label>\r\n<input type='text' name='name' value='" . $permissionDetails[0]['name'] . "' />\r\n</p>\r\n<label>Delete:</label>\r\n<input type='checkbox' name='delete[" . $permissionDetails[0]['id'] . "]' id='delete[" . $permissionDetails[0]['id'] . "]' value='" . $permissionDetails[0]['id'] . "'>\r\n</p>\r\n</div></td><td>\r\n<h3>Permission Membership</h3>\r\n<div id='regbox'>\r\n<p>\r\nRemove Members:";
//.........这里部分代码省略.........
示例6: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
global $baseURL;
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
$userId = $_GET['id'];
//Check if selected user exists
if (!userIdExists($userId)) {
header("Location: " . str_replace('index.php/', '', site_url('admin_users')));
die;
}
$userdetails = fetchUserDetails(NULL, NULL, $userId);
//Fetch user details
//Forms posted
if (!empty($_POST)) {
//Delete selected account
if (!empty($_POST['delete'])) {
$deletions = $_POST['delete'];
if ($deletion_count = deleteUsers($deletions)) {
$successes[] = lang("ACCOUNT_DELETIONS_SUCCESSFUL", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
} else {
//Update display name
if ($userdetails['display_name'] != $_POST['display']) {
$displayname = trim($_POST['display']);
//Validate display name
if (displayNameExists($displayname)) {
$errors[] = lang("ACCOUNT_DISPLAYNAME_IN_USE", array($displayname));
} elseif (minMaxRange(5, 25, $displayname)) {
$errors[] = lang("ACCOUNT_DISPLAY_CHAR_LIMIT", array(5, 25));
} elseif (!ctype_alnum($displayname)) {
$errors[] = lang("ACCOUNT_DISPLAY_INVALID_CHARACTERS");
} else {
if (updateDisplayName($userId, $displayname)) {
$successes[] = lang("ACCOUNT_DISPLAYNAME_UPDATED", array($displayname));
} else {
$errors[] = lang("SQL_ERROR");
}
}
} else {
$displayname = $userdetails['display_name'];
}
//Activate account
if (isset($_POST['activate']) && $_POST['activate'] == "activate") {
if (setUserActive($userdetails['activation_token'])) {
$successes[] = lang("ACCOUNT_MANUALLY_ACTIVATED", array($displayname));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Update email
if ($userdetails['email'] != $_POST['email']) {
$email = trim($_POST["email"]);
//Validate email
if (!isValidEmail($email)) {
$errors[] = lang("ACCOUNT_INVALID_EMAIL");
} elseif (emailExists($email)) {
$errors[] = lang("ACCOUNT_EMAIL_IN_USE", array($email));
} else {
if (updateEmail($userId, $email)) {
$successes[] = lang("ACCOUNT_EMAIL_UPDATED");
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Update title
if ($userdetails['title'] != $_POST['title']) {
$title = trim($_POST['title']);
//Validate title
if (minMaxRange(1, 50, $title)) {
$errors[] = lang("ACCOUNT_TITLE_CHAR_LIMIT", array(1, 50));
} else {
if (updateTitle($userId, $title)) {
$successes[] = lang("ACCOUNT_TITLE_UPDATED", array($displayname, $title));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove permission level
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($remove, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_REMOVED", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($add, $userId)) {
//.........这里部分代码省略.........
示例7: addPermission
} else {
$action = null;
}
if (isset($_GET['value'])) {
$value = $_GET['value'];
} else {
$value = null;
}
if ($action == "create") {
$id = addPermission($value);
echo json_encode(array("id" => $id));
return;
} else {
if ($action == "remove") {
if ($role == "") {
removePermission($value);
} else {
removePermissionFromRole($role, $value);
}
echo json_encode(array("message" => "done"));
return;
} else {
if ($action == "user") {
echo json_encode(list_permissions_for_user($value));
return;
} else {
echo json_encode(list_permissions($role));
return;
}
}
}