nyroFwk  0.2
Public Member Functions | Protected Member Functions | Protected Attributes
security_abstract Class Reference
Inheritance diagram for security_abstract:
object security_default security_public

Public Member Functions

 isLogged ()
 
 login ($prm=null, $page=null)
 
 logout ($prm=null)
 
 addRole ($role)
 
 hasRole ($role=null)
 
 delRole ($role=null)
 
 check (array $url=null, $redirect=true)
 
 getLoginForm (array $prm=array())
 
 protect ($page=null)
 
 getPage ($type='login', $uri=false)
 
 getAttr ($name)
 
 setAttr ($name, $value)
 
 getCfg ()
 

Protected Member Functions

 afterInit ()
 
 hook ($name)
 
 isContained (array $url, array $checks)
 
 beforeInit ()
 

Protected Attributes

 $cfg
 

Detailed Description

Security class to check user rights

Definition at line 10 of file security/abstract.class.php.

Member Function Documentation

◆ addRole()

addRole (   $role)
abstract

Add a role to the current user

Parameters
mixed$role
Returns
bool True if successful

◆ afterInit()

afterInit ( )
protected

Definition at line 12 of file security/abstract.class.php.

◆ beforeInit()

beforeInit ( )
protectedinherited

Call just before the configuration initialisation

Definition at line 35 of file object.class.php.

◆ check()

check ( array  $url = null,
  $redirect = true 
)
abstract

Check if the user can access to the url given in the array (request style) or the current URL if null is given

Parameters
null | array$url
bool$redirectIndicate if the user should be directly redirected and exit the program
Returns
bool True if authorized access

◆ delRole()

delRole (   $role = null)
abstract

Delete a role or all roles

Parameters
null | mixed$rolenull to delete all roles
Returns
bool True if successful

◆ getAttr()

getAttr (   $name)
inherited

Get an attribute

Parameters
string$nameAttribute name
Returns
mixed|null The attribute or null if not set

Definition at line 48 of file object.class.php.

◆ getCfg()

getCfg ( )
inherited

Get the configuration object

Returns
config

Definition at line 67 of file object.class.php.

◆ getLoginForm()

getLoginForm ( array  $prm = array())
abstract

Get the login Form Object

Returns
form

◆ getPage()

getPage (   $type = 'login',
  $uri = false 
)

Get a configured page

Parameters
string$typePagename (login, logged, logout, forbidden)
bool$uriIndiciate if the url should be parsed with request::uri to be used directly
Returns
string The page url

Definition at line 101 of file security/abstract.class.php.

◆ hasRole()

hasRole (   $role = null)
abstract

Check if the current user has a specific role or retrun the whole roles

Parameters
null | mixed$rolenull to get all roles
Returns
array|bool Array of roles or bool

◆ hook()

hook (   $name)
protected

Function to be rewritten in eventual child to change the way security works Available actions:

  • autoLogin
  • autoLoginSession
  • login
  • redirectError
  • logout
Parameters
string$action

Definition at line 117 of file security/abstract.class.php.

◆ isContained()

isContained ( array  $url,
array  $checks 
)
protected

Indicate if a configuration array is contained in the url

Parameters
array$url
array$checks
Returns
bool True if a line in $checks matches the $url

Definition at line 126 of file security/abstract.class.php.

◆ isLogged()

isLogged ( )
abstract

Check if the user is logged

Returns
bool

◆ login()

login (   $prm = null,
  $page = null 
)
abstract

Login the current user

Parameters
mixed$prm
null | string$pageThe page where to be redirected. If null, config will be used
Returns
bool True if successful

◆ logout()

logout (   $prm = null)
abstract

Logout the current user

Parameters
mixed$prm
Returns
bool True if successful

◆ protect()

protect (   $page = null)

Redirect the user if not logged

Parameters
null | string$pagePage to redirect or configured page forbidden if not provided
Returns
true|void True if allowed, will be redirected if not

Definition at line 88 of file security/abstract.class.php.

◆ setAttr()

setAttr (   $name,
  $value 
)
inherited

Set an attribute

Parameters
string$nameAttribute name
mixed$valueAttribute value

Definition at line 58 of file object.class.php.

Field Documentation

◆ $cfg

$cfg
protectedinherited

Definition at line 17 of file object.class.php.


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:21 for nyroFwk by doxygen 1.8.13