Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
eZPermission Class Reference

## Public Member Functions
| __construct ( $id="")
| store ()
| delete ()
| get ( $id=-1)
| getAllByModule ( $module)
| getAll ()
| id ()
| name ()
| module ()
| setName ( $value)
| setModule ( $module)
| setEnabled ( $group, $value)
| isEnabled ( $group)

## Static Public Member Functions
static | checkPermission ( $user, $moduleName, $permissionName)

## Public Attributes
| $ID
| $Name
| $ModuleID
| $State_
| Indicates the state of the object. In regard to database information. More...

## Detailed Description

! eZUser eZPermission haldes user group permissions.

Example code:

// First off, the fast version of permission checking.
// the $group variable is a eZUserGroup object.
if ( eZPermission::checkPermission( $group, "eZTrade", "AddProducts" ) )
{
print( "Access granted" );
}
else
{
print( "Access denied" );
}
// fetch a module from the database.
$module->get( 1 );
// create a new eZPermission object and set some values
$permission = new eZPermission();
$permission->setName( "AddProducts" );
$permission->setModule( $module );
// store the object and repport the success/failure
if ( $permission->store() )
{
print( "Permission stored successfully<br>" );
}
else
{
print( "Error: could not store permission." );
}
// fetch a permission
if ( $permission->get( 1 ) )
{
print( "Permission successfully fetched" );
}
// fetch a user group
$group = new eZUserGroup();
$group->get( 1 );
// set a group permission
$permission->setEnabled( $group, false );
// check some permissions
if ( $permission->isEnabled( $group ) )
{
print( "Access granted.<br>" );
}
else
{
print( "Access denied.<br>" );
}
$group
$group
Definition: admin/articleedit.php:799
eZPermission
Definition: ezpermission.php:97
eZPermission\checkPermission
static checkPermission( $user, $moduleName, $permissionName)
Definition: ezpermission.php:430
eZUserGroup
Definition: ezusergroup.php:66
$module
$module
Definition: classes/admin/linkselect.php:219
$permission
$permission
Definition: eventedit.php:315

See also
  eZUser eZUserGroup eZModule eZForgot

Definition at line 96 of file ezpermission.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZPermission::__construct | ( |  | $id = `""` | ) |

Constructs a new eZPermission object.

If $id is set the object's values are fetched from the database.

Definition at line 104 of file ezpermission.php.

References $id, and $ID.

## Member Function Documentation

## ◆ checkPermission()

static eZPermission::checkPermission | ( |  | $user,
|  |  | $moduleName,
|  |  | $permissionName
| ) |  |
| static

Static function for checking permissions. Note: If the user has root permissions this function allways returns true.

Definition at line 430 of file ezpermission.php.

References $db, $group, $groupArray, $module, $permission, $ret, $test, $user, and eZDB\globalDatabase().

Referenced by eZModuleHandler\all(), articleCategoryTree(), login(), newOrders(), and writeAtAll().

## ◆ delete()

eZPermission::delete | ( |  | ) |

Deletes a eZPermission object from the database.

Definition at line 169 of file ezpermission.php.

References $db, and eZDB\globalDatabase().

## ◆ get()

eZPermission::get | ( |  | $id = `-1` | ) |

Fetches the object information from the database.

Returns false if unsuccessful.

Definition at line 188 of file ezpermission.php.

References $db, $id, $ret, eZDB\globalDatabase(), and Name.

## ◆ getAll()

eZPermission::getAll | ( |  | ) |

Fetches the id from the database, and returns an array of eZPermission objects.

Definition at line 250 of file ezpermission.php.

References $db, $i, and eZDB\globalDatabase().

## ◆ getAllByModule()

eZPermission::getAllByModule | ( |  | $module | ) |

Fetches the id from the database where ModuleID == $id, and returns an array of eZPermission objects.

Definition at line 221 of file ezpermission.php.

References $db, $i, $module, $query, and eZDB\globalDatabase().

## ◆ id()

eZPermission::id | ( |  | ) |

Returns the object ID.

Definition at line 272 of file ezpermission.php.

References $ID.

## ◆ isEnabled()

eZPermission::isEnabled | ( |  | $group | ) |

Returns true if the permission is enabled.

False is returned if the permission does not exits or if the permission is disabled.

Definition at line 402 of file ezpermission.php.

References $db, $group, $groupID, $ret, and eZDB\globalDatabase().

## ◆ module()

eZPermission::module | ( |  | ) |

Returns the module as a eZModule object.

False is returned if unsuccessful.

Definition at line 292 of file ezpermission.php.

References $module, and $ret.

## ◆ name()

eZPermission::name | ( |  | ) |

Returns the permission name.

Definition at line 280 of file ezpermission.php.

References $ID, and $Name.

## ◆ setEnabled()

eZPermission::setEnabled | ( |  | $group,
|  |  | $value
| ) |  |

Sets the permission value.

Takes a eZUserGroup object and a bool as arguments.

Returned false if unsuccessful.

Definition at line 337 of file ezpermission.php.

References $db, $group, $groupID, $res, $ret, and eZDB\globalDatabase().

## ◆ setModule()

eZPermission::setModule | ( |  | $module | ) |

Sets the module.

Returns false if unsuccessful, else true.

Definition at line 319 of file ezpermission.php.

References $module, and $ret.

## ◆ setName()

eZPermission::setName | ( |  | $value | ) |

Sets the permission name.

Definition at line 309 of file ezpermission.php.

References Name.

## ◆ store()

eZPermission::store | ( |  | ) |

Stores or updates a eZPermission object in the database.

Definition at line 116 of file ezpermission.php.

References $db, $name, $ret, eZDB\globalDatabase(), and Name.

## Member Data Documentation

## ◆ $ID

eZPermission::$ID

Definition at line 479 of file ezpermission.php.

Referenced by __construct(), id(), and name().

## ◆ $ModuleID

eZPermission::$ModuleID

Definition at line 481 of file ezpermission.php.

## ◆ $Name

eZPermission::$Name

Definition at line 480 of file ezpermission.php.

Referenced by name().

## ◆ $State_

eZPermission::$State_

Indicates the state of the object. In regard to database information.

Definition at line 484 of file ezpermission.php.

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

- ezpermission.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.