Search Results


Monday, February 23, 2015

How to get current userId in ADF

How to get username from ADF Bc - EOs and VOs

The current username can be set to the default expressions and BindVariables using the groovy expressions like this

adf.context.securityContext.getUserPrincipal().getName()
or
adf.context.securityContext.getUserName()

Another way to get User ID in Application Module 

String userName = this.getUserPrincipalName();

How to get Logged in User Roles  in Application Module ?

List userRoles = Arrays.asList(ADFContext.getCurrent().getSecurityContext().getUserRoles());


How to get username from ADF Managed Beans


SecurityContext object in ADF can be used to get the current usename from the managed beans and business components implementation classes (AMImpl, VOImpl, RowImpl etc).

    ADFContext adfCtx = ADFContext.getCurrent();
    SecurityContext secCntx = adfCtx.getSecurityContext();
    String user = secCntx.getUserPrincipal().getName();
    String _user = secCntx.getUserName();

How to get current user using EL Expressions on the pages

SecurityContext object can be accessed from EL expressions on pages as follows

#{securityContext.userName}




No comments :