File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed
Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -151,9 +151,30 @@ public function extractPermissionParts(string $string): array
151151
152152 $ result = [];
153153 foreach ($ matches as $ match ) {
154+ $ action = $ match [1 ];
155+ $ roleString = $ match [2 ];
156+
157+ $ role = null ;
158+ $ id = null ;
159+ $ innerRole = null ;
160+
161+ if (strpos ($ roleString , ': ' ) !== false ) {
162+ $ role = explode (': ' , $ roleString , 2 )[0 ];
163+ $ idString = explode (': ' , $ roleString , 2 )[1 ];
164+
165+ if (strpos ($ idString , '/ ' ) !== false ) {
166+ $ id = explode ('/ ' , $ idString , 2 )[0 ];
167+ $ innerRole = explode ('/ ' , $ idString , 2 )[1 ];
168+ }
169+ } else {
170+ $ role = $ roleString ;
171+ }
172+
154173 $ result [] = [
155- 'action ' => $ match [1 ],
156- 'role ' => $ match [2 ]
174+ 'action ' => $ action ,
175+ 'role ' => $ role ,
176+ 'id ' => $ id ?? null ,
177+ 'innerRole ' => $ innerRole
157178 ];
158179 }
159180
You can’t perform that action at this time.
0 commit comments