<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Old userrole mapping still remain after renaming role</title><link>https://answers.axonivy.com/questions/3224/old-userrole-mapping-still-remain-after-renaming-role</link><description>&lt;p&gt;Hi ivyteam&lt;/p&gt;
&lt;p&gt;In my project, i have the role name &lt;code&gt;Front RM&lt;/code&gt; and i assign some users for it. Then some version later i rename that role to &lt;code&gt;FrontRM&lt;/code&gt; (remove space). That mean all users will be mapped to &lt;code&gt;FrontRM&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Now i use &lt;code&gt;ivy.session.getSessionUser().getRoles()&lt;/code&gt; but it always say that user has two roles &lt;code&gt;Front RM&lt;/code&gt; and &lt;code&gt;FrontRM&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I've investigated then see that there still remain old mapping between user and old role. That's mean when i rename a role, ivy actually add a new role with new name and keep old one with mapping.  I explained in this picture:
&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/Untitled_ksSIFXV.png"&gt;&lt;/p&gt;
&lt;p&gt;Some questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Why ivy still keep old role + old mapping? it's because of multiple PMVs? But in case there is only one PMVs so could ivy remove unnecessary role completely?&lt;/li&gt;
&lt;li&gt;Does api &lt;code&gt;ivy.session.getSessionUser().getRoles()&lt;/code&gt; return correct roles as it display on Admin Tool? If not can i base on any flag to remove that &lt;code&gt;inactive&lt;/code&gt; role?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Thanks&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3224/old-userrole-mapping-still-remain-after-renaming-role" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 23 Apr 2018 03:44:34 -0400</lastBuildDate><item><title>Answer by Alex Suter</title><link>https://answers.axonivy.com/questions/3224/old-userrole-mapping-still-remain-after-renaming-role/3232</link><description>&lt;p&gt;Hello &lt;a href="https://answers.axonivy.com/users/118/trungdv"&gt;&lt;a href="https://answers.axonivy.com/users/118/trungdv"&gt;@trungdv&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you only change the &lt;em&gt;Display Name&lt;/em&gt; of the role, then you would not have any problems. In your case I assume that you manually modified the &lt;em&gt;roles.roleconfig&lt;/em&gt; file?&lt;/p&gt;
&lt;p&gt;1) Because you manually changed the identifier of the role. Ivy does not know the "old" role - it can not be properly merged with your new role. You can manually delete this role via API &lt;code&gt;ch.ivyteam.ivy.security.IRole.delete()&lt;/code&gt; -&amp;gt; assigned task to this role are unassigned afterwards.&lt;/p&gt;
&lt;p&gt;2) &lt;code&gt;ivy.session.getSessionUser().getRoles()&lt;/code&gt; returns all roles. In the admin ui you only see the active roles as default. You can change that if you click on &lt;em&gt;Display obsolete Roles&lt;/em&gt; at the bottom. You only can figure out if a role is active via the API &lt;code&gt;ch.ivyteam.ivy.security.ISecurityContext.getActiveRoles()&lt;/code&gt;.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alex Suter</dc:creator><pubDate>Mon, 23 Apr 2018 03:44:34 -0400</pubDate><guid>https://answers.axonivy.com/questions/3224/old-userrole-mapping-still-remain-after-renaming-role/3232</guid></item></channel></rss>