\Permissions

The Permissions class

Defines categories and permission types. Used with Roles and User classes

Summary

Methods
Properties
Constants
__construct()
createCategory()
getCategoryIdByName()
createPermission()
getPermissionIdByName()
removePermission()
removeCategory()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$db_handle
N/A

Properties

$db_handle

$db_handle : 

Type

Methods

__construct()

__construct(  $db_handle) 

Create a Permissions handler object

Parameters

$db_handle

createCategory()

createCategory(  $name,   $description = "") 

Creates a new category for permissions

Parameters

$name

the name of the role

$description

the description (optional)

getCategoryIdByName()

getCategoryIdByName(  $name) : \the

Retrieves the category Id using the name provided

Parameters

$name

Returns

\the —

id or 0 if nothing found

createPermission()

createPermission(  $name,   $catId,   $definition = "") : \the

Creates a new permission under the given category.

A definition can be provided for further refining.

Parameters

$name

name of this permission

$catId

the category ID to associate the permission with

$definition

define what this permission is if special (optional)

Returns

\the —

id of this permission or 0 if failed to create.

getPermissionIdByName()

getPermissionIdByName(  $name,   $catId) : \the

Gets the ID for a permission based on the given name and the category (could be duplicate permissions)

Parameters

$name

name of the permission

$catId

category id of the permission in question

Returns

\the —

id or 0 if not found

removePermission()

removePermission(  $permId) : true

Removes a permission. Associated category is not deleted.

The permission is removed from any Roles who may have it associated

Parameters

$permId

id of permission to be removed

Returns

true —

if was deleted, else false

removeCategory()

removeCategory(  $catId) : true

Removes a category. WARNING, all associated permissions will be removed and roles which have them assigned.

Parameters

$catId

id of category to be removed

Returns

true —

if was deleted, else false