Made $map protected and moved it to construct.
By making $map protected and moving it to the construct, you can simply extend the BasicPermissionMap class if you want to simply add some extra permissions. In it's current form, you have to copy/paste the entire array AND the getMasks and contains functions.
This commit is contained in:
parent
83e078a035
commit
1369d54db8
@ -28,58 +28,63 @@ class BasicPermissionMap implements PermissionMapInterface
|
|||||||
const PERMISSION_MASTER = 'MASTER';
|
const PERMISSION_MASTER = 'MASTER';
|
||||||
const PERMISSION_OWNER = 'OWNER';
|
const PERMISSION_OWNER = 'OWNER';
|
||||||
|
|
||||||
private $map = array(
|
protected $map;
|
||||||
self::PERMISSION_VIEW => array(
|
|
||||||
MaskBuilder::MASK_VIEW,
|
|
||||||
MaskBuilder::MASK_EDIT,
|
|
||||||
MaskBuilder::MASK_OPERATOR,
|
|
||||||
MaskBuilder::MASK_MASTER,
|
|
||||||
MaskBuilder::MASK_OWNER,
|
|
||||||
),
|
|
||||||
|
|
||||||
self::PERMISSION_EDIT => array(
|
public function __construct()
|
||||||
MaskBuilder::MASK_EDIT,
|
{
|
||||||
MaskBuilder::MASK_OPERATOR,
|
$this->map = array(
|
||||||
MaskBuilder::MASK_MASTER,
|
self::PERMISSION_VIEW => array(
|
||||||
MaskBuilder::MASK_OWNER,
|
MaskBuilder::MASK_VIEW,
|
||||||
),
|
MaskBuilder::MASK_EDIT,
|
||||||
|
MaskBuilder::MASK_OPERATOR,
|
||||||
self::PERMISSION_CREATE => array(
|
MaskBuilder::MASK_MASTER,
|
||||||
MaskBuilder::MASK_CREATE,
|
MaskBuilder::MASK_OWNER,
|
||||||
MaskBuilder::MASK_OPERATOR,
|
),
|
||||||
MaskBuilder::MASK_MASTER,
|
|
||||||
MaskBuilder::MASK_OWNER,
|
self::PERMISSION_EDIT => array(
|
||||||
),
|
MaskBuilder::MASK_EDIT,
|
||||||
|
MaskBuilder::MASK_OPERATOR,
|
||||||
self::PERMISSION_DELETE => array(
|
MaskBuilder::MASK_MASTER,
|
||||||
MaskBuilder::MASK_DELETE,
|
MaskBuilder::MASK_OWNER,
|
||||||
MaskBuilder::MASK_OPERATOR,
|
),
|
||||||
MaskBuilder::MASK_MASTER,
|
|
||||||
MaskBuilder::MASK_OWNER,
|
self::PERMISSION_CREATE => array(
|
||||||
),
|
MaskBuilder::MASK_CREATE,
|
||||||
|
MaskBuilder::MASK_OPERATOR,
|
||||||
self::PERMISSION_UNDELETE => array(
|
MaskBuilder::MASK_MASTER,
|
||||||
MaskBuilder::MASK_UNDELETE,
|
MaskBuilder::MASK_OWNER,
|
||||||
MaskBuilder::MASK_OPERATOR,
|
),
|
||||||
MaskBuilder::MASK_MASTER,
|
|
||||||
MaskBuilder::MASK_OWNER,
|
self::PERMISSION_DELETE => array(
|
||||||
),
|
MaskBuilder::MASK_DELETE,
|
||||||
|
MaskBuilder::MASK_OPERATOR,
|
||||||
self::PERMISSION_OPERATOR => array(
|
MaskBuilder::MASK_MASTER,
|
||||||
MaskBuilder::MASK_OPERATOR,
|
MaskBuilder::MASK_OWNER,
|
||||||
MaskBuilder::MASK_MASTER,
|
),
|
||||||
MaskBuilder::MASK_OWNER,
|
|
||||||
),
|
self::PERMISSION_UNDELETE => array(
|
||||||
|
MaskBuilder::MASK_UNDELETE,
|
||||||
self::PERMISSION_MASTER => array(
|
MaskBuilder::MASK_OPERATOR,
|
||||||
MaskBuilder::MASK_MASTER,
|
MaskBuilder::MASK_MASTER,
|
||||||
MaskBuilder::MASK_OWNER,
|
MaskBuilder::MASK_OWNER,
|
||||||
),
|
),
|
||||||
|
|
||||||
self::PERMISSION_OWNER => array(
|
self::PERMISSION_OPERATOR => array(
|
||||||
MaskBuilder::MASK_OWNER,
|
MaskBuilder::MASK_OPERATOR,
|
||||||
),
|
MaskBuilder::MASK_MASTER,
|
||||||
);
|
MaskBuilder::MASK_OWNER,
|
||||||
|
),
|
||||||
|
|
||||||
|
self::PERMISSION_MASTER => array(
|
||||||
|
MaskBuilder::MASK_MASTER,
|
||||||
|
MaskBuilder::MASK_OWNER,
|
||||||
|
),
|
||||||
|
|
||||||
|
self::PERMISSION_OWNER => array(
|
||||||
|
MaskBuilder::MASK_OWNER,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
Reference in New Issue
Block a user