Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: provide ability to define requirements against generic GetById and List queries #58

Open
fabiomaistro opened this issue Jun 23, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@fabiomaistro
Copy link
Collaborator

At the moment the only way to protect a Command or Query with an AuthorizationRequirement is applying an Attribute to the class representing that Command Or Query:
https://github.com/onebeyond/onebeyond-studio-core/blob/main/src/OneBeyond.Studio.Domain.SharedKernel/Authorization/AuthorizationPolicyAttribute.cs

However this prevents the possibility of using the generic GetById and List queries that are already available in OneBeyond Studio Core and limit the reusability of the dedicated generic handlers.

A possible implementation could be a sort of fluent configuration where a user can specify that for a MediatR IRequest there is an authorisation requirement applied (a bit like Automapper):

For(typeof(GetById<SomeEntityDto, SomeEntity, Guid>)).ApplyRequirement(typeof(MyPermissionRequirement));

@fabiomaistro fabiomaistro added the enhancement New feature or request label Jun 23, 2023
@fabiomaistro
Copy link
Collaborator Author

FYI @andrii-kaplanovskyi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant