Create User Groups

Hi there :slight_smile:

I want to order the system users in groups - for example, 30 users are in 10 different stores/offices/etc - and we want to group them in the order of where they are:

Group1:

  • Employer 1
  • Employer 2

Group2:

  • Employer 3
  • Employer 4

Is it possible to create a custom field for the system user? For example ā€œStore Nameā€ or ā€œGroupā€?
If not - is there a way this can be achieved? :slight_smile:

Thank you,
Jorge Matias

Hi @jmatias,

You can achieve this by utilizing custom roles in the Admin app.
For example, you could create roles such as system_user_role and store_user_role, and then assign users to these roles accordingly.

Thanks,
Mumbi Francis

Thatā€™s what I was thinking / but they are all ā€œStore Assistantsā€, who work in different stores :slight_smile:

But for now, thatā€™s what I will do - different role names with the same privileges :slight_smile:

Thank you
JMatias

Edit: Iā€™ll take a look into the contextual roles - Contextual Role Evaluation :: Corteza Docs

Following the Contextual Role Evaluation - can we use ā€œresource.createdBy == userIDā€ and write down 2 or 3 IDs - and that role could see records created by X | Y | Z recordsā€™

JMatias

Can the user grouping be achieved with the API?

For example - I would create a new module, with all the stores listed (with Store name, location, etc);

Then I would make an API request on ā€˜/api/systems/users/{userID}ā€™ including a custom field in the payload that references the Store ID from the Stores module created first:

{
  "userID": "12345",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "meta": {
    "storeID": "store-abc"
  }
}

Then I would compose a new View with prefilters of the ā€œstoreIDā€ value of the logged-in user;

Is this possible to be achieved? I will try to - but I have some doubts about the prefilters for the views :slight_smile:

Has someone tried this? Iā€™ll keep this updated if I can successfully do this :slight_smile:

JMatias