Stud.IP  5.4
UserPermissions Class Reference

Public Member Functions

 set ($user_id, $granted=true)
 
 check ($consumer_id)
 
 store ()
 
 getConsumers ()
 

Static Public Member Functions

static get ($user_id=null)
 

Protected Member Functions

 loadPermissions ()
 

Detailed Description

REST API routing permissions

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL 2 or later
Since
Stud.IP 2.6

Member Function Documentation

◆ check()

check (   $consumer_id)

Checks if access to consumer is allowed for the current user.

Parameters
String$consumer_idId of the consumer
Returns
bool Indicates whether access is allowed

◆ get()

static get (   $user_id = null)
static

Create a permission object (for a certain user). Permissions object will be cached for each user.

Parameters
mixed$user_idId of user (optional, defaults to global)
Returns
UserPermissions Returns permissions object

◆ getConsumers()

getConsumers ( )

Get a list of all consumer the user has granted acces to.

Returns
array List of consumer objects

◆ loadPermissions()

loadPermissions ( )
protected

Loads permissions for passed user.

Returns
UserPermissions Returns instance of self to allow chaining

◆ set()

set (   $user_id,
  $granted = true 
)

Defines whether access is allowed for the current user to the passed route via the passed method.

Parameters
String$user_idId of the user
mixed$grantedGranted state (PHP'ish boolean)
Returns
UserPermissions Returns instance of self to allow chaining

◆ store()

store ( )

Stores the set permissions.

Returns
bool Returns true if permissions were stored successfully

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