Public Member Functions | Protected Member Functions | Protected Attributes

security_public Class Reference

Inheritance diagram for security_public:
security_abstract object

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, which allow everything to anybody by default

Definition at line 10 of file public.class.php.


Member Function Documentation

addRole ( role  ) 

Add a role to the current user

Parameters:
mixed $role
Returns:
bool True if successful

Reimplemented from security_abstract.

Definition at line 26 of file public.class.php.

afterInit (  )  [protected, inherited]

Call just after the configuration initialisation

Reimplemented from object.

Reimplemented in security_default.

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

beforeInit (  )  [protected, inherited]

Call just before the configuration initialisation

Reimplemented in form_file.

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

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

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 $redirect Indicate if the user should be directly redirected and exit the program
Returns:
bool True if authorized access

Reimplemented from security_abstract.

Definition at line 38 of file public.class.php.

delRole ( role = null  ) 

Delete a role or all roles

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

Reimplemented from security_abstract.

Definition at line 34 of file public.class.php.

getAttr ( name  )  [inherited]

Get an attribute

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

Reimplemented in response_proxy.

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

getCfg (  )  [inherited]

Get the configuration object

Returns:
config

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

getLoginForm ( array $  prm = array()  ) 

Get the login Form Object

Returns:
form

Reimplemented from security_abstract.

Definition at line 55 of file public.class.php.

getPage ( type = 'login',
uri = false 
) [inherited]

Get a configured page

Parameters:
string $type Pagename (login, logged, logout, forbidden)
bool $uri Indiciate 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 ( role = null  ) 

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

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

Reimplemented from security_abstract.

Definition at line 30 of file public.class.php.

hook ( name  )  [protected, inherited]

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 ( array $  url,
array $  checks 
) [protected, inherited]

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 (  ) 

Check if the user is logged

Returns:
bool

Reimplemented from security_abstract.

Definition at line 12 of file public.class.php.

login ( prm = null,
page = null 
)

Login the current user

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

Reimplemented from security_abstract.

Definition at line 16 of file public.class.php.

logout ( prm = null  ) 

Logout the current user

Parameters:
mixed $prm
Returns:
bool True if successful

Reimplemented from security_abstract.

Definition at line 21 of file public.class.php.

protect ( page = null  )  [inherited]

Redirect the user if not logged

Parameters:
null|string $page Page 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 ( name,
value 
) [inherited]

Set an attribute

Parameters:
string $name Attribute name
mixed $value Attribute value

Reimplemented in response_proxy.

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


Field Documentation

$cfg [protected, inherited]

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


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations
Generated on Tue May 8 2012 16:02:25 for nyroFwk by doxygen 1.7.1