Adapt UserSession

- Move from App methods to UserSession methods
- Deprecate corresponding App methods
This commit is contained in:
Philipp 2022-12-26 13:08:41 +01:00
parent c376605dd2
commit bfc1c157f1
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
6 changed files with 62 additions and 46 deletions

View file

@ -830,6 +830,22 @@ class User
return DBA::update('user', $fields, ['uid' => $uid]);
}
/**
* Returns if the given uid is valid and in the admin list
*
* @param int $uid
*
* @return bool
* @throws Exception
*/
public static function isSiteAdmin(int $uid): bool
{
return DBA::exists('user', [
'uid' => $uid,
'email' => self::getAdminEmailList()
]);
}
/**
* Checks if a nickname is in the list of the forbidden nicknames
*