Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

Public Member Functions | Static Public Member Functions | List of all members
eZObjectPermission Class Reference

## Public Member Functions
| __construct ()

## Static Public Member Functions
static | hasPermission ( $objectID, $moduleTable, $permission, $user=false)
static | hasPermissionWithDefinition ( $objectID, $moduleTable, $permission, $user=false, $categoryID=false)
static | setPermission ( $group, $objectID, $moduleTable, $permission)
static | removePermissions ( $objectID, $moduleTable, $permission)
static | getGroups ( $objectID, $moduleTable, $permission, $GroupReturn=true)
static | getObjects ( $moduleTable, $permission, $count=false, $user=false)

## Detailed Description

! eZUser eZObjectPermission holds user group permissions for objects like articles, article categories, bugs, e.g.

Example code:

Check if a user has read permission to an article object:
if ( eZObjectPermission::hasPermission( $objectID, "article_article", 'r' ) )
{
currentuser has permission
}
else
{
He did not.
}
eZObjectPermission\hasPermission
static hasPermission( $objectID, $moduleTable, $permission, $user=false)
Definition: ezobjectpermission.php:76

See also
  eZUser eZUserGroup eZModule eZForgot

Definition at line 54 of file ezobjectpermission.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZObjectPermission::__construct | ( |  | ) |

Constructs a new eZPermission object.

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

Definition at line 62 of file ezobjectpermission.php.

## Member Function Documentation

## ◆ getGroups()

static eZObjectPermission::getGroups | ( |  | $objectID,
|  |  | $moduleTable,
|  |  | $permission,
|  |  | $GroupReturn = `true`
| ) |  |
| static

Returns all the groups that have permissions to a given object, if none are selected a empty array is returned. If one object with -1 is returned, everyone has access to the object. $group is of type eZUserGroup or a groupID, use -1 for objects everyone is allowed to see. $moduleTable is the nickname of the table where the permission is found. The nicknames can be found in site.ini $permission either 'r' for readpermission, 'w' for writepermission or 'u' for upload permission

Definition at line 365 of file ezobjectpermission.php.

References $db, $groupID, $i, $id, $permission, $query, $res, $ret, getTableName(), and eZDB\globalDatabase().

## ◆ getObjects()

static eZObjectPermission::getObjects | ( |  | $moduleTable,
|  |  | $permission,
|  |  | $count = `false`,
|  |  | $user = `false`
| ) |  |
| static

Returns all the ID's of objects that a given user has permission $permission to If one object with -1 is returned, everyone has access to the object. $group is of type eZUserGroup or a groupID, use -1 for objects everyone is allowed to see. $moduleTable is the nickname of the table where the permission is found. The nicknames can be found in site.ini $permission either 'r' for readpermission, 'w' for writepermission or 'u' for upload permission. $count if set to true the function will return the count of accessable objects. $user of type eZUser, if left out, currentuser is used.

Definition at line 425 of file ezobjectpermission.php.

References $count, $db, $groupID, $groups, $i, $permission, $query, $res, $ret, $user, eZUser\currentUser(), getTableName(), and eZDB\globalDatabase().

Referenced by writeAtAll().

## ◆ hasPermission()

static eZObjectPermission::hasPermission | ( |  | $objectID,
|  |  | $moduleTable,
|  |  | $permission,
|  |  | $user = `false`
| ) |  |
| static

Definition at line 76 of file ezobjectpermission.php.

References $groups, $permission, $query, $res, $user, eZUser\currentUser(), getTableName(), and eZDB\globalDatabase().

Referenced by createArticleMenu(), hasPermission(), and eZArticleCategory\userHasPermision().

## ◆ hasPermissionWithDefinition()

static eZObjectPermission::hasPermissionWithDefinition | ( |  | $objectID,
|  |  | $moduleTable,
|  |  | $permission,
|  |  | $user = `false`,
|  |  | $categoryID = `false`
| ) |  |
| static

Definition at line 141 of file ezobjectpermission.php.

References $categoryID, $groups, $permission, $query, $res, $user, eZUser\currentUser(), getTableName(), and eZDB\globalDatabase().

Referenced by eZBulkMail\send().

## ◆ removePermissions()

static eZObjectPermission::removePermissions | ( |  | $objectID,
|  |  | $moduleTable,
|  |  | $permission
| ) |  |
| static

Removes all permissions of a given type on an object.

Definition at line 320 of file ezobjectpermission.php.

References $i, $permission, $query, getTableName(), and eZDB\globalDatabase().

Referenced by changePermissions(), newArticle(), and syncDir().

## ◆ setPermission()

static eZObjectPermission::setPermission | ( |  | $group,
|  |  | $objectID,
|  |  | $moduleTable,
|  |  | $permission
| ) |  |
| static

Sets a permissions for on an object for a eZUserGroup. To set a permission for all use -1 as group. $group is of type eZUserGroup or the group ID and is the group that gets the permission $objectID is the ID of the object you are interested in. This could be a bug, an article etc.. $moduleTable is the nickname of the table where the permission is found. The nicknames can be found in site.ini $permission either 'r' for readpermission, 'w' for writepermission or 'u' for upload permission.

Definition at line 236 of file ezobjectpermission.php.

References $db, $group, $groupID, $permission, $query, $res, exit, getTableName(), and eZDB\globalDatabase().

Referenced by changePermissions(), eZArticleCategory\copyTree(), eZVirtualFolder\getByName(), newArticle(), and syncDir().

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

- ezobjectpermission.php

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