In currently, we can find exactly an IRole by using "ivy.wf.getSecurityContext().findRole()"

But, how can we get a list of IRoles that having same prefix name, or using a keyword to get all IRoles into a list?

Thank you very much.

asked 22.01.2014 at 08:34

nghianguyen's gravatar image

nghianguyen
(suspended)
accept rate: 0%

edited 22.01.2014 at 12:07

admin's gravatar image

admin ♦♦
(suspended)


I think you can get all roles and handle them by Java code

ivy.wf.getSecurityContext().getRoles()

link

answered 22.01.2014 at 09:00

anphunl's gravatar image

anphunl
(suspended)
accept rate: 50%

I think it would be great if Ivy could handle this case. Anyway, thanks for your answer

(22.01.2014 at 09:30) nghianguyen nghianguyen's gravatar image

@nghianguyen: This is a Q&A-Platform where users assist other users and also the ivyTeam mixes in - not an official support-system. Use soreconnect if you have (urgent) cases.

(12.02.2014 at 18:31) Nikel Weis Nikel%20Weis's gravatar image

I think we never find such e completed class in java.

But its easy to handle in a short methode like this.

public List<IRole> roleWithPrefix(String prefix){
    List<IRole> rolesToReturn = new ArrayList<IRole>();
    List<IRole> roles = Ivy.wf().getSecurityContext().getRoles();

    for(IRole role : roles){
        if(role.getName().startsWith(prefix)){
            rolesToReturn.add(role);
        }
    }
    return rolesToReturn;
}

I think with a singeltonpattern you can add this method very efficient on your application

link

answered 22.01.2014 at 10:19

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

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

Thank you, Raphael. I see that Ivy has not provide any APIs for searching IRoles, your comment is best way for now.

(24.01.2014 at 10:07) nghianguyen nghianguyen'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:

×14

Asked: 22.01.2014 at 08:34

Seen: 3,246 times

Last updated: 12.02.2014 at 18:31