1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Admin\Authorization; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Admin\Databases\Queries\AdminResourceAuthLoader as AuthLoader; |
8
|
|
|
use Casbin\Exceptions\CasbinException; |
9
|
|
|
use Casbin\Model\Model; |
10
|
|
|
use Casbin\Persist\Adapter as CasbinAdapter; |
11
|
|
|
|
12
|
|
|
class AdminResourceProvider implements CasbinAdapter |
13
|
|
|
{ |
14
|
|
|
use PolicyProviderTrait; |
15
|
|
|
|
16
|
|
|
protected const PREFIX = 'admin_resource'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* AdminResourceProvider constructor. |
20
|
|
|
* |
21
|
|
|
* @param AuthLoader $authLoader |
22
|
|
|
*/ |
23
|
|
|
public function __construct(AuthLoader $authLoader) |
24
|
|
|
{ |
25
|
|
|
$this->authLoader = $authLoader; |
26
|
|
|
$this->prefix = static::PREFIX; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
31
|
|
|
* |
32
|
|
|
* @param Model $model |
33
|
|
|
* |
34
|
|
|
* @throws CasbinException |
35
|
|
|
*/ |
36
|
|
|
public function savePolicy(Model $model): void |
37
|
|
|
{ |
38
|
|
|
throw new CasbinException('not implemented'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
43
|
|
|
* |
44
|
|
|
* @param string $sec |
45
|
|
|
* @param string $ptype |
46
|
|
|
* @param array $rule |
47
|
|
|
* |
48
|
|
|
* @throws CasbinException |
49
|
|
|
*/ |
50
|
|
|
public function addPolicy(string $sec, string $ptype, array $rule): void |
51
|
|
|
{ |
52
|
|
|
throw new CasbinException('not implemented'); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
57
|
|
|
* |
58
|
|
|
* @param string $sec |
59
|
|
|
* @param string $ptype |
60
|
|
|
* @param array $rule |
61
|
|
|
* |
62
|
|
|
* @throws CasbinException |
63
|
|
|
*/ |
64
|
|
|
public function removePolicy(string $sec, string $ptype, array $rule): void |
65
|
|
|
{ |
66
|
|
|
throw new CasbinException('not implemented'); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @SuppressWarnings(PHPMD.UnusedFormalParameter) |
71
|
|
|
* |
72
|
|
|
* @param string $sec |
73
|
|
|
* @param string $ptype |
74
|
|
|
* @param int $fieldIndex |
75
|
|
|
* @param string ...$fieldValues |
76
|
|
|
* |
77
|
|
|
* @throws CasbinException |
78
|
|
|
*/ |
79
|
|
|
public function removeFilteredPolicy(string $sec, string $ptype, int $fieldIndex, string ...$fieldValues): void |
80
|
|
|
{ |
81
|
|
|
throw new CasbinException('not implemented'); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|