Custom User Properties API/Admin view

Hello again.

I noticed that when you are logged in into Squidex and go to your profile settings in the top right you can add custom properties to your user account. Couldnt find it on forums or docs. So I have 2 questions:

  1. Is there a way to do it for other accounts via API or some settings screen AND are you be able to get those properties to use them for some application logic? I wasn’t able to find any information on that.

  2. Furthermore can you use those properties somehow in the Schema->Scripts? (for example ctx.user.properties). In the description of the custom properties it says that you can but again couldn’t find any more information on that.

Our use case:
We have several translators that are able to edit content. But we don’t want them to be editing the other languages than the ones they can actually translate (e.g. we don’t want a person who speaks english and spanish to edit a) the original english text and b) to edit russian for example). So if the above is possible we would assign each user/translator a property languages where we would store the languages they can edit and then use Schema->Scripts to check if the translator changed the other ones and if yes then block the update.

Right now we are thinking of using seperate roles like “editor_es, editor_rs” to determine their translating capabilities and we can block the update actions based on that role. But this is kind of prone to errors and not very flexible since if the person can translate more languages we would have to create a new role let’s say “editor_es_rs”.

Or if you have any other suggestion how to go about this it would be greatly appreciated!
Thank you in advance!

I think properties are accessible directly as ctx.user.myproperty, but I would not recommend that. Only the user itself can add his properties and it would be a really bad security restriction if the user himself can decide what he wants to do.

Right now there is no good solution, unfortunately.

Ok thanks for the quick reply. Is there some feature planned or even considered?

We can talk about it …

1 Like

Thanks for considering it! We will now go with the named roles which seems like the best solution currently for the problem we have. If there is some development in this topic it would be great to hear! Thanks again.

If anyone has a similar problem here is how we got around the limitations:

  1. We created a new schema called “user” with fields: “email, role, languages[tag field]”
  2. We send a webhook on every change in users content
  3. We execute a function on webhook that calls Squidex API and creates a specific role based on role and languages field and than creates a contributor with that specific role. The role name for us is for example “Editor_en” for people who can edit english. If a user has more languages the role would be “Editor_en_es_ru”
  4. Then in scripts we parse the role name and check if the role has the specific language and can edit

it is not an ideal solution but it is an automated solution and works rather well at least in our tests.