add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
+18 -3
View File
@@ -328,13 +328,28 @@ class ScoreCommentService
private function isReviewer(): bool
{
$currentUserRole = session()->get('role');
$user = auth()->user();
if (!$user) {
return false;
}
$currentUserRoles = $user->roles()
->pluck('roles.name')
->map(fn ($name) => strtolower((string) $name))
->unique()
->values()
->toArray();
$reviewerRoles = (string) (Configuration::getConfig('comment_reviewer') ?? '');
if ($reviewerRoles === '') {
return false;
}
$allowedRoles = array_map('trim', explode(',', $reviewerRoles));
return in_array($currentUserRole, $allowedRoles, true);
$allowedRoles = array_map(
static fn ($role) => strtolower(trim((string) $role)),
explode(',', $reviewerRoles)
);
return !empty(array_intersect($currentUserRoles, $allowedRoles));
}
}