diff --git a/src/Linna/Authorization/PermissionTrait.php b/src/Linna/Authorization/PermissionTrait.php index 954d532..39d608a 100644 --- a/src/Linna/Authorization/PermissionTrait.php +++ b/src/Linna/Authorization/PermissionTrait.php @@ -45,9 +45,9 @@ public function can(Permission $permission): bool */ public function canById(null|int|string $permissionId): bool { - if (isset($this->permission[$permissionId])) { - return true; - } + //if (isset($this->permission[$permissionId])) { + // return true; + //} if (\in_array($permissionId, \array_column($this->permission, 'id'), true)) { return true; @@ -66,9 +66,9 @@ public function canById(null|int|string $permissionId): bool */ public function canByName(string $permissionName): bool { - if (isset($this->permission[$permissionName])) { - return true; - } + //if (isset($this->permission[$permissionName])) { + // return true; + //} if (\in_array($permissionName, \array_column($this->permission, 'name'), true)) { return true; diff --git a/src/Linna/Authorization/RoleTrait.php b/src/Linna/Authorization/RoleTrait.php index 072fb01..6ac27c3 100644 --- a/src/Linna/Authorization/RoleTrait.php +++ b/src/Linna/Authorization/RoleTrait.php @@ -43,9 +43,9 @@ public function hasRole(Role $role): bool */ public function hasRoleById(null|int|string $roleId): bool { - if (isset($this->role[$roleId])) { - return true; - } + //if (isset($this->role[$roleId])) { + // return true; + //} if (\in_array($roleId, \array_column($this->role, 'id'), true)) { return true; @@ -63,9 +63,9 @@ public function hasRoleById(null|int|string $roleId): bool */ public function hasRoleByName(string $roleName): bool { - if (isset($this->role[$roleName])) { - return true; - } + //if (isset($this->role[$roleName])) { + // return true; + //} if (\in_array($roleName, \array_column($this->role, 'name'), true)) { return true; diff --git a/src/Linna/Authorization/UserTrait.php b/src/Linna/Authorization/UserTrait.php index e60c2fe..ea7c5b9 100644 --- a/src/Linna/Authorization/UserTrait.php +++ b/src/Linna/Authorization/UserTrait.php @@ -43,9 +43,9 @@ public function hasUser(User $user): bool */ public function hasUserById(null|int|string $userId): bool { - if (isset($this->user[$userId])) { - return true; - } + //if (isset($this->user[$userId])) { + // return true; + //} if (\in_array($userId, \array_column($this->user, 'id'), true)) { return true; @@ -63,9 +63,9 @@ public function hasUserById(null|int|string $userId): bool */ public function hasUserByName(string $userName): bool { - if (isset($this->user[$userName])) { - return true; - } + //if (isset($this->user[$userName])) { + // return true; + //} if (\in_array($userName, \array_column($this->user, 'name'), true)) { return true;