support des roles dans CAS
This commit is contained in:
parent
5991fb4c2e
commit
2a26b7db8d
|
@ -28,21 +28,20 @@ class CasUserManager extends SimpleUserManager {
|
||||||
$authzs = explode(",", $authzs);
|
$authzs = explode(",", $authzs);
|
||||||
$appcode = $this->appcode;
|
$appcode = $this->appcode;
|
||||||
$groups = [];
|
$groups = [];
|
||||||
|
$role = null;
|
||||||
$perms = [];
|
$perms = [];
|
||||||
foreach ($authzs as $authz) {
|
foreach ($authzs as $authz) {
|
||||||
if ($authz == "*:*") {
|
if ($authz == "*:*") {
|
||||||
$perms[] = "*";
|
$perms[] = "*";
|
||||||
} elseif ($authz == "$appcode:*") {
|
|
||||||
$perms[] = "*";
|
|
||||||
} elseif (str::del_prefix($authz, "$appcode:")) {
|
} elseif (str::del_prefix($authz, "$appcode:")) {
|
||||||
if (str::del_prefix($authz, "@")) {
|
if ($authz == "*") $perms[] = "*";
|
||||||
$groups[] = $authz;
|
elseif (str::del_prefix($authz, "@")) $groups[] = $authz;
|
||||||
} else {
|
elseif (str::del_prefix($authz, "*")) $role = $authz;
|
||||||
$perms[] = $authz;
|
else $perms[] = $authz;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
A::merge($user["groups"], $groups);
|
A::merge($user["groups"], $groups);
|
||||||
|
if ($role !== null) $user["role"] = $role;
|
||||||
A::merge($user["perms"], $perms);
|
A::merge($user["perms"], $perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue