Assign record to specific user

4 posts by 2 authors in: Forums > CMS Builder
Last Post: January 6, 2022   (RSS)

By andreasml - December 6, 2021

Hi

I would like to let the administrator of a CMSB database, to be able to assign a record from one section to one or more users (chosen from the list of users). This way, when each user is logged in with his personal username/password and opens this section, he/she will be able to see and edit the record(s) that the administrator has assigned for him/her. 

Any ideas on how to do it?

Kind regards,

Andreas Lazaris

By andreasml - January 5, 2022

Hi Daniel

Thank you for your reply and your advice. Although yes, being able to assign multiple users is a necessity for my task, I very much appreciate your suggestion on changing user by the "Created" field.

Regarding your questions:

  • "Are the users logging into the CMSB admin, or are they logging into front-end pages?" - Yes the users login into the CMSB
  • "Are you using the Website Membership plugin?"-Yes,  I am.
  • "If yes, what is the "WSM_ACCOUNTS_TABLE" option set to in the plugin?" - Yes, and the "WSM_ACCOUNTS_TABLE" option is set to "accounts"

Regards, 

Andreas

By daniel - January 6, 2022 - edited: January 6, 2022

Hi Andreas,

Something like this should be possible, but it will require some custom programming. I would do something along these lines:

  1. Create a multi-select field to the section that points at the accounts table, so you can select multiple users
  2. For users that you want to have the limited access to the section assign the "Author" permission
  3. Set up a custom plugin that uses the "record_access_where" filter to add a filtering condition for that section, checking to see if the currently logged in user has been assigned to the new field.

This is a bit too involved for me to fully detail on the forum, but if you have any specific questions about these steps I'll do my best to answer! Or if you'd like some hands-on assistance we're always happy to provide an estimate for the work: https://www.interactivetools.com/estimate/

Thanks,

Daniel
Technical Lead
interactivetools.com