MCPcopy Create free account
hub / github.com/error311/FileRise / getUserRole

Method getUserRole

src/FileRise/Domain/UserModel.php:976–990  ·  view source on GitHub ↗

* Get role ('1' admin, '0' user) or null. */

($username)

Source from the content-addressed store, hash-verified

974 * Get role ('1' admin, '0' user) or null.
975 */
976 public static function getUserRole($username)
977 {
978 self::ensureUserCaseMigration();
979 $usersFile = USERS_DIR . USERS_FILE;
980 if (!file_exists($usersFile)) {
981 return null;
982 }
983 foreach (file($usersFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
984 $parts = explode(':', trim($line));
985 if (count($parts) >= 3 && strcasecmp($parts[0], $username) === 0) {
986 return trim($parts[2]);
987 }
988 }
989 return null;
990 }
991
992 /**
993 * Get a single user’s info (admin flag, TOTP status, profile picture).

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected