本文整理汇总了PHP中AuthService::setGroupFiltering方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::setGroupFiltering方法的具体用法?PHP AuthService::setGroupFiltering怎么用?PHP AuthService::setGroupFiltering使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthService
的用法示例。
在下文中一共展示了AuthService::setGroupFiltering方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
//.........这里部分代码省略.........
if ($userObject == null || !$userObject->hasParent() || $userObject->getParent() != AuthService::getLoggedUser()->getId()) {
throw new Exception("You are not allowed to edit this user");
}
AuthService::deleteUser($userId);
echo "SUCCESS";
break;
case "user_list_authorized_users":
$defaultFormat = "html";
HTMLWriter::charsetHeader();
if (!ConfService::getAuthDriverImpl()->usersEditable()) {
break;
}
$loggedUser = AuthService::getLoggedUser();
$crtValue = $httpVars["value"];
$usersOnly = isset($httpVars["users_only"]) && $httpVars["users_only"] == "true";
$existingOnly = isset($httpVars["existing_only"]) && $httpVars["existing_only"] == "true";
if (!empty($crtValue)) {
$regexp = '^' . $crtValue;
} else {
$regexp = null;
}
$skipDisplayWithoutRegexp = ConfService::getCoreConf("USERS_LIST_REGEXP_MANDATORY", "conf");
if ($skipDisplayWithoutRegexp && $regexp == null) {
print "<ul></ul>";
break;
}
$limit = intval(ConfService::getCoreConf("USERS_LIST_COMPLETE_LIMIT", "conf"));
$searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
$baseGroup = "/";
if ($regexp == null && !$displayAll || $regexp != null && !$searchAll) {
$baseGroup = AuthService::filterBaseGroup("/");
}
AuthService::setGroupFiltering(false);
$allUsers = AuthService::listUsers($baseGroup, $regexp, 0, $limit, false);
if (!$usersOnly) {
$allGroups = array();
$roleOrGroup = ConfService::getCoreConf("GROUP_OR_ROLE", "conf");
$rolePrefix = $excludeString = $includeString = null;
if (!is_array($roleOrGroup)) {
$roleOrGroup = array("group_switch_value" => $roleOrGroup);
}
$listRoleType = false;
if (isset($roleOrGroup["PREFIX"])) {
$rolePrefix = $loggedUser->mergedRole->filterParameterValue("core.conf", "PREFIX", null, $roleOrGroup["PREFIX"]);
$excludeString = $loggedUser->mergedRole->filterParameterValue("core.conf", "EXCLUDED", null, $roleOrGroup["EXCLUDED"]);
$includeString = $loggedUser->mergedRole->filterParameterValue("core.conf", "INCLUDED", null, $roleOrGroup["INCLUDED"]);
$listUserRolesOnly = $loggedUser->mergedRole->filterParameterValue("core.conf", "LIST_ROLE_BY", null, $roleOrGroup["LIST_ROLE_BY"]);
if (is_array($listUserRolesOnly) && isset($listUserRolesOnly["group_switch_value"])) {
switch ($listUserRolesOnly["group_switch_value"]) {
case "userroles":
$listRoleType = true;
break;
case "allroles":
$listRoleType = false;
break;
default:
break;
}
}
}
switch (strtolower($roleOrGroup["group_switch_value"])) {
case 'user':
// donothing
break;
case 'group':
示例2: listRepositories
public function listRepositories()
{
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.9" attributeName="parent_label" sortType="String"/><column messageId="user_dash.9" attributeName="repo_accesses" sortType="String"/></columns>');
$repoArray = array();
$loggedUser = AuthService::getLoggedUser();
$count = 0;
$repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => $loggedUser->getId()), $count);
$searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($searchAll || $displayAll) {
$baseGroup = "/";
} else {
$baseGroup = AuthService::filterBaseGroup("/");
}
AuthService::setGroupFiltering(false);
$users = AuthService::listUsers($baseGroup);
$minisites = $this->listSharedFiles("minisites");
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
continue;
}
if (is_numeric($repoIndex)) {
$repoIndex = "" . $repoIndex;
}
$name = (isset($minisites[$repoIndex]) ? "[Minisite] " : "") . AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
$repoArray[$name] = $repoIndex;
}
// Sort the list now by name
ksort($repoArray);
foreach ($repoArray as $name => $repoIndex) {
$repoObject =& $repos[$repoIndex];
$repoAccesses = array();
foreach ($users as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
$label = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $userId);
if (empty($label)) {
$label = $userId;
}
$acl = $userObject->mergedRole->getAcl($repoObject->getId());
if (!empty($acl)) {
$repoAccesses[] = $label . " (" . $acl . ")";
}
}
$parent = $repoObject->getParentId();
$parentRepo =& $repos[$parent];
$parentLabel = $this->metaIcon("folder-open") . $parentRepo->getDisplay();
$repoPath = $repoObject->getOption("PATH");
$parentPath = $parentRepo->getOption("PATH");
$parentLabel .= " (" . str_replace($parentPath, "", $repoPath) . ")";
$metaData = array("repository_id" => $repoIndex, "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "parent_label" => $parentLabel, "repo_accesses" => count($repoAccesses) ? $this->metaIcon("share-sign") . implode(", ", $repoAccesses) : "", "ajxp_mime" => "shared_repository");
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例3: computeSharedRepositoryAccessRights
/**
* @param String $repoId
* @param $mixUsersAndGroups
* @param $currentFileUrl
* @return array
*/
public function computeSharedRepositoryAccessRights($repoId, $mixUsersAndGroups, $currentFileUrl = null)
{
$roles = AuthService::getRolesForRepository($repoId);
$sharedEntries = $sharedGroups = $sharedRoles = array();
$mess = ConfService::getMessages();
foreach ($roles as $rId) {
$role = AuthService::getRole($rId);
if ($role == null) {
continue;
}
$RIGHT = $role->getAcl($repoId);
if (empty($RIGHT)) {
continue;
}
$ID = $rId;
$WATCH = false;
if (strpos($rId, "AJXP_USR_/") === 0) {
$userId = substr($rId, strlen('AJXP_USR_/'));
$role = AuthService::getRole($rId);
$userObject = ConfService::getConfStorageImpl()->createUserObject($userId);
$LABEL = $role->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, "");
if (empty($LABEL)) {
$LABEL = $userId;
}
$TYPE = $userObject->hasParent() ? "tmp_user" : "user";
if ($this->watcher !== false && $currentFileUrl != null) {
$WATCH = $this->watcher->hasWatchOnNode(new AJXP_Node($currentFileUrl), $userId, MetaWatchRegister::$META_WATCH_USERS_NAMESPACE);
}
$ID = $userId;
} else {
if (strpos($rId, "AJXP_GRP_/") === 0) {
if (empty($loadedGroups)) {
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($displayAll) {
AuthService::setGroupFiltering(false);
}
$loadedGroups = AuthService::listChildrenGroups();
if ($displayAll) {
AuthService::setGroupFiltering(true);
} else {
$baseGroup = AuthService::filterBaseGroup("/");
foreach ($loadedGroups as $loadedG => $loadedLabel) {
unset($loadedGroups[$loadedG]);
$loadedGroups[rtrim($baseGroup, "/") . "/" . ltrim($loadedG, "/")] = $loadedLabel;
}
}
}
$groupId = substr($rId, strlen('AJXP_GRP_'));
if (isset($loadedGroups[$groupId])) {
$LABEL = $loadedGroups[$groupId];
}
if ($groupId == "/") {
$LABEL = $mess["447"];
}
if (empty($LABEL)) {
$LABEL = $groupId;
}
$TYPE = "group";
} else {
if ($rId == "ROOT_ROLE") {
$rId = "AJXP_GRP_/";
$TYPE = "group";
$LABEL = $mess["447"];
} else {
$role = AuthService::getRole($rId);
$LABEL = $role->getLabel();
$TYPE = 'group';
}
}
}
if (empty($LABEL)) {
$LABEL = $rId;
}
$entry = array("ID" => $ID, "TYPE" => $TYPE, "LABEL" => $LABEL, "RIGHT" => $RIGHT);
if ($WATCH) {
$entry["WATCH"] = $WATCH;
}
if ($TYPE == "group") {
$sharedGroups[$entry["ID"]] = $entry;
} else {
$sharedEntries[$entry["ID"]] = $entry;
}
}
if (!$mixUsersAndGroups) {
return array("USERS" => $sharedEntries, "GROUPS" => $sharedGroups);
} else {
return array_merge(array_values($sharedGroups), array_values($sharedEntries));
}
/*
$users = AuthService::getUsersForRepository($repoId);
//var_dump($roles);
$baseGroup = "/";
$groups = AuthService::listChildrenGroups($baseGroup);
$mess = ConfService::getMessages();
//.........这里部分代码省略.........
示例4: computeSharedRepositoryAccessRights
/**
* @param String $repoId
* @param bool $mixUsersAndGroups
* @param AJXP_Node|null $watcherNode
* @return array
*/
public function computeSharedRepositoryAccessRights($repoId, $mixUsersAndGroups, $watcherNode = null)
{
$roles = AuthService::getRolesForRepository($repoId);
$sharedEntries = $sharedGroups = array();
$mess = ConfService::getMessages();
foreach ($roles as $rId) {
$role = AuthService::getRole($rId);
if ($role == null) {
continue;
}
$RIGHT = $role->getAcl($repoId);
if (empty($RIGHT)) {
continue;
}
$ID = $rId;
$WATCH = false;
$HIDDEN = false;
$AVATAR = false;
if (strpos($rId, "AJXP_USR_/") === 0) {
$userId = substr($rId, strlen('AJXP_USR_/'));
$role = AuthService::getRole($rId);
$userObject = ConfService::getConfStorageImpl()->createUserObject($userId);
$LABEL = $role->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, "");
$AVATAR = $role->filterParameterValue("core.conf", "avatar", AJXP_REPO_SCOPE_ALL, "");
if (empty($LABEL)) {
$LABEL = $userId;
}
$TYPE = $userObject->hasParent() ? "tmp_user" : "user";
$HIDDEN = $userObject->isHidden();
if ($this->watcher !== false && $watcherNode != null) {
$WATCH = $this->watcher->hasWatchOnNode($watcherNode, $userId, MetaWatchRegister::$META_WATCH_USERS_NAMESPACE);
}
$ID = $userId;
} else {
if ($rId == "AJXP_GRP_" . AuthService::filterBaseGroup("/")) {
$TYPE = "group";
$LABEL = $mess["447"];
} else {
if (strpos($rId, "AJXP_GRP_/") === 0) {
if (empty($loadedGroups)) {
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($displayAll) {
AuthService::setGroupFiltering(false);
}
$loadedGroups = AuthService::listChildrenGroups();
if ($displayAll) {
AuthService::setGroupFiltering(true);
} else {
$baseGroup = AuthService::filterBaseGroup("/");
foreach ($loadedGroups as $loadedG => $loadedLabel) {
unset($loadedGroups[$loadedG]);
$loadedGroups[rtrim($baseGroup, "/") . "/" . ltrim($loadedG, "/")] = $loadedLabel;
}
}
}
$groupId = substr($rId, strlen('AJXP_GRP_'));
if (isset($loadedGroups[$groupId])) {
$LABEL = $loadedGroups[$groupId];
}
/*
if($groupId == AuthService::filterBaseGroup("/")){
$LABEL = $mess["447"];
}
*/
if (empty($LABEL)) {
$LABEL = $groupId;
}
$TYPE = "group";
} else {
$role = AuthService::getRole($rId);
$LABEL = $role->getLabel();
$TYPE = 'group';
}
}
}
if (empty($LABEL)) {
$LABEL = $rId;
}
$entry = array("ID" => $ID, "TYPE" => $TYPE, "LABEL" => $LABEL, "RIGHT" => $RIGHT);
if ($WATCH) {
$entry["WATCH"] = $WATCH;
}
if ($HIDDEN) {
$entry["HIDDEN"] = true;
}
if ($AVATAR !== false) {
$entry["AVATAR"] = $AVATAR;
}
if ($TYPE == "group") {
$sharedGroups[$entry["ID"]] = $entry;
} else {
$sharedEntries[$entry["ID"]] = $entry;
}
}
//.........这里部分代码省略.........