本文整理汇总了PHP中AuthService::listChildrenGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::listChildrenGroups方法的具体用法?PHP AuthService::listChildrenGroups怎么用?PHP AuthService::listChildrenGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthService
的用法示例。
在下文中一共展示了AuthService::listChildrenGroups方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
//.........这里部分代码省略.........
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':
$authGroups = AuthService::listChildrenGroups($baseGroup);
foreach ($authGroups as $gId => $gName) {
$allGroups["AJXP_GRP_" . rtrim($baseGroup, "/") . "/" . ltrim($gId, "/")] = $gName;
}
break;
case 'role':
$allGroups = $this->getUserRoleList($loggedUser, $rolePrefix, $includeString, $excludeString, $listRoleType);
break;
case 'rolegroup':
$groups = array();
$authGroups = AuthService::listChildrenGroups($baseGroup);
foreach ($authGroups as $gId => $gName) {
$groups["AJXP_GRP_" . rtrim($baseGroup, "/") . "/" . ltrim($gId, "/")] = $gName;
}
$roles = $this->getUserRoleList($loggedUser, $rolePrefix, $includeString, $excludeString, $listRoleType);
empty($groups) ? $allGroups = $roles : (empty($roles) ? $allGroups = $groups : ($allGroups = array_merge($groups, $roles)));
//$allGroups = array_merge($groups, $roles);
break;
default:
break;
}
}
$users = "";
$index = 0;
if ($regexp != null && (!count($allUsers) || !empty($crtValue) && !array_key_exists(strtolower($crtValue), $allUsers)) && ConfService::getCoreConf("USER_CREATE_USERS", "conf") && !$existingOnly) {
$users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label='{$crtValue}'><span class='user_entry_label'>{$crtValue} (" . $mess["448"] . ")</span></li>";
} else {
if ($existingOnly && !empty($crtValue)) {
$users .= "<li class='complete_user_entry_temp' data-temporary='true' data-label='{$crtValue}' data-entry_id='{$crtValue}'><span class='user_entry_label'>{$crtValue}</span></li>";
}
}
$mess = ConfService::getMessages();
if ($regexp == null && !$usersOnly) {
示例2: deleteGroup
public function deleteGroup($groupPath)
{
$gUsers = AuthService::listUsers($groupPath);
$gGroups = AuthService::listChildrenGroups($groupPath);
if (count($gUsers) || count($gGroups)) {
throw new Exception("Group is not empty, please do something with its content before trying to delete it!");
}
$groups = AJXP_Utils::loadSerialFile(AJXP_VarsFilter::filter($this->getOption("USERS_DIRPATH")) . "/groups.ser");
foreach ($groups as $key => $value) {
if ($value == $groupPath) {
unset($groups[$key]);
}
}
AJXP_Utils::saveSerialFile(AJXP_VarsFilter::filter($this->getOption("USERS_DIRPATH")) . "/groups.ser", $groups);
}
示例3: gatherUsers
protected function gatherUsers(&$users, $startGroup = "/")
{
$u = $this->listUsersIds($startGroup);
$users = array_merge($users, $u);
$g = AuthService::listChildrenGroups($startGroup);
if (count($g)) {
foreach ($g as $gName => $gLabel) {
$this->gatherUsers($users, $startGroup . $gName);
}
}
}
示例4: listUsers
public function listUsers($root, $child, $hashValue = null, $returnNodes = false, $findNodePosition = null)
{
$USER_PER_PAGE = 50;
if ($root == "users") {
$baseGroup = "/";
} else {
$baseGroup = substr($root, strlen("users"));
}
if ($findNodePosition != null && $hashValue == null) {
// Add groups offset
$groups = AuthService::listChildrenGroups($baseGroup);
$offset = 0;
if (count($groups)) {
$offset = count($groups);
}
$position = AuthService::findUserPage($baseGroup, $findNodePosition, $USER_PER_PAGE);
if ($position != -1) {
$key = "/data/" . $root . "/" . $findNodePosition;
$data = array($key => AJXP_XMLWriter::renderNode($key, $findNodePosition, true, array("page_position" => $position), true, false));
return $data;
} else {
// Loop on each page to find the correct page.
$count = AuthService::authCountUsers($baseGroup);
$pages = ceil($count / $USER_PER_PAGE);
for ($i = 0; $i < $pages; $i++) {
$tests = $this->listUsers($root, $child, $i + 1, true, $findNodePosition);
if (is_array($tests) && isset($tests["/data/" . $root . "/" . $findNodePosition])) {
return array("/data/" . $root . "/" . $findNodePosition => str_replace("ajxp_mime", "page_position='" . ($i + 1) . "' ajxp_mime", $tests["/data/" . $root . "/" . $findNodePosition]));
}
}
}
return array();
}
$allNodes = array();
$columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users">
<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
<column messageId="ajxp_conf.102" attributeName="object_id" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
</columns>';
if (AuthService::driverSupportsAuthSchemes()) {
$columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users_authscheme">
<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
<column messageId="ajxp_conf.102" attributeName="object_id" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_conf.115" attributeName="auth_scheme" sortType="String" defaultWidth="5%"/>
<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="5%"/>
<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
</columns>';
}
if (!$returnNodes) {
AJXP_XMLWriter::sendFilesListComponentConfig($columns);
}
if (!AuthService::usersEnabled()) {
return array();
}
if (empty($hashValue)) {
$hashValue = 1;
}
$count = AuthService::authCountUsers($baseGroup, "", null, null, false);
if (AuthService::authSupportsPagination() && $count >= $USER_PER_PAGE) {
$offset = ($hashValue - 1) * $USER_PER_PAGE;
if (!$returnNodes) {
AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $USER_PER_PAGE));
}
$users = AuthService::listUsers($baseGroup, "", $offset, $USER_PER_PAGE, true, false);
if ($hashValue == 1) {
$groups = AuthService::listChildrenGroups($baseGroup);
} else {
$groups = array();
}
} else {
$users = AuthService::listUsers($baseGroup, "", -1, -1, true, false);
$groups = AuthService::listChildrenGroups($baseGroup);
}
foreach ($groups as $groupId => $groupLabel) {
$nodeKey = "/data/" . $root . "/" . ltrim($groupId, "/");
$meta = array("icon" => "users-folder.png", "ajxp_mime" => "group", "object_id" => $groupId);
if (in_array($nodeKey, $this->currentBookmarks)) {
$meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
}
$xml = AJXP_XMLWriter::renderNode($nodeKey, $groupLabel, false, $meta, true, false);
if (!$returnNodes) {
print $xml;
} else {
$allNodes[$nodeKey] = $xml;
}
}
$mess = ConfService::getMessages();
$loggedUser = AuthService::getLoggedUser();
$userArray = array();
foreach ($users as $userObject) {
$label = $userObject->getId();
if ($userObject->hasParent()) {
$label = $userObject->getParent() . "000" . $label;
} else {
$children = ConfService::getConfStorageImpl()->getUserChildren($label);
foreach ($children as $addChild) {
$userArray[$label . "000" . $addChild->getId()] = $addChild;
//.........这里部分代码省略.........
示例5: computeSharedRepositoryAccessRights
/**
* @param String $repoId
* @param $mixUsersAndGroups
* @param $currentFileUrl
* @return array
*/
public function computeSharedRepositoryAccessRights($repoId, $mixUsersAndGroups, $currentFileUrl)
{
$loggedUser = AuthService::getLoggedUser();
$users = AuthService::getUsersForRepository($repoId);
$baseGroup = "/";
$groups = AuthService::listChildrenGroups($baseGroup);
$mess = ConfService::getMessages();
$groups[$baseGroup] = $mess["447"];
$sharedEntries = array();
if (!$mixUsersAndGroups) {
$sharedGroups = array();
}
foreach ($groups as $gId => $gLabel) {
$r = AuthService::getRole("AJXP_GRP_" . AuthService::filterBaseGroup($gId));
if ($r != null) {
$right = $r->getAcl($repoId);
if (!empty($right)) {
$entry = array("ID" => $gId, "TYPE" => "group", "LABEL" => $gLabel, "RIGHT" => $right);
if (!$mixUsersAndGroups) {
$sharedGroups[$gId] = $entry;
} else {
$sharedEntries[] = $entry;
}
}
}
}
foreach ($users as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
$ri = $userObject->personalRole->getAcl($repoId);
$uLabel = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, "");
if (empty($uLabel)) {
$uLabel = $userId;
}
if (!empty($ri)) {
$entry = array("ID" => $userId, "TYPE" => $userObject->hasParent() ? "tmp_user" : "user", "LABEL" => $uLabel, "RIGHT" => $userObject->personalRole->getAcl($repoId));
if ($this->watcher !== false) {
$entry["WATCH"] = $this->watcher->hasWatchOnNode(new AJXP_Node($currentFileUrl), $userId, MetaWatchRegister::$META_WATCH_USERS_NAMESPACE);
}
if (!$mixUsersAndGroups) {
$sharedEntries[$userId] = $entry;
} else {
$sharedEntries[] = $entry;
}
}
}
if (!$mixUsersAndGroups) {
return array("USERS" => $sharedEntries, "GROUPS" => $sharedGroups);
}
return $sharedEntries;
}
示例6: 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();
//.........这里部分代码省略.........
示例7: 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;
}
}
//.........这里部分代码省略.........