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

Mixed responsibilities between ownership (campgrounds or comments) and admin role #9

Open
jpcarreira opened this issue Aug 1, 2018 · 0 comments

Comments

@jpcarreira
Copy link

I've just watched the youtube tutorial on adding admin role and I wanted to know if there's a more elaborate solution to separate the concerns between owning a campground (or comment) and being an admin role.

The solution presented, where you check is the user is an admin in the middleware to check user's campground ownership and comment ownership, works and is a nice fix but I think it violates a bit what that middleware is supposed to do, which is just checking who owns the campground or comment. Besides, image that I wanted an admin to just delete the campground but not editing it, this solution wouldn't work.

So, my question is: what's a more elaborate way to keep a clear separation of concerns between checking for ownership and checking for admin role? I tried to make my own middleware to check for admin role but then I don't know how can I make both middleware work in the same rate.

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

1 participant