本文整理匯總了PHP中AuthService::getRolesForRepository方法的典型用法代碼示例。如果您正苦於以下問題:PHP AuthService::getRolesForRepository方法的具體用法?PHP AuthService::getRolesForRepository怎麽用?PHP AuthService::getRolesForRepository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AuthService
的用法示例。
在下文中一共展示了AuthService::getRolesForRepository方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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();
//.........這裏部分代碼省略.........
示例2: 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;
}
}
//.........這裏部分代碼省略.........