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

Access control + CRUD + User/Admin (OWN/ANY) profile #36

Open
michalfordonski opened this issue Jul 1, 2020 · 6 comments
Open

Access control + CRUD + User/Admin (OWN/ANY) profile #36

michalfordonski opened this issue Jul 1, 2020 · 6 comments

Comments

@michalfordonski
Copy link

Hi,
how to connect this repo with CRUD (https://github.com/nestjsx/crud)?
OWN / ANY is a problem displaying the profile. I would like ADMIN to be able to see all the profiles and USER only his own - both views would be based on the same method in CRUD. How to make roles detect if an object in the database is added by a logged in user or someone else?

@ruslanguns
Copy link
Contributor

This is a matter of using the decorators overriding each methods OR using the built in permissions which you can find right there:

https://github.com/nestjsx/crud/wiki/Controllers#additional-decorators

@zealotrahl
Copy link

@ruslanguns, So, there is no direct way to to integrate nest-access-control ACGuard with nestjsx / crud ?, I must override CRUD generated methods or wirte my custom guard?

@ruslanguns
Copy link
Contributor

ruslanguns commented Aug 27, 2020 via email

@zealotrahl
Copy link

Yup, thanks, I guess they specially left https://github.com/nestjsx/crud/wiki/Controllers#additional-decorators for this.

@ibnukipa
Copy link

ibnukipa commented Sep 6, 2020

Hi @zealotrahl, How did you integrate it with @nestjsx/crud? did you create your own ACLGuard?

@zealotrahl
Copy link

Hi @zealotrahl, How did you integrate it with @nestjsx/crud? did you create your own ACLGuard?

Hi, Yup, like translating crud requests for ACL guard requests, and that did it
const translations = { 'Read-Many': 'readAny', 'Read-All': 'readAny', 'Read-One': 'readAny', 'Create-One': 'createAny', 'Create-Many': 'createAny', 'Update-One': 'updateAny', 'Replace-One': 'updateAny', 'Delete-One': 'deleteAny', };

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

No branches or pull requests

4 participants