From 2a26b7db8ddd6cd9ae768fdfca2564b15610b23b Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 29 Apr 2024 11:02:44 +0400 Subject: [PATCH] support des roles dans CAS --- nur_src/b/authnz/CasUserManager.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nur_src/b/authnz/CasUserManager.php b/nur_src/b/authnz/CasUserManager.php index db2211d..1139ae7 100644 --- a/nur_src/b/authnz/CasUserManager.php +++ b/nur_src/b/authnz/CasUserManager.php @@ -28,21 +28,20 @@ class CasUserManager extends SimpleUserManager { $authzs = explode(",", $authzs); $appcode = $this->appcode; $groups = []; + $role = null; $perms = []; foreach ($authzs as $authz) { if ($authz == "*:*") { $perms[] = "*"; - } elseif ($authz == "$appcode:*") { - $perms[] = "*"; } elseif (str::del_prefix($authz, "$appcode:")) { - if (str::del_prefix($authz, "@")) { - $groups[] = $authz; - } else { - $perms[] = $authz; - } + if ($authz == "*") $perms[] = "*"; + elseif (str::del_prefix($authz, "@")) $groups[] = $authz; + elseif (str::del_prefix($authz, "*")) $role = $authz; + else $perms[] = $authz; } } A::merge($user["groups"], $groups); + if ($role !== null) $user["role"] = $role; A::merge($user["perms"], $perms); } }