1
No good way to fetch permissions or policies in hook extensions
Source: directus/directus#24865 · opened by @u12206050
Describe the Improvement
Before Directus 11, the permissions were available on the context.accountability object.
In Directus 11, this is no longer the case, and looking at the Directus code, the go to approach seems to be making use of these two functions:
As you can see though, neither is actually exported for us developers to use, this above works, but is a hack, and throws type errors.
I am aware the Permissions Items Service is available too query the raw permissions, but looking at these functions they do some smart caching which I think is very beneficial to build on top of, instead of having to reinvent the wheel.
I suggest these two functions are either added asap somewhere so we can make use of them, either via services or utils.
Before Directus 11, the permissions were available on the context.accountability object.
In Directus 11, this is no longer the case, and looking at the Directus code, the go to approach seems to be making use of these two functions:
As you can see though, neither is actually exported for us developers to use, this above works, but is a hack, and throws type errors.
I am aware the Permissions Items Service is available too query the raw permissions, but looking at these functions they do some smart caching which I think is very beneficial to build on top of, instead of having to reinvent the wheel.
I suggest these two functions are either added asap somewhere so we can make use of them, either via services or utils.
No pledges yet. Be the first to back this.
Comments
Similar requests
Configurable hook execution order for extensions
3 votes · 0 comments
Simpler way to get a user's policies needed
1 vote · 0 comments
Add `emitter` to flow extensions
4 votes · 0 comments
Allow extensions to access the configured directus cache
27 votes · 0 comments
Directus Extensions: Provide Settings-Option
6 votes · 0 comments
No comments yet.