1 | <?php |
||
21 | class CapabilitiesChecker |
||
22 | { |
||
23 | |||
24 | /** |
||
25 | * @type \EE_Capabilities $capabilities |
||
26 | */ |
||
27 | private $capabilities; |
||
28 | |||
29 | |||
30 | |||
31 | /** |
||
32 | * CapabilitiesChecker constructor |
||
33 | * |
||
34 | * @param \EE_Capabilities $capabilities |
||
35 | */ |
||
36 | public function __construct(\EE_Capabilities $capabilities) |
||
40 | |||
41 | |||
42 | |||
43 | /** |
||
44 | * @return \EE_Capabilities |
||
45 | */ |
||
46 | protected function capabilities() |
||
50 | |||
51 | |||
52 | |||
53 | /** |
||
54 | * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
||
55 | * If any of the individual capability checks fails, then the command will NOT be executed. |
||
56 | * |
||
57 | * @param CapCheckInterface|CapCheckInterface[] $cap_check |
||
58 | * @return bool |
||
59 | * @throws InvalidClassException |
||
60 | * @throws InsufficientPermissionsException |
||
61 | */ |
||
62 | public function processCapCheck($cap_check) |
||
94 | |||
95 | |||
96 | |||
97 | /** |
||
98 | * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
||
99 | * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
||
100 | * @param int $ID - (optional) ID for item where current_user_can is being called from |
||
101 | * @return bool |
||
102 | */ |
||
103 | public function process($capability, $context, $ID = 0) |
||
107 | |||
108 | |||
109 | |||
110 | } |
||
111 | // End of file CapabilitiesChecker.php |
||
112 | // Location: /CapabilitiesChecker.php |