|
| __construct (ModuleManagementModel $mvv_object) |
|
| __call ($name, $arguments) |
|
| setVariant ($variant) |
|
| havePerm ($perm, $status=null, $user_id=null, $institut_id=null) |
|
| haveObjectPerm ($perm, $user_id=null) |
|
| haveDfEntryPerm ($datafield_id, $perm) |
|
| getFieldPerm ($field, $user_id=null, $institut_id=null) |
|
| haveFieldPerm ($field, $perm=null, $user_id=null, $institut_id=null) |
|
| disable ($field, $perm=null, $user_id=null, $institut_id=null) |
|
◆ __construct()
Creates a new perm object for given mvv object.
- Parameters
-
◆ __call()
__call |
( |
|
$name, |
|
|
|
$arguments |
|
) |
| |
Intercepts instance methods to retrieve permission from configuration.
Allowed calls are:
havePermPERM($status, $user_id, $institut_id)
- See also
- MvvPerm::havePerm() PERM is the constant defining the permission (MvvPerm::PERM_ADMIN, MvvPerm::PERM_CREATE, MvvPerm::PERM_READ, MvvPerm::PERM_WRITE) $status: The status of mvv object defined in config. Status 'default' as default. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. All three arguments are optional
getFieldPermFIELD($user_id, $institut_id)
- See also
- MvvPerm::getFieldPerm() FIELD is the name of the table field. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. All two arguments are optional.
haveFieldPermFIELD($perm, $user_id, $institut_id)
- See also
- MvvPerm::haveFieldPerm() FIELD is the name of the table field. $perm: The constant defining the permission (MvvPerm::PERM_ADMIN, MvvPerm::PERM_CREATE, MvvPerm::PERM_READ, MvvPerm::PERM_WRITE). Default is MvvPerm::PERM_WRITE. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. All three arguments are optional.
- Parameters
-
string | $name | |
array | $arguments | |
- Returns
- mixed
- Exceptions
-
InvalidArgumentException | If called with unknown permission. |
BadMethodCallException | If called with unknown method to reitrieve permission. |
◆ __callStatic()
static __callStatic |
( |
|
$name, |
|
|
|
$arguments |
|
) |
| |
|
static |
Intercepts static calls to retrieve permission from configuration.
Allowed calls are:
MvvPerm::getFieldPermFIELD($mvv_object, $user_id, $institut_id)
- See also
- MvvPerm:getFieldPerm() FIELD is the name of the table field. $mvv_object: Class name or instance of mvv object. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. Last two arguments are optional.
MvvPerm::havePermPERM($mvv_object, $status, $user_id, $institut_id)
- See also
- MvvPerm::havePerm() PERM is the constant defining the permission (MvvPerm::PERM_ADMIN, MvvPerm::PERM_CREATE, MvvPerm::PERM_READ, MvvPerm::PERM_WRITE) $mvv_object: Class name or instance of mvv object. $status: The status of mvv object defined in config. Status 'default' as default. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. Last three arguments are optional
MvvPerm::haveFieldPermFIELD($mvv_object, $perm, $user_id, $institut_id)
- See also
- MvvPerm::haveFieldPerm() FIELD is the name of the table field. $mvv_object: Class name or instance of mvv object. $perm: The constant defining the permission (MvvPerm::PERM_ADMIN, MvvPerm::PERM_CREATE, MvvPerm::PERM_READ, MvvPerm::PERM_WRITE). Default is MvvPerm::PERM_WRITE. $user_id: The id of an user. Id of current user as default. $institut_id: The id of an institute or an array of institute ids the user has a mvv related role. Last three arguments are optional.
- Parameters
-
- Returns
- type
- Exceptions
-
InvalidArgumentException | If called with unknown permission. |
BadMethodCallException | If called with unknown method to retrieve permission. |
◆ disable()
disable |
( |
|
$field, |
|
|
|
$perm = null , |
|
|
|
$user_id = null , |
|
|
|
$institut_id = null |
|
) |
| |
Returns 'readonly' if the given user has no access to the given field.
- Parameters
-
string | $field | The name of the table field. |
int | $perm | Optional. The permission. Defaults to MvvPerm:PERM_WRITE. |
string | $user_id | Optional. The ID of the user. If not set the ID of the current user. |
string | array | $institut_id | The id of an institute or an array of institute ids the user has a mvv related role. |
- Returns
- string 'readonly' if the permission is not granted.
◆ get()
static get |
( |
|
$mvv_object | ) |
|
|
static |
Returns a new perm object for given mvv object.
- Parameters
-
- Returns
- MvvPerm A new perm object.
- Exceptions
-
◆ getFieldPerm()
getFieldPerm |
( |
|
$field, |
|
|
|
$user_id = null , |
|
|
|
$institut_id = null |
|
) |
| |
|
final |
Retrieves the permission for the table or object. Returns the (max) perm the given or current user have globally. If the institute is set, checks for the perm in the context of this institute.
- Parameters
-
| string|array | Name of field or an array with name of field and related entry (usefull in the case of relations to datafields). |
string | $user_id | Optional. The ID of the user. If not set the ID of the current user. |
string | array | $institut_id | Optional. The id of an institute or an array of institute ids the user has a mvv related role. |
- Returns
- int The perm defined in class MVVPlugin.
◆ getOwnInstitutes()
static getOwnInstitutes |
( |
|
$user_id = null , |
|
|
|
$mvv_roles = null |
|
) |
| |
|
static |
Returns all ids of institutes the user is assigned with at least one role. Have the user at least one role globally an empty array is returned.
- Parameters
-
string | $user_id | Optional. The ID of the user. If not set the ID of the current user. |
array | $mvv_roles | Optional. An array of roles. All Mvv-Roles if not set. |
- Returns
- array An array of institute ids or an empty array.
◆ getPerm()
static getPerm |
( |
|
$object, |
|
|
|
$status = null , |
|
|
|
$user_id = null , |
|
|
|
$institut_id = null , |
|
|
|
$variant = null |
|
) |
| |
|
staticfinal |
Retrieves the permission for the table or object. Returns the (max) perm the given or current user has globally. If the institute is set, checks for the perm in the context of this institute.
- Parameters
-
object | string | $object | An mvv object or its class name. |
string | $status | Constrain the permission to this status of the object. |
string | $user_id | The ID of the user. If not set the ID of the current user. |
string | array | $institut_id | The ID(s) of institute(s) if the user role is defined for institutes. |
string | $variant | The optional variant of the object table (e.g. to support different languages) |
- Returns
- int The perm defined in class MVVPlugin.
- Exceptions
-
InvalidArgumentException | If the object is not of type ApplicationSimpleOrMap. |
◆ getRoles()
static getRoles |
( |
|
$user_id | ) |
|
|
static |
◆ haveDfEntryPerm()
haveDfEntryPerm |
( |
|
$datafield_id, |
|
|
|
$perm |
|
) |
| |
Returns whether the actual user has at least the given permission to the datafield entry.
- Parameters
-
| $datafield_id | The id of a datafield. |
int | $perm | |
- Returns
- bool True if permission is granted.
◆ haveFieldPerm()
haveFieldPerm |
( |
|
$field, |
|
|
|
$perm = null , |
|
|
|
$user_id = null , |
|
|
|
$institut_id = null |
|
) |
| |
|
final |
Returns true if the user have at least the given permission status.
- Parameters
-
string | $field | The name of the table field. |
int | $perm | The optional (default PERM_WRITE) permission status. |
string | $user_id | Optional. The ID of the user. If not set the ID of the current user. |
string | array | $institut_id | Optional. The id of an institute or an array of institute ids the user has a mvv related role. |
- Returns
- bool True if the permission is at least the given permission.
◆ haveObjectPerm()
haveObjectPerm |
( |
|
$perm, |
|
|
|
$user_id = null |
|
) |
| |
Returns whether the given user has at least the given permission to this object with the actual status. The user_id is optional. Default is the id of the current user.
- Parameters
-
int | $perm | The permission to check against. |
type | $user_id | The id of an user. |
- Returns
- bool True if the permission is granted.
◆ havePerm()
havePerm |
( |
|
$perm, |
|
|
|
$status = null , |
|
|
|
$user_id = null , |
|
|
|
$institut_id = null |
|
) |
| |
|
final |
Accepts the id of the user, an institute id and the status of this object as optional arguments. Returns whether the user has the given permission to this object.
The status of this object is defined in the configuration file
- Parameters
-
int | $perm | The permission to check against. |
string | $status | The status of the object defined in config. |
string | $user_id | The id of the user. |
string | array | $institut_id | The id of an institute or an array of institute ids the user has a mvv related role. |
- Returns
- bool
◆ refreshPrivileges()
static refreshPrivileges |
( |
|
$mvv_table | ) |
|
|
static |
◆ setVariant()
Sets the variant of an mvv object. The variant means that a different configuration file is used to retrieve the permissions. It is used to determines permissions for different languages of a descriptor.
- Parameters
-
string | $variant | The suffix (part after las underscore) of the file name of a config file. |
- Returns
- $this Returns this instance for method chaining.
◆ PERM_ADMIN
Permission to read, write/create and delete the value of the designated field. Possibly the admin have permission to particular functions.
◆ PERM_CREATE
Permission to read, write/create and delete the value of the designated field.
◆ PERM_READ
Permission to read the value of the designated field.
◆ PERM_WRITE
Permission to read and write the value of the designated field.
The documentation for this class was generated from the following files: