VigneshDevHub / CampX

"CampX: Discover and share the best campgrounds across Globe, where adventure meets community."
https://campx-f9sv.onrender.com
MIT License
10 stars 13 forks source link

[FEATURE]Idea flow related to Adding Admin feature #5 #14

Open preranah7 opened 1 week ago

preranah7 commented 1 week ago

Hi ,I am interested in solving this issue. Here what we can do is edit the user model containing email and role. Role can have two values : user and admin. (The roles will not get asked during the signup form filling, default value will be user) To make the role as admin, the maintainer/admin of the site should be the first to register/signup Through mongoose it is possible and I would like contributing to implement this logic, if there is a single maintainer/admin. While authorizing, we can give the user who owns the camp information card and user with role : admin ,access for edit and delete buttons. Kindly let me know if there are multiple admins/maintainers. Thankyou. Issue #5

Vignesh025 commented 1 week ago

Hi @preranah7 ,

Thank you for your interest in solving this issue and for the detailed proposal. Your approach aligns well with what we are looking for, particularly the logic around assigning roles and authorizing actions like edit and delete.

However, we require the admin feature to support multiple administrators. If you have any suggestions on how this could be extended to accommodate multiple admins while retaining the core functionality, we would greatly appreciate your input.

Thank you again for your contribution, and I look forward to hearing your thoughts.

preranah7 commented 1 week ago

For multiple admins suggested workflow is

Vignesh025 commented 6 days ago

Hey @preranah7 ,

Let's proceed with the idea of adding the role field in the schema, with "user" as the default value. This role can be updated by the first admin directly through the database.

For the roles, the permissions should be structured as follows:

User:

Admin:

This should give us a clear distinction between the two roles and the permissions they hold.

Looking forward to seeing your implementation!

preranah7 commented 6 days ago

Sure @Vignesh025. Thankyou.