File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
src/components/authorization/policies/conditions Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ module default {
2
2
global currentActorId: uuid ;
3
3
global currentActor := (select Actor filter .id = global currentActorId);
4
4
global currentUser := (select User filter .id = global currentActorId);
5
-
5
+ global currentRoles := (global currentActor).roles;
6
+
6
7
scalar type ReportPeriod extending enum < Monthly, Quarterly> ;
7
8
8
9
# Helper function to workaround native support for sort ignoring accents
Original file line number Diff line number Diff line change @@ -21,17 +21,11 @@ export class RoleCondition implements Condition {
21
21
return 'false' ;
22
22
}
23
23
24
- setupEdgeQLContext ( { namespace } : AsEdgeQLParams < any > ) {
25
- const User = fqnRelativeTo ( 'default::User' , namespace ) ;
26
- const currentUserId = fqnRelativeTo ( 'default::currentUserId' , namespace ) ;
27
- return {
28
- givenRoles : `(<${ User } >(global ${ currentUserId } )).roles` ,
29
- } ;
30
- }
31
-
32
24
asEdgeQLCondition ( { namespace } : AsEdgeQLParams < any > ) {
25
+ const currentRoles =
26
+ 'global ' + fqnRelativeTo ( 'default::currentRoles' , namespace ) ;
33
27
const roleType = fqnRelativeTo ( 'default::Role' , namespace ) ;
34
- return eqlDoesIntersect ( 'givenRoles' , this . allowed , roleType ) ;
28
+ return eqlDoesIntersect ( currentRoles , this . allowed , roleType ) ;
35
29
}
36
30
37
31
union ( this : void , conditions : this[ ] ) {
You can’t perform that action at this time.
0 commit comments