Public Member Functions |
| | __construct () |
| | fetch_permits_for_object ($Object, $ObjectType= 'page', $AddGroupPermits=true) |
| | get_permits_for_object ($Object, $ObjectType= 'page', $AddGroupPermits=true) |
| | object_has_permit ($Object, $ObjectType, $Permit) |
| | object_has_all_permits ($Object, $ObjectType, $Permits) |
| | validate_permits_ex ($Object1, $ObjectType1, $Object2, $ObjectType2) |
| | get_users_for_permit ($PermitName) |
Detailed Description
Working with worker's registry cards.
- Author
- Dodonov A.A.
Definition at line 26 of file permit_algorithms.php.
Constructor & Destructor Documentation
Constructor.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 59 of file permit_algorithms.php.
{
try
{
$this->Database =
get_package(
'database' ,
'last' , __FILE__ );
$this->Link =
get_package(
'link' ,
'last' , __FILE__ );
$this->PermitAccess =
get_package(
'permit::permit_access' ,
'last' , __FILE__ );
$this->Security =
get_package(
'security' ,
'last' , __FILE__ );
$this->UserAlgorithms =
get_package(
'user::user_algorithms' ,
'last' , __FILE__ );
}
catch( Exception $e )
{
}
}
Member Function Documentation
| fetch_permits_for_object |
( |
|
$Object, |
|
|
|
$ObjectType = 'page', |
|
|
|
$AddGroupPermits = true |
|
) |
| |
Function returns permits for object not using cache.
- Parameters
-
| $Object | - Object to be accessed. |
| $ObjectType | - Type of the accessed object (may be menu, user, page). |
| $AddGroupPermits | - Should be group permits processed. |
- Note
- if the file with permits was not found, all permits for that object are defaulted to 'admin'.
- Returns
- List of permits.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 164 of file permit_algorithms.php.
{
try
{
switch( $ObjectType )
{
case( 'group' ):
$Permits = $this->PermitAccess->get_permits_for_object( $Object , 'group' , array() );
break;
case( 'menu' ):
$Permits = $this->PermitAccess->get_permits_for_object( $Object , 'menu' , array( 'admin' ) );
break;
case( 'page' ):$Permits = $this->PermitAccess->get_permits_for_page( $Object );break;
case( 'user' ):$Permits = $this->get_permits_for_user( $Object , $AddGroupPermits );break;
}
return( $Permits );
}
catch( Exception $e )
{
}
}
| get_permits_for_object |
( |
|
$Object, |
|
|
|
$ObjectType = 'page', |
|
|
|
$AddGroupPermits = true |
|
) |
| |
Function returns permits for object.
- Parameters
-
| $Object | - Object to be accessed. |
| $ObjectType | - Type of the accessed object (may be menu, user, page). |
| $AddGroupPermits | - Should be group permits processed. |
- Note
- if the file with permits was not found, all permits for that object are defaulted to 'admin'.
- Returns
- List of permits.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 223 of file permit_algorithms.php.
{
try
{
$Key = md5( $Object.$ObjectType.$AddGroupPermits );
if( isset( $this->PermitAccess->PermitsCache[ $Key ] ) )
{
return( $this->PermitAccess->PermitsCache[ $Key ] );
}
$this->PermitAccess->PermitsCache[ $Key ] = $Permits;
return( $this->PermitAccess->PermitsCache[ $Key ] );
}
catch( Exception $e )
{
}
}
| get_users_for_permit |
( |
|
$PermitName | ) |
|
Function returns all users who have permit $PermitName.
- Parameters
-
| $PermitName | - Permit's title. |
- Returns
- List of the user objects wuch have permit $PermitName.
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 430 of file permit_algorithms.php.
{
try
{
$PermitName = $this->Security->get( $PermitName , 'command' );
$PermitObject = $this->PermitAccess->get_permit_by_name( $PermitName );
$Links1 = $this->Link->get_links(
false ,
get_field( $PermitObject ,
'id' ) ,
'user' ,
'permit' );
$Links2 = $this->Link->get_links(
false ,
get_field( $PermitObject ,
'id' ) ,
'group' ,
'permit' );
$Links3 = $this->Link->get_links(
false ,
get_field_ex( $Links2 ,
'object1_id' ) ,
'user' ,
'group' );
$Users = array_unique( $Users );
return( $Users );
}
catch( Exception $e )
{
}
}
| object_has_all_permits |
( |
|
$Object, |
|
|
|
$ObjectType, |
|
|
|
$Permits |
|
) |
| |
Function validates permit's existance for object.
- Parameters
-
| $Object | - Name of the validating object. |
| $ObjectType | - Type of the object. |
| $Permits | - List of permits, for example "public,admin,reader". |
- Returns
- true if validation was passed, false otherwise
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 325 of file permit_algorithms.php.
{
try
{
if( is_array( $Permits ) === false )
{
$Permits = explode( "," , $Permits );
}
if( count( $Permits ) === count( array_intersect( $ObjectsPermits , $Permits ) ) )
{
return( true );
}
else
{
return( false );
}
}
catch( Exception $e )
{
}
}
| object_has_permit |
( |
|
$Object, |
|
|
|
$ObjectType, |
|
|
|
$Permit |
|
) |
| |
Function validates permit's existance for object.
- Parameters
-
| $Object | - Name of the validating object. |
| $ObjectType | - Type of the object. |
| $Permit | - Permit's title. |
- Returns
- true if validation was passed, false otherwise
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 276 of file permit_algorithms.php.
{
try
{
if( $Object === false && $ObjectType == 'user' )
{
$Object = $this->UserAlgorithms->get_id();
}
return(
in_array( $Permit , $ObjectsPermits ) );
}
catch( Exception $e )
{
}
}
| validate_permits_ex |
( |
|
$Object1, |
|
|
|
$ObjectType1, |
|
|
|
$Object2, |
|
|
|
$ObjectType2 |
|
) |
| |
Validate if the first object has access to the second object.
- Parameters
-
| $Object1 | - This object requests for permits. |
| $ObjectType1 | - Type of the object (may be menu, user, page). |
| $Object2 | - Object to be accessed. |
| $ObjectType2 | - Type of the accessed object (may be menu, user, page). |
- Returns
- true if validation was passed, false otherwise
- Exceptions
-
| Exception | An exception of this type is thrown. |
- Author
- Dodonov A.A.
Definition at line 385 of file permit_algorithms.php.
{
try
{
if( count( $Permits2 ) === count( array_intersect( $Permits1 , $Permits2 ) ) )
{
return( true );
}
else
{
return( false );
}
}
catch( Exception $e )
{
}
}
Field Documentation
The documentation for this class was generated from the following file: