API - XOOPS 2.5.11 Beta 2
By monxoops.fr
Permission Class Reference
Inheritance diagram for Permission:
Collaboration diagram for Permission:

Public Member Functions

 init ()
 
 checkPermission ($gperm_name, $gperm_itemid, $trueifadmin=true)
 
 getItemIds ($gperm_name, $gperm_groupid)
 
 checkPermissionRedirect ( $gperm_name, $gperm_itemid, $url, $time=3, $message='', $trueifadmin=true)
 
 getGroupsForItem ($gperm_name, $gperm_itemid)
 
 savePermissionForItem ($gperm_name, $gperm_itemid, $groups)
 
 deletePermissionForItem ($gperm_name, $gperm_itemid)
 
 getGroupSelectFormForItem ( $gperm_name, $gperm_itemid, $caption, $name=null, $include_anon=false, $size=5, $multiple=true)
 
 defaultFieldName ($gperm_name, $gperm_itemid)
 
- Public Member Functions inherited from AbstractHelper
 __construct ($dirname=null)
 
 init ()
 
 dirname ()
 
 setDebug ($bool=true)
 
 addLog ($log)
 

Protected Member Functions

 getUserGroups ()
 
- Protected Member Functions inherited from AbstractHelper
 serializeForHelperLog ($value)
 

Protected Attributes

 $mid
 
 $dirname
 
 $permissionHandler
 
- Protected Attributes inherited from AbstractHelper
 $dirname
 
 $module
 
 $debug
 

Member Function Documentation

◆ checkPermission()

checkPermission (   $gperm_name,
  $gperm_itemid,
  $trueifadmin = true 
)

Check if the user has permission for an item

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
bool$trueifadmintrue to always return true for admin groups
Returns
bool true if user has access, false if not
Here is the call graph for this function:

◆ checkPermissionRedirect()

checkPermissionRedirect (   $gperm_name,
  $gperm_itemid,
  $url,
  $time = 3,
  $message = '',
  $trueifadmin = true 
)

Redirect to a url if user does not have permission for an item

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
string$urlmodule relative url to redirect to
int$timetime in seconds to delay
string$messagemessage to display with redirect
bool$trueifadmintrue to always return true for admin groups
Returns
void
Here is the call graph for this function:

◆ defaultFieldName()

defaultFieldName (   $gperm_name,
  $gperm_itemid 
)

Generate a default name for a XoopsFormElement based on module, gperm_name and gperm_itemid

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
Returns
string
Here is the caller graph for this function:

◆ deletePermissionForItem()

deletePermissionForItem (   $gperm_name,
  $gperm_itemid 
)

Delete all permissions for an item and a specific name or array of names

Parameters
string | string[]$gperm_namename(s) of the permission to delete
int$gperm_itemidid of the object to check
Returns
bool true if no errors
Here is the caller graph for this function:

◆ getGroupSelectFormForItem()

getGroupSelectFormForItem (   $gperm_name,
  $gperm_itemid,
  $caption,
  $name = null,
  $include_anon = false,
  $size = 5,
  $multiple = true 
)

Generate a XoopsFormElement to select groups to grant permission to a specific gperm_name and gperm_item. Field will be preset with existing permissions.

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
string$captioncaption for form field
string$namename/id of form field
bool$include_anontrue to include anonymous group
int$sizesize of list
bool$multipletrue to allow multiple selections
Returns
object XoopsFormSelectGroup
Here is the call graph for this function:

◆ getGroupsForItem()

getGroupsForItem (   $gperm_name,
  $gperm_itemid 
)

Get array of groups with named permission to an item

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
Returns
array groups with permission for item
Here is the caller graph for this function:

◆ getItemIds()

getItemIds (   $gperm_name,
  $gperm_groupid 
)

Get all item IDs for which a group (or set of groups) has a specific permission Return an array of items for which the specified groups have the named permission

Parameters
string$gperm_nameName of permission
int | array$gperm_groupidA group ID or an array of group IDs
Returns
array array of item IDs

◆ getUserGroups()

getUserGroups ( )
protected

Get any groups associated with the current user

Returns
int|int[] group id(s)
Here is the caller graph for this function:

◆ init()

init ( )

Initialize parent::__construct calls this after verifying module object.

Returns
void

Reimplemented from AbstractHelper.

Here is the call graph for this function:

◆ savePermissionForItem()

savePermissionForItem (   $gperm_name,
  $gperm_itemid,
  $groups 
)

Save group permissions for an item

Parameters
string$gperm_namename of the permission to test
int$gperm_itemidid of the object to check
array$groupsgroup ids to grant permission to
Returns
bool true if no errors
Here is the call graph for this function:

Field Documentation

◆ $dirname

$dirname
protected

◆ $mid

$mid
protected

◆ $permissionHandler

$permissionHandler
protected

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