Skip to content

Commit

Permalink
Add type declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Jul 31, 2024
1 parent fbc66a0 commit f95afbc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions web/mrbs_auth.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ declare(strict_types=1);
namespace MRBS;

use MRBS\Auth\AuthFactory;
use MRBS\Session\Session;
use MRBS\Session\SessionFactory;


Expand All @@ -23,7 +24,7 @@ function auth()


// Convenience wrapper function to provide access to a Session object
function session()
function session() : Session
{
global $auth;

Expand Down Expand Up @@ -173,7 +174,7 @@ function get_page_level($page)
* false - The user does not have the required access
* true - The user has the required access
*/
function getAuthorised($level, $returl)
function getAuthorised($level, $returl) : bool
{
// If the minimum level is zero (or not set) then they are
// authorised, whoever they are
Expand Down Expand Up @@ -366,7 +367,7 @@ function showAccessDenied($view=null, $view_all=null, $year=null, $month=null, $


// Checks whether the current user has admin rights
function is_admin()
function is_admin() : bool
{
global $max_level;

Expand All @@ -390,7 +391,7 @@ function is_admin()
//
// Returns: TRUE if the user is allowed has booking admin rights for
// the room(s); otherwise FALSE
function is_book_admin($rooms=null, $all=true)
function is_book_admin($rooms=null, $all=true) : bool
{
global $min_booking_admin_level;

Expand Down Expand Up @@ -438,7 +439,7 @@ function is_book_admin($rooms=null, $all=true)


// Checks whether the current user has user editing rights
function is_user_admin()
function is_user_admin() : bool
{
global $min_user_editing_level;

Expand All @@ -450,7 +451,7 @@ function is_user_admin()

// Checks whether a room is visible to the current user
// Doesn't do anything at the moment, but allows for customisation or future development
function is_visible($room)
function is_visible($room) : bool
{
return true;
}
Expand Down

0 comments on commit f95afbc

Please sign in to comment.