Wednesday 16 October 2013

ADF Security: Display User Roles

ADF Security: Display User Roles

so today I want to show you two things you can do, and this is how to display user roles in the Console.

The first method is,
ADFContext.getCurrent().getSecurityContext().getUserRoles();

This returns an array of Strings, this is an array of all the roles the user has against his / her name.

This code
for (String s : ADFContext.getCurrent().getSecurityContext().getUserRoles()) {
    System.out.println("\t\t" + s);
}

will display all the roles the logged in user has.

the import you will need for this code to work is:
import oracle.adf.share.ADFContext;

#bearMan out.

No comments:

Post a Comment