本文整理汇总了PHP中AuthService::updateAutoApplyRole方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::updateAutoApplyRole方法的具体用法?PHP AuthService::updateAutoApplyRole怎么用?PHP AuthService::updateAutoApplyRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthService
的用法示例。
在下文中一共展示了AuthService::updateAutoApplyRole方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateUserObject
//.........这里部分代码省略.........
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValueWithPrefix)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValueWithPrefix, $valueFilters)) {
continue;
}
$roleToAdd = AuthService::getRole($uniqValueWithPrefix, true);
$roleToAdd->setLabel($uniqValue);
AuthService::updateRole($roleToAdd);
$userObject->addRole($roleToAdd);
$changes = true;
}
} else {
foreach ($entry[$key] as $uniqValue) {
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValue)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValue, $valueFilters)) {
continue;
}
if (!in_array($uniqValue, array_keys($userObject->getRoles())) && !empty($uniqValue)) {
$userObject->addRole(AuthService::getRole($uniqValue, true));
$changes = true;
}
}
}
break;
case "group_path":
if ($key == "memberof") {
$filter = $params["MAPPING_LOCAL_PARAM"];
if (strpos($filter, "preg:") !== false) {
$matchFilter = "/" . str_replace("preg:", "", $filter) . "/i";
} else {
if (!empty($filter)) {
$valueFilters = array_map("trim", explode(",", $filter));
}
}
foreach ($memberValues as $uniqValue => $fullDN) {
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValue)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValue, $valueFilters)) {
continue;
}
if ($userObject->personalRole->filterParameterValue("auth.ldap", "MEMBER_OF", AJXP_REPO_SCOPE_ALL, "") == $fullDN) {
//break;
}
$humanName = $uniqValue;
$branch = array();
$this->buildGroupBranch($uniqValue, $branch);
$parent = "/";
if (count($branch)) {
$parent = "/" . implode("/", array_reverse($branch));
}
if (!ConfService::getConfStorageImpl()->groupExists(rtrim(AuthService::filterBaseGroup($parent), "/") . "/" . $fullDN)) {
AuthService::createGroup($parent, $fullDN, $humanName);
}
$userObject->setGroupPath(rtrim($parent, "/") . "/" . $fullDN, true);
// Update Roles from groupPath
$b = array_reverse($branch);
$b[] = $fullDN;
for ($i = 1; $i <= count($b); $i++) {
$userObject->addRole(AuthService::getRole("AJXP_GRP_/" . implode("/", array_slice($b, 0, $i)), true));
}
$userObject->personalRole->setParameterValue("auth.ldap", "MEMBER_OF", $fullDN);
$userObject->recomputeMergedRole();
$changes = true;
}
}
break;
case "profile":
if ($userObject->getProfile() != $value) {
$changes = true;
$userObject->setProfile($value);
AuthService::updateAutoApplyRole($userObject);
}
break;
case "plugin_param":
default:
if (strpos($params["MAPPING_LOCAL_PARAM"], "/") !== false) {
list($pId, $param) = explode("/", $params["MAPPING_LOCAL_PARAM"]);
} else {
$pId = $this->getId();
$param = $params["MAPPING_LOCAL_PARAM"];
}
if ($userObject->personalRole->filterParameterValue($pId, $param, AJXP_REPO_SCOPE_ALL, "") != $value) {
$userObject->personalRole->setParameterValue($pId, $param, $value);
$userObject->recomputeMergedRole();
$changes = true;
}
break;
}
}
}
}
if ($changes) {
$userObject->save("superuser");
}
}
}
示例2: createUserObject
/**
* Instantiate a new AbstractAjxpUser
*
* @param String $userId
* @return AbstractAjxpUser
*/
public function createUserObject($userId)
{
$kvCache = ConfService::getInstance()->getKeyValueCache();
$test = $kvCache->fetch("pydio:user:" . $userId);
if ($test !== false && is_a($test, "AbstractAjxpUser")) {
if ($test->personalRole == null) {
$test->personalRole = $test->roles["AJXP_USR_/" . $userId];
}
$test->recomputeMergedRole();
return $test;
}
$userId = AuthService::filterUserSensitivity($userId);
$abstractUser = $this->instantiateAbstractUserImpl($userId);
if (!$abstractUser->storageExists()) {
AuthService::updateDefaultRights($abstractUser);
}
AuthService::updateAutoApplyRole($abstractUser);
AuthService::updateAuthProvidedData($abstractUser);
$args = array(&$abstractUser);
AJXP_Controller::applyIncludeHook("include.user.updateUserObject", $args);
$kvCache->save("pydio:user:" . $userId, $abstractUser);
return $abstractUser;
}
示例3: createUserObject
/**
* Instantiate a new AbstractAjxpUser
*
* @param String $userId
* @return AbstractAjxpUser
*/
public function createUserObject($userId)
{
$userId = AuthService::filterUserSensitivity($userId);
$abstractUser = $this->instantiateAbstractUserImpl($userId);
if (!$abstractUser->storageExists()) {
AuthService::updateDefaultRights($abstractUser);
}
AuthService::updateAutoApplyRole($abstractUser);
AuthService::updateAuthProvidedData($abstractUser);
return $abstractUser;
}
示例4: updateUserObject
//.........这里部分代码省略.........
$memberValues = array();
if ($key == "memberof") {
// get CN from value
foreach ($entry[$key] as $possibleValue) {
$hnParts = array();
$parts = explode(",", ltrim($possibleValue, '/'));
foreach ($parts as $part) {
list($att, $attVal) = explode("=", $part);
if (strtolower($att) == "cn") {
$hnParts[] = $attVal;
}
}
if (count($hnParts)) {
$memberValues[implode(",", $hnParts)] = $possibleValue;
}
}
}
switch ($params['MAPPING_LOCAL_TYPE']) {
case "role_id":
if ($key == "memberof") {
foreach ($memberValues as $uniqValue => $fullDN) {
if (!in_array($uniqValue, array_keys($userObject->getRoles()))) {
$userObject->addRole(AuthService::getRole($uniqValue, true));
$userObject->recomputeMergedRole();
$changes = true;
}
}
}
break;
case "group_path":
if ($key == "memberof") {
$filter = $params["MAPPING_LOCAL_PARAM"];
if (strpos($filter, "preg:") !== false) {
$matchFilter = "/" . str_replace("preg:", "", $filter) . "/i";
} else {
if (!empty($filter)) {
$valueFilters = array_map("trim", explode(",", $filter));
}
}
foreach ($memberValues as $uniqValue => $fullDN) {
if (isset($matchFilter) && !preg_match($matchFilter, $uniqValue)) {
continue;
}
if (isset($valueFilters) && !in_array($uniqValue, $valueFilters)) {
continue;
}
if ($userObject->personalRole->filterParameterValue("auth.ldap", "MEMBER_OF", AJXP_REPO_SCOPE_ALL, "") == $fullDN) {
//break;
}
$humanName = $uniqValue;
$branch = array();
$this->buildGroupBranch($uniqValue, $branch);
$parent = "/";
if (count($branch)) {
$parent = "/" . implode("/", array_reverse($branch));
}
AuthService::createGroup($parent, $fullDN, $humanName);
$userObject->setGroupPath(rtrim($parent, "/") . "/" . $fullDN, true);
// Update Roles from groupPath
$b = array_reverse($branch);
$b[] = $fullDN;
for ($i = 1; $i <= count($b); $i++) {
$userObject->addRole(AuthService::getRole("AJXP_GRP_/" . implode("/", array_slice($b, 0, $i)), true));
}
$userObject->personalRole->setParameterValue("auth.ldap", "MEMBER_OF", $fullDN);
$userObject->recomputeMergedRole();
$changes = true;
}
}
break;
case "profile":
if ($userObject->getProfile() != $value) {
$changes = true;
$userObject->setProfile($value);
AuthService::updateAutoApplyRole($userObject);
}
break;
case "plugin_param":
default:
if (strpos($params["MAPPING_LOCAL_PARAM"], "/") !== false) {
list($pId, $param) = explode("/", $params["MAPPING_LOCAL_PARAM"]);
} else {
$pId = $this->getId();
$param = $params["MAPPING_LOCAL_PARAM"];
}
if ($userObject->personalRole->filterParameterValue($pId, $param, AJXP_REPO_SCOPE_ALL, "") != $value) {
$userObject->personalRole->setParameterValue($pId, $param, $value);
$userObject->recomputeMergedRole();
$changes = true;
}
break;
}
}
}
}
if ($changes) {
$userObject->save("superuser");
}
}
}