Jump to content
Torsten Baldes

"Force" addRole to user via API

Recommended Posts

Hi,

I'm using IftRunner (https://github.com/ryancramerdesign/IftRunner) to update/change the roles of a user based on a selection in the user profile.

Example:

The field "location" has multiple cities (city1,city2,city3) and when the user changes this field from "city1" to "city2", he should get the role "admin_city2", which can access and edit users with the role "usergroup_city2".

Unfortunately the api call "addRole" seems to check, if the current user has the permissions to assign this role.  Since he has only the role "admin_city1", he can't change his role to "admin_city2". 

Is there a way to "force" the api to do this, even when the current user doesn't have the permissions?

 

Thanks!

Share this post


Link to post
Share on other sites

Why not add the new role to the user and then remove his/her other role?

Share this post


Link to post
Share on other sites
19 hours ago, Sergio said:

Why not add the new role to the user and then remove his/her other role?

thanks for your suggestion. unfortunately "admin_city1" has also no access to users with "admin_city2". so it doesn't matter if I change the order. 

Share this post


Link to post
Share on other sites

Hum, I think you have a similar problem I related here: 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...