-
Notifications
You must be signed in to change notification settings - Fork 821
/
Permission_Group.php
70 lines (61 loc) · 1.81 KB
/
Permission_Group.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace SilverStripe\Security;
/**
* Permission_Group class
*
* This class is used to group permissions together for showing on an
* interface.
*/
class Permission_Group
{
/**
* Name of the permission group (can be used as label in an interface)
* @var string
*/
protected $name;
/**
* Associative array of permissions in this permission group. The array
* indices are the permission codes as used in
* {@link Permission::check()}. The value is suitable for using in an
* interface.
* @var string
*/
protected $permissions = [];
/**
* Constructor
*
* @param string $name Text that could be used as label used in an
* interface
* @param array $permissions Associative array of permissions in this
* permission group. The array indices are the
* permission codes as used in
* {@link Permission::check()}. The value is
* suitable for using in an interface.
*/
public function __construct($name, $permissions)
{
$this->name = $name;
$this->permissions = $permissions;
}
/**
* Get the name of the permission group
*
* @return string Name (label) of the permission group
*/
public function getName()
{
return $this->name;
}
/**
* Get permissions
*
* @return array Associative array of permissions in this permission
* group. The array indices are the permission codes as
* used in {@link Permission::check()}. The value is
* suitable for using in an interface.
*/
public function getPermissions()
{
return $this->permissions;
}
}