Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
ConsumerPermissions Class Reference

Public Member Functions

 set ($route_id, $method, $granted, $overwrite=false)
 
 activateRouteMap (RouteMap $routemap)
 
 remove ($route_id, $method)
 
 deactivateRouteMap (RouteMap $routemap)
 
 check ($route, $method)
 
 store ()
 

Static Public Member Functions

static get ($consumer_id=null)
 

Protected Member Functions

 loadPermissions ($consumer_id, $overwrite=false)
 

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 3.0

Member Function Documentation

activateRouteMap ( RouteMap  $routemap)

Convenience method for activating all routes in a route map.

Parameters
\RESTAPI\RouteMap$routemapRouteMap to activate
check (   $route,
  $method 
)

Checks if access to passed route via passed method is allowed for the current consumer.

Parameters
String$routeRoute template
String$methodHTTP method
Returns
bool Indicates whether access is allowed
deactivateRouteMap ( RouteMap  $routemap)

Convenience method for deactivating all routes in a route map.

Parameters
\RESTAPI\RouteMap$routemapRouteMap to activate
static get (   $consumer_id = null)
static

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

Parameters
mixed$consumer_idId of consumer (optional, defaults to global)
Returns
ConsumerPermissions Returns permissions object
loadPermissions (   $consumer_id,
  $overwrite = false 
)
protected

Loads permissions for passed consumer.

Parameters
String$consumer_idId of the consumer in question
bool$overwriteMay values be overwritten
Returns
ConsumerPermissions Returns instance of self to allow chaining
remove (   $route_id,
  $method 
)

Removes stored permissions for a given route and method.

Parameters
String$route_idRoute template
String$methodHTTP method
Returns
bool
set (   $route_id,
  $method,
  $granted,
  $overwrite = false 
)

Defines whether access if allowed for the current consumer to the passed route via the passed method.

Parameters
String$route_idRoute template (hash)
String$methodHTTP method
mixed$grantedGranted state (PHP'ish boolean)
bool$overwriteMay values be overwritten
Returns
bool Indicates if value could be changed.
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: