cfmgrv4 init...2

This commit is contained in:
최준흠 2024-10-14 13:57:09 +09:00
parent 7fd4651f94
commit 99472a585d
2 changed files with 6 additions and 5 deletions

View File

@ -33,8 +33,8 @@ class AuthFilter implements FilterInterface
$auth->pushCurrentUrl($request->getUri()->getPath());
return redirect()->to(URLS['LOGIN'])->with('error', '로그인을하셔야합니다.');
}
//User Role 비교 // 회원 ROLES이 필요ROLE($arguments[0]) 목록에 존재하지 않으면(ACL)
if (!$auth->isAccessRole($arguments[0])) {
//User Role 비교 // 회원 ROLES이 필요ROLE($arguments) 목록에 존재하지 않으면(ACL)
if (!$auth->isAccessRole($arguments)) {
// dd($auth->popPreviousUrl());
return redirect()->back()->with(
'error',

View File

@ -30,13 +30,14 @@ class MyAuth extends CommonLibrary
{
return $this->getSession()->has(SESSION_NAMES['ISLOGIN']);
}
final public function isAccessRole(string $role): bool
final public function isAccessRole(array $roles): bool
{
if ($this->getAuthInfo('role') === "") {
return false;
}
$roles = explode(DEFAULTS['DELIMITER_ROLE'], $this->getAuthInfo('role'));
if (!in_array($role, $roles)) {
$myRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->getAuthInfo('role'));
// 교집합이 없으면 false
if (empty(array_intersect($myRoles, $roles))) {
return false;
}
return true;