<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: PermissionDeniedException when calling iUser.getAllRoles()</title><link>https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles</link><description>&lt;p&gt;My call to &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;aUser.getAllRoles();&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;throws the exception:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;PermissionDeniedException: Session 1 (cuongtruc.tran) is not allowed to call method public java.util.List ch.ivyteam.ivy.security.internal.User.getAllRoles().
   The session does not fulfill the permission rule SESSION (MATCHES THIS AND OWNS UserReadOwnRoles PERMISSION) OR OWNS UserReadRoles PERMISSION OR OWNS UserReadRoles@SYSTEM PERMISSION&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I even tried with grant admin permisson to that user but still throws the same exception.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 26 Feb 2014 15:42:13 -0500</lastBuildDate><item><title>Answer by Raphael Bürgin</title><link>https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles/550</link><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can execute your code with systemUserPermissions using a callable function.
In this Example I get a List of Roles of a User. &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;List&amp;lt;IRole&amp;gt; roles = Ivy.session().getSecurityContext().executeAsSystemUser(new Callable&amp;lt;List&amp;lt;IRole&amp;gt;&amp;gt;(){
            public List&amp;lt;IRole&amp;gt; call() throws Exception {
                List&amp;lt;IRole&amp;gt; roles = iuser.getRoles();
                return roles;
            }

        });
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Raphael Bürgin</dc:creator><pubDate>Wed, 26 Feb 2014 15:42:13 -0500</pubDate><guid>https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles/550</guid></item><item><title>Answer by Tho Tran</title><link>https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles/549</link><description>&lt;p&gt;Login with "Developer" user&lt;/p&gt;
&lt;p&gt;Or&lt;/p&gt;
&lt;p&gt;Grant Developer's permission for your Test User role&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ivy.session.loginSessionUser("Developer","Developer");
ivy.wf.getApplication().getSecurityDescriptor().grantPermissions(ivy.wf.getApplication().getSecurityDescriptor().getSecurityDescriptorType().getRootPermissionGroup(),
                ivy.session.getSecurityContext().findRole("Everybody")
);
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tho Tran</dc:creator><pubDate>Wed, 26 Feb 2014 09:54:57 -0500</pubDate><guid>https://answers.axonivy.com/questions/548/permissiondeniedexception-when-calling-iuser-getallroles/549</guid></item></channel></rss>