$_SESSION['username'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => 'CAS: username does not match CAS user'], 'authlog'); } else { dbInsert(['user' => $_SESSION['username'], 'address' => $_SERVER["REMOTE_ADDR"], 'result' => 'CAS: NOT found in DB'], 'authlog'); } //session_logout(); return 0; } /** * Check if the backend allows users to log out. * As the login is done outside our system, we don't allow users to log out. * * @return bool TRUE if logout is possible, FALSE if it is not */ function cas_auth_can_logout() { return FALSE; } /** * Check if the backend allows a specific user to change their password. * This is not currently possible using the CAS backend. * * @param string $username Username to check * * @return bool TRUE if password change is possible, FALSE if it is not */ function cas_auth_can_change_password($username = "") { return FALSE; } /** * Check if the backend allows user management at all (create/delete/modify users). * The CAS module requires users to exist in MySQL first, so we allow MySQL user management. * * @return bool TRUE if user management is possible, FALSE if it is not */ function cas_auth_usermanagement() { return 1; } /** * Adds a new user to the user backend. * * @param string $username User's username * @param string $password User's password (plain text) * @param int $level User's auth level * @param string $email User's e-mail address * @param string $realname User's real name * @param bool $can_modify_passwd TRUE if user can modify their own password, FALSE if not * @param string $description User's description * * @return bool TRUE if user addition is successful, FALSE if it is not */ function cas_adduser($username, $password, $level, $email = "", $realname = "", $can_modify_passwd = '1', $description = "") { if (!cas_auth_user_exists($username)) { $hash = password_hash($password, PASSWORD_DEFAULT); return dbInsert(['username' => $username, 'password' => $hash, 'level' => $level, 'email' => $email, 'realname' => $realname, 'can_modify_passwd' => $can_modify_passwd, 'descr' => $description], 'users'); } else { return FALSE; } } // EOF