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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.