class auth_support

internal  
 

Authentication support wrapper for Moodle's authentication functions.

Methods

static void
require_login(mixed $courseorid = null, bool $autologinguest = true, mixed $cm = null, bool $setocoinhibit = false, bool $displaymessage = true)

Ensures that the user is logged in.

static bool
is_logged_in()

Checks if the user is currently logged in.

static bool
is_guest()

Checks if the current user is a guest.

static bool
complete_user_login(stdClass $user)

Completes the user login process.

static stdClass|null
get_admin()

Retrieves the site administrator user record.

Details

at line 41
static void require_login(mixed $courseorid = null, bool $autologinguest = true, mixed $cm = null, bool $setocoinhibit = false, bool $displaymessage = true)

Ensures that the user is logged in.

Parameters

mixed $courseorid

Course object or ID to check login for

bool $autologinguest

Whether to automatically login guest users

mixed $cm

Course module object or ID

bool $setocoinhibit

Whether to inhibit the setocoin

bool $displaymessage

Whether to display a message

Return Value

void

Exceptions

moodle_exception

at line 51
static bool is_logged_in()

Checks if the user is currently logged in.

Return Value

bool

True if logged in, false otherwise

at line 61
static bool is_guest()

Checks if the current user is a guest.

Return Value

bool

True if user is a guest, false otherwise

at line 73
static bool complete_user_login(stdClass $user)

Completes the user login process.

Parameters

stdClass $user

User object to login

Return Value

bool

True on success, false otherwise

at line 83
static stdClass|null get_admin()

Retrieves the site administrator user record.

Return Value

stdClass|null

Admin user object or null if not found