How to assign a role via API instead of rule (e. g. make user admin)?

Everything I’ve found for rules and permissions so far is always done via rules, which run after successful auth. But what if I for example want to:

  • create a new user
  • assign a “editor” role to the user upon creation?

A rule wouldn’t be the right thing to do here. I’m sure there’s a way to run something like a rule on command? So to feed in the type of role I want to set for the user?

You could use a hook.

1 Like