NullPermissionManager.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\security\impl;
12 
14 
15 /**
16  * NullPermissionManager acts like an absent PermissionManager.
17  *
18  * @author ingo herwig <ingo@wemove.com>
19  */
21 
22  private static $policies = [
23  'allow' => [],
24  'deny' => [],
25  'default' => true
26  ];
27 
28  /**
29  * @see PermissionManager::authorize()
30  */
31  public function authorize($resource, $context, $action, $login=null, $applyDefaultPolicy=true) {
32  return true;
33  }
34 
35  /**
36  * @see PermissionManager::addTempPermission()
37  */
38  public function addTempPermission($resource, $context, $action) {
39  }
40 
41  /**
42  * @see PermissionManager::removeTempPermission()
43  */
44  public function removeTempPermission($handle) {
45  }
46 
47  /**
48  * @see PermissionManager::hasTempPermission()
49  */
50  public function hasTempPermission($resource, $context, $action) {
51  return true;
52  }
53 
54  /**
55  * @see PermissionManager::clearTempPermissions()
56  */
57  public function clearTempPermissions() {
58  }
59 
60  /**
61  * @see PermissionManager::getPermissions()
62  */
63  public function getPermissions($resource, $context, $action) {
64  return self::$policies;
65  }
66 
67  /**
68  * @see PermissionManager::setPermissions()
69  */
70  public function setPermissions($resource, $context, $action, $permissions) {
71  }
72 
73  /**
74  * @see PermissionManager::createPermission()
75  */
76  public function createPermission($resource, $context, $action, $role, $modifier) {
77  return false;
78  }
79 
80  /**
81  * @see PermissionManager::removePermission()
82  */
83  public function removePermission($resource, $context, $action, $role) {
84  return false;
85  }
86 }
87 ?>
removePermission($resource, $context, $action, $role)
PermissionManager implementations are used to handle all authorization requests.
authorize($resource, $context, $action, $login=null, $applyDefaultPolicy=true)
setPermissions($resource, $context, $action, $permissions)
createPermission($resource, $context, $action, $role, $modifier)
NullPermissionManager acts like an absent PermissionManager.