ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SimpleSAML\Utils\Auth Class Reference
+ Inheritance diagram for SimpleSAML\Utils\Auth:
+ Collaboration diagram for SimpleSAML\Utils\Auth:

Static Public Member Functions

static getAdminLoginURL ($returnTo=null)
 Retrieve a admin login URL. More...
 
static isAdmin ()
 Check whether the current user is admin. More...
 
static requireAdmin ()
 Require admin access to the current page. More...
 

Detailed Description

Definition at line 11 of file Auth.php.

Member Function Documentation

◆ getAdminLoginURL()

static SimpleSAML\Utils\Auth::getAdminLoginURL (   $returnTo = null)
static

Retrieve a admin login URL.

Parameters
string | NULL$returnToThe URL the user should arrive on after admin authentication. Defaults to null.
Returns
string A URL which can be used for admin authentication.
Exceptions

Definition at line 22 of file Auth.php.

References $returnTo, array, and SimpleSAML\Module\getModuleURL().

Referenced by SimpleSAML_Utilities\getAdminLoginURL().

23  {
24  if (!(is_string($returnTo) || is_null($returnTo))) {
25  throw new \InvalidArgumentException('Invalid input parameters.');
26  }
27 
28  if ($returnTo === null) {
29  $returnTo = HTTP::getSelfURL();
30  }
31 
32  return Module::getModuleURL('core/login-admin.php', array('ReturnTo' => $returnTo));
33  }
if(!isset($_REQUEST['ReturnTo'])) $returnTo
Definition: authpage.php:16
static getModuleURL($resource, array $parameters=array())
Get absolute URL to a specified module resource.
Definition: Module.php:303
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAdmin()

static SimpleSAML\Utils\Auth::isAdmin ( )
static

Check whether the current user is admin.

Returns
boolean True if the current user is an admin user, false otherwise.
Author
Olav Morken, UNINETT AS olav..nosp@m.mork.nosp@m.en@un.nosp@m.inet.nosp@m.t.no

Definition at line 42 of file Auth.php.

References $session, and SimpleSAML_Session\getSessionFromRequest().

Referenced by SimpleSAML_Utilities\isAdmin().

43  {
45  return $session->isValid('admin') || $session->isValid('login-admin');
46  }
$session
static getSessionFromRequest()
Retrieves the current session.
Definition: Session.php:243
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ requireAdmin()

static SimpleSAML\Utils\Auth::requireAdmin ( )
static

Require admin access to the current page.

This is a helper function for limiting a page to those with administrative access. It will redirect the user to a login page if the current user doesn't have admin access.

Returns
void This function will only return if the user is admin.
Exceptions

Definition at line 60 of file Auth.php.

References $as, and SimpleSAML_Auth_Source\getById().

Referenced by sspmod_statistics_AccessCheck\checkAccess(), and SimpleSAML_Utilities\requireAdmin().

61  {
62  if (self::isAdmin()) {
63  return;
64  }
65 
66  // not authenticated as admin user, start authentication
67  if (\SimpleSAML_Auth_Source::getById('admin') !== null) {
68  $as = new \SimpleSAML\Auth\Simple('admin');
69  $as->login();
70  } else {
71  throw new \SimpleSAML_Error_Exception(
72  'Cannot find "admin" auth source, and admin privileges are required.'
73  );
74  }
75  }
$as
static getById($authId, $type=null)
Retrieve authentication source.
Definition: Source.php:324
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: