diff --git a/public-legacy/manage/users/user.php b/public-legacy/manage/users/user.php index 770570d..0b8b912 100644 --- a/public-legacy/manage/users/user.php +++ b/public-legacy/manage/users/user.php @@ -39,7 +39,7 @@ try { return; } -$canEdit = $canManageUsers && $currentUser->hasAuthorityOver($userInfo); +$canEdit = $canManageUsers && ($currentUser->isSuper() || $currentUser->getId() === $userInfo->getId() || $currentUser->getRank() > $userInfo->getRank()); $canEditPerms = $canEdit && $canManagePerms; $permissions = $canEditPerms ? manage_perms_list(perms_get_user_raw($userId)) : []; diff --git a/public-legacy/profile.php b/public-legacy/profile.php index 92ea2e9..cd1776c 100644 --- a/public-legacy/profile.php +++ b/public-legacy/profile.php @@ -47,7 +47,7 @@ $userPerms = perms_get_user($currentUserId)[MSZ_PERMS_USER]; $canManageWarnings = perms_check($userPerms, MSZ_PERM_USER_MANAGE_WARNINGS); $canEdit = !$viewingAsGuest && ((!$isBanned && $viewingOwnProfile) || $currentUser->isSuper() || ( perms_check($userPerms, MSZ_PERM_USER_MANAGE_USERS) - && $currentUser->hasAuthorityOver($profileUser) + && ($currentUser->getId() === $profileUser->getId() || $currentUser->getRank() > $profileUser->getRank()) )); if($isEditing) { diff --git a/src/HasRankInterface.php b/src/HasRankInterface.php deleted file mode 100644 index e7798f7..0000000 --- a/src/HasRankInterface.php +++ /dev/null @@ -1,7 +0,0 @@ -bind('user', $this->getId())->fetchColumn(); return $this->userRank; } - public function hasAuthorityOver(HasRankInterface $other): bool { - return $this->isSuper() - || $other instanceof self && $other->getId() === $this->getId() - || $this->getRank() > $other->getRank(); - } public function getDisplayRoleId(): int { return $this->display_role < 1 ? -1 : $this->display_role;