Hi I want to assign a role to a user permanently in my software. And i need to this programmatically. Can anyone help me out? I tried the addRole function in IUsers but this is just temporary i think. Best regards Florian

asked 30.06.2016 at 15:33

Florian%20Hitz's gravatar image

Florian Hitz
accept rate: 0%


You can asign a role to a user by executing the following script:

import ch.ivyteam.ivy.security.ISecurityContext;
import ch.ivyteam.ivy.security.IUser;
import ch.ivyteam.ivy.security.IRole;

ISecurityContext securityContext = ivy.wf.getApplication().getSecurityContext();
IUser user = securityContext.findUser("myUser");
IRole role = securityContext.findRole("myRole");

This will assign the role permanantely to the user.

Note that the role assignment is not forwarded automatically to sessions of the user. The user has to log out and login again so that he can act as the role.


answered 01.07.2016 at 10:46

Reto%20Weiss's gravatar image

Reto Weiss ♦♦
accept rate: 74%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 30.06.2016 at 15:33

Seen: 1,123 times

Last updated: 01.07.2016 at 10:46