Prevent contributors from editing.

I’ve try various of contributors roles and permission but somehow I was unable to prevent my contributor from writing over the database collection in live. Can anyone please show me how to prevent contributors from writing over the database collection. Let me know what type of contributor’s role and what permission to use. Any help will be greatly appreciated.

I did posted for help in the Wix support. But they insisted that contributors of my site have full access to my database. They also said that I can create a page with permission to prevent any members from accessing the page. But the contributor can always log in to the live database and edit. I kind of like what JD’s suggestion but not sure what code to write. Sorry I’ve very little knowledge about code. Any help will be greatly appreciated.

You can crate a beforeUpdate hook:
https://www.wix.com/corvid/reference/wix-data.Hooks.html#beforeUpdate
(or also beforeInsert, and beforeRemove if you want to prevent these as well),
if you want you can create a list of banned members and compare the current user to them to the current userId in the hook context:
https://www.wix.com/corvid/reference/wix-data.Hooks.html#HookContext
If it fits to the condition, you return item, else you return Promise.reject();

But you can set a contributor as non-admin and he/her won’t be able to edit. This is easier.
Use the code only if you want a contributer to be Admin and yet you want to prevent him from editing a specific collection.

Yes, I want my contributors to be able to read but not write. Unfortunately my contributors are also the owners but not very computer savvy and make many mistakes.

Why don’t you define them as “Back Office Managers” instead of Admins?
https://support.wix.com/en/article/about-roles-permissions-contributors

Back Office Managers role can also edit the live database. In fact, I’ve try all the contributor roles they all can edit live database.

So go for the code :slight_smile: