summaryrefslogtreecommitdiffstats
path: root/inc/user.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/user.inc.php')
-rw-r--r--inc/user.inc.php26
1 files changed, 13 insertions, 13 deletions
diff --git a/inc/user.inc.php b/inc/user.inc.php
index bc07f5d..9520640 100644
--- a/inc/user.inc.php
+++ b/inc/user.inc.php
@@ -14,27 +14,27 @@ class User
return self::$user !== null;
}
- public static function isShibbolethAuth()
+ public static function isShibbolethAuth(): bool
{
return self::$isShib;
}
- public static function isInDatabase()
+ public static function isInDatabase(): bool
{
return self::$isInDb;
}
- public static function isLocalOnly()
+ public static function isLocalOnly(): bool
{
return self::$user !== null && self::$isShib === false;
}
- public static function isAnonymous()
+ public static function isAnonymous(): bool
{
return self::$isAnonymous;
}
- public static function getData()
+ public static function getData(): ?array
{
return self::$user;
}
@@ -79,7 +79,7 @@ class User
return self::$user !== null && !empty(self::$user['firstname']) && !empty(self::$user['lastname']);
}
- public static function isTutor()
+ public static function isTutor(): bool
{
return isset(self::$user['role']) && self::$user['role'] === 'TUTOR';
}
@@ -147,7 +147,7 @@ class User
return self::$user['shibid'];
}
- public static function load()
+ public static function load(): bool
{
//file_put_contents('/tmp/test-' . time(), print_r($_SERVER, true));
if (self::isLoggedIn())
@@ -246,7 +246,7 @@ class User
return true;
}
- public static function deploy(bool $anonymous, $existingLogin = false): bool
+ public static function deploy(bool $anonymous, ?string $existingLogin = null): bool
{
if (empty(self::$user['shibid']))
Util::traceError('NO SHIBID');
@@ -299,7 +299,7 @@ class User
return true;
}
- public static function updatePassword($pass)
+ public static function updatePassword(string $pass): bool
{
if (!self::isLoggedIn() || self::$isShib || !self::$isInDb)
return false;
@@ -311,7 +311,7 @@ class User
return $ret == 1;
}
- public static function updateMail($mail)
+ public static function updateMail(string $mail): bool
{
if (!self::isLoggedIn() || self::$isShib || !self::$isInDb)
return false;
@@ -322,7 +322,7 @@ class User
return $ret == 1 || $mail === self::$user['email'];
}
- public static function login($user, $pass)
+ public static function login(string $user, string $pass): bool
{
$ret = Database::queryFirst('SELECT userid, password FROM user WHERE userid = :user LIMIT 1', array(':user' => $user));
if ($ret === false)
@@ -336,7 +336,7 @@ class User
return true;
}
- public static function logout()
+ public static function logout(): never
{
foreach ($_COOKIE as $name => $value) {
if (substr($name, 0, 5) !== '_shib')
@@ -352,7 +352,7 @@ class User
exit(0);
}
- public static function delete()
+ public static function delete(): bool
{
if (!User::isLoggedIn() || !User::isInDatabase())
return true;