CromwellCMS / Cromwell

WordPress-like CMS for Next.js websites
https://cromwellcms.com
MIT License
699 stars 98 forks source link

Custom user roles and permissions #192

Open faierbol opened 2 years ago

faierbol commented 2 years ago

I would like to see an option to create some customer roles with granulated permissions.

Example of what i would like to see, basically an admin will be able to:

Example of roles:

robodove commented 2 years ago

this is being worked on right now #194

please comment on the pr and explain if that specification fits your use cases

eilrix commented 2 years ago

Thanks, fair requirements! I'll work on my PR to add signup role and custom fields features. @faierbol can you pls explain the part:

select which fields will be used when signup

How do we use them?

eilrix commented 2 years ago

@playrich any entity has isEnabled flag. You can use it on the frontend to disable the role. I'll configure backend to reject such role for auth

faierbol commented 2 years ago

Thanks, fair requirements! I'll work on my PR to add signup role and custom fields features. @faierbol can you pls explain the part:

select which fields will be used when signup

How do we use them?

i was thinking as follows: create a role > assign permissions > chose if this role can be used when registering the site, basically ïsEnabledForRegistering field or something like this.

faierbol commented 2 years ago

besides permissions we would be able to select or create new fields for this role like instead of name a custom role will have company name, now when creating a custom role the entire flow will be as follows: create. anew role > assign permissions > create or select existing fields (username, name, password etc) > chose if this role can be used when registering the site, basically ïsEnabledForRegistering > chose what fields will be displayed when registering on the frontend signup form, if registration is enabled for this role

robodove commented 2 years ago

besides permissions we would be able to select or create new fields for this role like instead of name a custom role will have company name, now when creating a custom role the entire flow will be as follows: create. anew role > assign permissions > create or select existing fields (username, name, password etc) > chose if this role can be used when registering the site, basically ïsEnabledForRegistering > chose what fields will be displayed when registering on the frontend signup form, if registration is enabled for this role

this is theme related and theme authors can implement this feature

the cms itself will be able to handle this case

signup forms on the theme are something that the base system should not care about

eilrix commented 2 years ago

@playrich right, theme authors can configure these forms. Another part of the question is what roles backend should accept for signup. Right now there's one signup role customer, but after refactor this role can be removed and created several new.

So we need to have isEnabledForRegistering in roles table, or maybe have a list of these roles in CMS settings?