ExplicitReadWriteModelPermissionsUtil Class Reference

Static Public Member Functions

static makeByMixedPermitablesData ($mixedPermitablesData)
static makeMixedPermitablesDataByExplicitReadWriteModelPermissions ($explicitReadWriteModelPermissions)
static makeByPostData ($postData)
static resolveByPostDataAndModelThenMake ($postData, SecurableItem $securableItem)
static removeIfExistsFromPostData ($postData)
static resolveExplicitReadWriteModelPermissions (SecurableItem $securableItem, ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions)
static resolveExplicitReadWriteModelPermissionsForDisplay (SecurableItem $securableItem, ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions)
static makeBySecurableItem (SecurableItem $securableItem)

Data Fields

const MIXED_TYPE_EVERYONE_GROUP = 1
const MIXED_TYPE_NONEVERYONE_GROUP = 2

Static Protected Member Functions

static resolveForDifferencesBySecurableItem ($explicitReadWriteModelPermissions, SecurableItem $securableItem)

Detailed Description

Helper class for managing the explicit setting of permissions against a model in the user interface.

See also:
ExplicitReadWriteModelPermissions
ExplicitReadWriteModelPermissionsElement

Definition at line 42 of file ExplicitReadWriteModelPermissionsUtil.php.


Member Function Documentation

static makeByMixedPermitablesData ( mixedPermitablesData  )  [static]

Given a mixed permitables data array, make a explicitReadWriteModelPermissions object. The $mixedPermitablesData is an array with 2 sub-arrays. readOnly and readWrite. These sub-arrays each contain an array of permitable objects.

Parameters:
array $mixedPermitablesData

Definition at line 62 of file ExplicitReadWriteModelPermissionsUtil.php.

static makeMixedPermitablesDataByExplicitReadWriteModelPermissions ( explicitReadWriteModelPermissions  )  [static]

Given a explicitReadWriteModelPermissions object, make a $mixedPermitablesData array.

Parameters:
ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions

Definition at line 87 of file ExplicitReadWriteModelPermissionsUtil.php.

static makeByPostData ( postData  )  [static]

Given post data, which would be coming most likely from the ExplicitReadWriteModelPermissionsElement, transform the post data into a ExplicitReadWriteModelPermissions object. If the post data contains a 'type' value that is not supported, an exception is thrown.

Parameters:
array $postData
See also:
ExplicitReadWriteModelPermissionsElement

Definition at line 122 of file ExplicitReadWriteModelPermissionsUtil.php.

static resolveByPostDataAndModelThenMake ( postData,
SecurableItem securableItem 
) [static]

Given an array of post data and a securable item, if the post data has the 'explicitReadWriteModelPermissions' present, then make a explicitReadWriteModelPermissions from that data and then resolve against any differences in the securable item. This means if the post data says a group is read/write, but the existing securable item does not have that, then this signals this will need to be added. Whereas if the securable item has a read/write group that the post data does not have, this signals that this read/write needs to be removed.

Parameters:
array $postData
SecurableItem $securableItem

Definition at line 158 of file ExplicitReadWriteModelPermissionsUtil.php.

static resolveForDifferencesBySecurableItem ( explicitReadWriteModelPermissions,
SecurableItem securableItem 
) [static, protected]

If the ExplicitReadWriteModelPermissions says a group is read/write, but the existing securable item does not have that, then this signals this group will need to be added. Whereas if the securable item has a read/write group that the ExplicitReadWriteModelPermissions does not have, this signals that this read/write needs to be removed.

Parameters:
ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
SecurableItem $securableItem

Definition at line 181 of file ExplicitReadWriteModelPermissionsUtil.php.

static removeIfExistsFromPostData ( postData  )  [static]

Unset the 'explicitReadWriteModelPermissions' array of data in a post data array if it exists.

Parameters:
array $postData
Returns:
array of post data with the 'explicitReadWriteModelPermissions' removed.

Definition at line 213 of file ExplicitReadWriteModelPermissionsUtil.php.

static resolveExplicitReadWriteModelPermissions ( SecurableItem securableItem,
ExplicitReadWriteModelPermissions explicitReadWriteModelPermissions 
) [static]

Given a SecurableItem, add and remove permissions based on what the provided ExplicitReadWriteModelPermissions indicates should be done. Sets

See also:
SecurableItem->setTreatCurrentUserAsOwnerForPermissions as true in order to ensure the current user can effectively add permissions even if the current user is no longer the owner.
Parameters:
SecurableItem $securableItem
ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
Returns:
boolean
Exceptions:
NotSupportedException() 

Definition at line 233 of file ExplicitReadWriteModelPermissionsUtil.php.

static resolveExplicitReadWriteModelPermissionsForDisplay ( SecurableItem securableItem,
ExplicitReadWriteModelPermissions explicitReadWriteModelPermissions 
) [static]

Given a SecurableItem, add and remove permissions just on the securableItem. Since this method is called when the SecurableItem is not being saved and just for display purposes in the user interface.

Parameters:
SecurableItem $securableItem
ExplicitReadWriteModelPermissions $explicitReadWriteModelPermissions
Returns:
boolean
Exceptions:
NotSupportedException() 

Definition at line 368 of file ExplicitReadWriteModelPermissionsUtil.php.

static makeBySecurableItem ( SecurableItem securableItem  )  [static]

Make an ExplicitReadWriteModelPermissions by SecurableItem.

Parameters:
SecurableItem $securableItem

Definition at line 393 of file ExplicitReadWriteModelPermissionsUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Thu Apr 27 07:10:25 2017