-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPermissionAlways.php
53 lines (45 loc) · 1.54 KB
/
PermissionAlways.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
<?php
declare(strict_types=1);
/*
* This file is part of the Zikula package.
*
* Copyright Zikula - https://ziku.la/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Zikula\PermissionsModule;
use Zikula\PermissionsModule\Api\ApiInterface\PermissionApiInterface;
/**
* This class exists for testing and to ensure a functional Api is provided in a default situation.
* ALL hasPermission tests return TRUE regardless of settings.
* Access level names are returned untranslated.
* Permissions cannot be reset for a user.
*/
class PermissionAlways implements PermissionApiInterface
{
public function hasPermission(string $component = null, string $instance = null, int $level = ACCESS_NONE, int $user = null): bool
{
return true;
}
public function accessLevelNames(int $level = null)
{
$accessNames = [
ACCESS_INVALID => 'Invalid',
ACCESS_NONE => 'No access',
ACCESS_OVERVIEW => 'Overview access',
ACCESS_READ => 'Read access',
ACCESS_COMMENT => 'Comment access',
ACCESS_MODERATE => 'Moderate access',
ACCESS_EDIT => 'Edit access',
ACCESS_ADD => 'Add access',
ACCESS_DELETE => 'Delete access',
ACCESS_ADMIN => 'Admin access',
];
return isset($level) ? $accessNames[$level] : $accessNames;
}
public function resetPermissionsForUser(int $uid): void
{
// nothing to do
}
}