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