Hello everyone, I'm currently developing a role-based access system that can be configured through a dashboard. I've added a custom field (as shown in the image) and successfully saved the data in JSON format to the database. However, I'm encountering an issue where the selected permissions for a particular role (in this case, the Editor role) are not repopulated when I check it again. Can someone please assist me with a solution to repopulating the data in the custom field? While I'm aware that I can use Axios or fetch to retrieve the data, I'm wondering if there's an alternative method available. Thank you.
UPDATE: I have resolved the problem. The updated value will be passed as a parameter to the 'useField' hook. I neglected to verify this initially, and it was my error
wow nice work, do you have some url for this?
@.villainbehindglasses how did you go about implementing this. Do you have a gist or repo of it?
I haven't created a repository yet as I'm still conducting some research and development. However, I have implemented a custom field that stores a JSON object in the database and created a function to check the permissions from the JSON and assign them to the collection's permission. I plan to convert this implementation into a plugin, (I hope I can). Once completed, I will share the plugin with all of you.
Great stuff @.villainbehindglasses
Do keep me updated and let me know if there is anything I can do to help
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.