CSRightsPlugin
extends CSPlugin
in package
This plugin adds some rights to the CONTENTSERV rights model.
To be included, it must be placed in a core subfolder with a file name ending with Rights.php.
Tags
Table of Contents
- __call() : mixed|string
- All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.
- _construct() : void
- The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.
- addAlternativePluginFolder() : void
- A path to a specific folder in which should be search for plugins.
- addDescription() : void
- Adds a description row to the dialog
- addHiddenRight() : void
- Adds a right to the dialog, which is always set.
- addRight() : void
- Adds a new right to the dialog.
- addRights() : void
- This method is called to define rights using the utility methods.
- addSeparator() : void
- Adds a separator line to the dialog.
- addTable() : void
- Defines a new right table in the dialog.
- addTableRight() : void
- Adds a new right to the previously defined table in the dialog.
- getAlternativePluginFolder() : array<string|int, mixed>
- getLevel() : int
- The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.
- getMetaData() : CSMetaData
- Returns the CSMetaData of the current plugin.
- getModule() : CSModule
- Returns the module, if the plugin is defined within a module.
- getPlugin() : CSPlugin|null
- Returns a CSPlugin for the given plugin type and plugin class name.
- getPluginChooser() : array<string|int, mixed>
- Returns an array all defined CSPlugins for the current plugin type
- getPluginData() : mixed
- getPluginDefinitionFile() : string
- Returns the path to the file, the plugin is defined.
- getPluginName() : mixed
- getPlugins() : array<string|int, CSPlugin>
- Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.
- getPluginsInModule() : array<string|int, mixed>
- Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.
- getRightGroups() : array<string|int, mixed>
- allows to define right groups by overwriting this method, the returned array should have the following format: array( "GroupName" => array("Right11", "Right12"...), "GroupName2" => array("Right21", "Right22"...), );
- isAvailable() : bool
- This method is called to check, whether the plugin is available.
- onAddAccessLevelsToItem() : void
- Called when access levels are added to an item.
- onAddRightsToRole() : void
- Called when rights in a role got added.
- onAddRightToAccessLevel() : void
- Called when a right has been added to an access level.
- onChangeAccessLevel() : void
- Called when an access level has been changed.
- onChangeRole() : void
- Called when a role was changed. In case of the role this can only be a change of name.
- onCreateAccessLevel() : void
- Called when an access level has been created.
- onCreateRole() : void
- Called when a role has been created.
- onRemoveAccessLevel() : void
- Called when an access level has been deleted.
- onRemoveAccessLevelsFromItem() : void
- Called when access levels are removed from an item.
- onRemoveRightFromAccessLevel() : void
- Called when a right has been removed from an access level.
- onRemoveRightsFromRole() : void
- Called when rights in a role got removed.
- onRemoveRole() : void
- Called when a role has been deleted.
- resetLoadedPlugins() : mixed
- reset the internal plugins cache for loaded plugins
- setExpander() : void
- Sets the default expander and tree pane for the current plugin.
Methods
__call()
All method calls which are not defined within the plugin are forwarded to the module Therefore it is possible to get, e.g. the label by calling the getSuiteName() method.
public
__call(mixed $methodName, mixed $methodArguments) : mixed|string
Parameters
- $methodName : mixed
- $methodArguments : mixed
Tags
Return values
mixed|string —_construct()
The construct method may be used to initialize custom plugin properties it is called immediately after instantiating the plugin all arguments passed to the getPlugins method are also available in this method.
public
_construct() : void
Tags
Return values
void —addAlternativePluginFolder()
A path to a specific folder in which should be search for plugins.
public
static addAlternativePluginFolder(mixed $sPluginFolder) : void
Parameters
- $sPluginFolder : mixed
Tags
Return values
void —addDescription()
Adds a description row to the dialog
public
addDescription([string $label = '' ]) : void
Parameters
- $label : string = ''
-
the description which should be shown
Tags
Return values
void —addHiddenRight()
Adds a right to the dialog, which is always set.
public
addHiddenRight(string $name) : void
Parameters
- $name : string
-
the name of the right
Tags
Return values
void —addRight()
Adds a new right to the dialog.
public
addRight(string $sLabel, string $sName[, bool $bPositive = true ][, array<string|int, mixed> $aDependencies = array() ][, string $sToolTip = '' ][, int $iRoleType = CS_ROLE_TYPE_STANDARD ]) : void
Parameters
- $sLabel : string
-
The label of the right.
- $sName : string
-
The name of the right.
- $bPositive : bool = true
-
Whether this right is a activating (true) or disabling (false) something.
- $aDependencies : array<string|int, mixed> = array()
-
A list of rights this right is depending on. That means that when activating this right in role editor all rights in this list are also activated continued by a message to inform the user. Additionally when when deactivating a right this right depends on this right is also deactivated. The right names can be specified including the module prefix e.g. mam:viewmamfiles or without this prefix (in this case the plugin module is used)
- $sToolTip : string = ''
-
The tooltip for the right.
- $iRoleType : int = CS_ROLE_TYPE_STANDARD
-
The role type we want to assign to this right
Tags
Return values
void —addRights()
This method is called to define rights using the utility methods.
public
addRights() : void
It should be overwritten in the plugin
Tags
Return values
void —addSeparator()
Adds a separator line to the dialog.
public
addSeparator() : void
Tags
Return values
void —addTable()
Defines a new right table in the dialog.
public
addTable(string $label, array<string|int, mixed> $columns[, mixed $forceLabels = false ]) : void
Tables are defined by setting table columns using the addTable method and rows using addTableRight. The complete right name is been concated using the right of the column followed by a colon and the right of a row: MODULE:COLUMNRIGHT:RIGHTNAME
Parameters
- $label : string
-
the label of the table
- $columns : array<string|int, mixed>
-
an array of strings: RIGHT => LABEL, where the LABEL is displayed in the first row.
- $forceLabels : mixed = false
Tags
Return values
void —addTableRight()
Adds a new right to the previously defined table in the dialog.
public
addTableRight(string $label, string $name[, array<string|int, mixed> $hideColumns = array() ][, bool $positive = true ][, array<string|int, mixed> $dependencies = array() ][, array<string|int, mixed> $allowedTableRoleTypes = array() ]) : void
Parameters
- $label : string
-
the label of the right
- $name : string
-
the name of the right
- $hideColumns : array<string|int, mixed> = array()
-
an array of columns from the previously defined columns, which should not been shown as checkboxes. The format of this array is RIGHT => ALTERNATIVETEXT where the ALTERNATIVETEXT is displayed instead of the checkbox
- $positive : bool = true
-
whether this right is a activating (true) or disabling (false) something
- $dependencies : array<string|int, mixed> = array()
-
a list of rights this right is depending on. That means that when activating this right in role editor all rights in this list are also activated continued by a message to inform the user. Additionally when when deactivating a right this right depends on this right is also deactivated. The right names can be specified including the module prefix e.g. mam:viewmamfiles or without this prefix (in this case the plugin module is used)
- $allowedTableRoleTypes : array<string|int, mixed> = array()
-
a named list of Role Types per column, indicating which role types are allowed to have this particular right ond column combination. Example syntax: ['column_name' => CS_ROLE_TYPE_ALL, 'other_column' => CS_ROLE_TYPE_STANDARD]
Tags
Return values
void —getAlternativePluginFolder()
public
static getAlternativePluginFolder() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —getLevel()
The getLevel method may be overwritten in the plugins and defines the order, the plugins are called, where the highest level is called first.
public
getLevel() : int
The method can also be set for all plugins within a module by overwriting the modules getLevel method.
Tags
Return values
int —the level of the plugin where it is called
getMetaData()
Returns the CSMetaData of the current plugin.
public
getMetaData() : CSMetaData
Tags
Return values
CSMetaData —getModule()
Returns the module, if the plugin is defined within a module.
public
getModule() : CSModule
This method can be used in the plugin api and the plugin wherever access to the defining module is required. If it is used in the Api, it should be noticed that this method may return null, if the plugin is directly defined in the projects or admin.local plugins directory.
Tags
Return values
CSModule —the module object, if the plugin defined in a module or null otherwise
getPlugin()
Returns a CSPlugin for the given plugin type and plugin class name.
public
static getPlugin(string $pluginApiPath, string $className[, mixed $arguments = NULL ]) : CSPlugin|null
As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.
Parameters
- $pluginApiPath : string
-
The relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $className : string
-
The target plugin class name, which should be loaded.
- $arguments : mixed = NULL
-
one or multiple arguments which should be passed to the isAvailable method.
Tags
Return values
CSPlugin|null —Returns the requested plugin for the given parameter.
getPluginChooser()
Returns an array all defined CSPlugins for the current plugin type
public
static getPluginChooser(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, mixed> —of CSPlugins in the form [CLASSNAME => LABEL] where the CLASSNAME may be used in the CSPlugin::getPlugin method
getPluginData()
public
getPluginData() : mixed
Tags
Return values
mixed —getPluginDefinitionFile()
Returns the path to the file, the plugin is defined.
public
getPluginDefinitionFile() : string
Tags
Return values
string —the path to the plugin
getPluginName()
public
getPluginName() : mixed
Tags
Return values
mixed —getPlugins()
Returns all defined CSPlugins for the current plugin type It should be used to get all matching plugins for a given plugin api.
public
static getPlugins(string $pluginApiPath[, mixed $arguments = NULL ]) : array<string|int, CSPlugin>
As standard behaviour the module subfolder is guessed from the forward URL parameter. If a plugin should point to something in a special module subfolder, this scope can be added by adding the module name in squared bracket at the end of the $pluginApiPath, e.g. 'core/api/plugins/CSRecordPlugin.php[pms]' to get all CSRecordPlugins defined for pms records.
Parameters
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api (optional: ending with the module subfolder).
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, CSPlugin> —array of CSPlugin objects matching the defined plugin criteria
getPluginsInModule()
Returns all CSPlugins for the current plugin type which are defined within the given module It should be used to get all matching plugins for a given plugin api.
public
static getPluginsInModule(string $moduleName, string $pluginApiPath[, mixed $sFileNamePattern = '' ][, mixed $arguments = NULL ]) : array<string|int, mixed>
Parameters
- $moduleName : string
-
the module which should be searched for plugins
- $pluginApiPath : string
-
the relative path in filesystem for the requested plugin api.
- $sFileNamePattern : mixed = ''
- $arguments : mixed = NULL
-
one ore multiple arguments which should be passed to the isAvailable method.
Tags
Return values
array<string|int, mixed> —of CSPlugin objects matching the defined plugin criterias
getRightGroups()
allows to define right groups by overwriting this method, the returned array should have the following format: array( "GroupName" => array("Right11", "Right12"...), "GroupName2" => array("Right21", "Right22"...), );
public
getRightGroups() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —isAvailable()
This method is called to check, whether the plugin is available.
public
isAvailable() : bool
If further arguments are added to the CSPlugin::getPlugins call, they are added as arguments to this method.
For simpler usage of the plugin concept: This method should be overwritten with the correct signature for a plugin call, if arguments are passed.
Tags
Return values
bool —whether the plugin is available for the given arguments
onAddAccessLevelsToItem()
Called when access levels are added to an item.
public
onAddAccessLevelsToItem(array<string|int, mixed> $aAccessLevels, Record $oItem) : void
Parameters
- $aAccessLevels : array<string|int, mixed>
-
A list of access levels that got added to the item.
- $oItem : Record
-
The item that got altered.
Tags
Return values
void —onAddRightsToRole()
Called when rights in a role got added.
public
onAddRightsToRole(array<string|int, mixed> $aRights, Role $oRole) : void
Parameters
- $aRights : array<string|int, mixed>
-
A list of rights the have been added to the role.
- $oRole : Role
-
The role that got altered.
Tags
Return values
void —onAddRightToAccessLevel()
Called when a right has been added to an access level.
public
onAddRightToAccessLevel(Role $oRole, User $oGroup, Rubric $oAccessLevel) : void
Parameters
- $oRole : Role
-
The role applied to the access level right.
- $oGroup : User
-
The group applied to the access level right.
- $oAccessLevel : Rubric
-
The access level the right is applied to.
Tags
Return values
void —onChangeAccessLevel()
Called when an access level has been changed.
public
onChangeAccessLevel(Rubric $oAccessLevel) : void
Parameters
- $oAccessLevel : Rubric
-
The object of the access level that got changed.
Tags
Return values
void —onChangeRole()
Called when a role was changed. In case of the role this can only be a change of name.
public
onChangeRole(Role $oRole) : void
Parameters
- $oRole : Role
-
The role that has been changed.
Tags
Return values
void —onCreateAccessLevel()
Called when an access level has been created.
public
onCreateAccessLevel(Rubric $oAccessLevel) : void
Parameters
- $oAccessLevel : Rubric
-
The object of the access level that got created.
Tags
Return values
void —onCreateRole()
Called when a role has been created.
public
onCreateRole(Role $oRole) : void
Parameters
- $oRole : Role
-
The role object of the role that has been created.
Tags
Return values
void —onRemoveAccessLevel()
Called when an access level has been deleted.
public
onRemoveAccessLevel(Rubric $oAccessLevel) : void
Parameters
- $oAccessLevel : Rubric
-
The object of the access level that got deleted.
Tags
Return values
void —onRemoveAccessLevelsFromItem()
Called when access levels are removed from an item.
public
onRemoveAccessLevelsFromItem(array<string|int, mixed> $aAccessLevels, Record $oItem) : void
Parameters
- $aAccessLevels : array<string|int, mixed>
-
A list of access levels that got removed from the item.
- $oItem : Record
-
The item that got altered.
Tags
Return values
void —onRemoveRightFromAccessLevel()
Called when a right has been removed from an access level.
public
onRemoveRightFromAccessLevel(Role $oRole, User $oGroup, Rubric $oAccessLevel) : void
Parameters
- $oRole : Role
-
The role applied to the access level right that got removed.
- $oGroup : User
-
The group applied to the access level right that got removed.
- $oAccessLevel : Rubric
-
The access level the right was applied to.
Tags
Return values
void —onRemoveRightsFromRole()
Called when rights in a role got removed.
public
onRemoveRightsFromRole(array<string|int, mixed> $aRights, Role $oRole) : void
Parameters
- $aRights : array<string|int, mixed>
-
A list of rights the have been removed from the role.
- $oRole : Role
-
The role that got altered.
Tags
Return values
void —onRemoveRole()
Called when a role has been deleted.
public
onRemoveRole(Role $oRole) : void
Parameters
- $oRole : Role
-
The role object of the role that has been deleted.
Tags
Return values
void —resetLoadedPlugins()
reset the internal plugins cache for loaded plugins
public
static resetLoadedPlugins() : mixed
Tags
Return values
mixed —setExpander()
Sets the default expander and tree pane for the current plugin.
public
setExpander(string $expander[, string $treePane = NULL ]) : void
Those settings are applied if no $expander or $treePane is set while defining rights using the other methods
Parameters
- $expander : string
-
the expander the right should be visible as default expander
- $treePane : string = NULL
-
the tree slidepane the right should be visible as default pane
