My call to

aUser.getAllRoles();

throws the exception:

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

I even tried with grant admin permisson to that user but still throws the same exception.

asked 26.02.2014 at 05:16

Tran%20Cuong%20Truc's gravatar image

Tran Cuong Truc
(suspended)
accept rate: 100%

edited 05.03.2014 at 08:49

Flavio%20Sadeghi's gravatar image

Flavio Sadeghi ♦♦
(suspended)


Hello,

You can execute your code with systemUserPermissions using a callable function. In this Example I get a List of Roles of a User.

List<IRole> roles = Ivy.session().getSecurityContext().executeAsSystemUser(new Callable<List<IRole>>(){
            public List<IRole> call() throws Exception {
                List<IRole> roles = iuser.getRoles();
                return roles;
            }

        });
link

answered 26.02.2014 at 15:42

Raphael%20B%C3%BCrgin's gravatar image

Raphael Bürgin
(suspended)
accept rate: 55%

The method getRoles() only returns the roles that are directly assigned to the user. Whereas the method getAllRoles() returns also the roles that the user inherits because of the hierarchy of the roles.

(04.03.2014 at 17:21) Reto Weiss ♦♦ Reto%20Weiss's gravatar image

Login with "Developer" user

Or

Grant Developer's permission for your Test User role

ivy.session.loginSessionUser("Developer","Developer");
ivy.wf.getApplication().getSecurityDescriptor().grantPermissions(ivy.wf.getApplication().getSecurityDescriptor().getSecurityDescriptorType().getRootPermissionGroup(),
                ivy.session.getSecurityContext().findRole("Everybody")
);
link

answered 26.02.2014 at 09:54

Tho%20Tran's gravatar image

Tho Tran
(suspended)
accept rate: 0%

This way is overtake the root permisson, it works thought but I'm worry about security.

But anyway, it will be an alternative way if the method below doesn't work. :)

(27.02.2014 at 03:21) Tran Cuong Truc Tran%20Cuong%20Truc's gravatar image

Follow this question

By Email:

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

By RSS:

Answers

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

Tags:

×40
×26
×14

Asked: 26.02.2014 at 05:16

Seen: 4,180 times

Last updated: 05.03.2014 at 08:49