You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: