<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Remove User in Axon.Ivy Designer</title><link>https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer</link><description>&lt;p&gt;For a Testcase i need to remove a user on which we have allready Tasks in designer. When I remove the User in User Editor he ist still existing in ISecurityContext.getUsers(). 
Only when i close the designer and reopen it the user is removed. But than also all tasks are away.&lt;/p&gt;
&lt;p&gt;Is there a way to remove the User without closing Axon.Ivy Designer?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 16 Jan 2019 04:40:01 -0500</lastBuildDate><item><title>Answer by Thomas Wirz</title><link>https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer/3617</link><description>&lt;p&gt;For other Visitor thats finally the code I implemented:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public static void deleteUser(String userName) throws EnvironmentNotAvailableException, Exception{
            SecurityManager.getSecurityManager().executeAsSystem(() -&amp;gt; {
                try {
                    IUser user = Ivy.wf().getSecurityContext().findUser(userName);
                    user.getRoles().stream().filter(role -&amp;gt; role.getId() != 1).forEach(role -&amp;gt; user.removeRole(role));
                    Ivy.wf().getSecurityContext().deleteUser(userName);
                }
                catch (Exception ex){
                    Ivy.log().error("error on delete user "+userName,ex);
                }
                return true;
            }); 
    }

public static void addUser(String userName, String displayName,String password, Locale language, String email) throws EnvironmentNotAvailableException, Exception{
    SecurityManager.getSecurityManager().executeAsSystem(() -&amp;gt; {
        try
        {
            IUser user = Ivy.wf().getSecurityContext().createUser(userName, displayName, password, language, email, userName);
            Ivy.wf().getSecurityContext().getActiveRoles().stream().filter(role -&amp;gt; role.getId() != 1).forEach(role -&amp;gt; {
                Ivy.log().fatal(role.getName() +" / " + role.getDisplayName() +" / " +role.getId() +" / ");
                user.addRole(role);
            });
        }catch(Exception ex){
            Ivy.log().error(ex);
        }
        return true;
    });
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Thomas Wirz</dc:creator><pubDate>Wed, 16 Jan 2019 04:40:01 -0500</pubDate><guid>https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer/3617</guid></item><item><title>Answer by Alex Suter</title><link>https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer/3608</link><description>&lt;p&gt;I think the only one way for now is to implement a helper process and calling &lt;code&gt;ch.ivyteam.ivy.security.ISecurityContext.deleteUser(String)&lt;/code&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Mon, 14 Jan 2019 03:37:06 -0500</pubDate><guid>https://answers.axonivy.com/questions/3606/remove-user-in-axon-ivy-designer/3608</guid></item></channel></rss>