File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,29 @@ class TestAclController extends ControllerBase {
6262}
6363```
6464
65+ #### Overriding
66+ It is necessary to override the _ getRole method so that it returns the role of the active user:
67+
68+ ``` php
69+ namespace controllers;
70+ use Ubiquity\attributes\items\acl\Resource;
71+ use Ubiquity\attributes\items\acl\Allow;use Ubiquity\utils\http\USession;
72+ use Ubiquity\utils\http\USession;
73+
74+ #[Resource('Main')]
75+ #[Allow(role: '@USER')]
76+ class TestAclController extends ControllerBase {
77+ use AclControllerTrait;
78+
79+ public function _getRole(){
80+ $activeUser=USession::get('activeUser');
81+ if(isset($activeUser)){
82+ return $activeUser->getRole();
83+ }
84+ }
85+ }
86+ ```
87+
6588### Defining ACLs with Database
6689The ACLs defined in the database are additional to the ACLs defined via annotations or attributes.
6790
You can’t perform that action at this time.
0 commit comments