JDeveloper and ADF


get the current user in a VOrowImpl


i have a Boolean method in my VORowImpl.It returns "true" if the "author" is the connected  user (current User who is logged in)else it return false. this is the method that i start coding, it is incomplete "how can i get the current user" I want something equivalent to "adf.context.current.sessionScope.get('currentUserId')"    public Boolean getShowRatin() {    if (this.getAuthor() != currentUser) {//what shoul i write in the place of currentUser      return true;    } else {      return false;    }  }
In the VO you can get this info via the ADFContextADFContext adfCtx = ADFContext.getCurrent();    SecurityContext secCntx = adfCtx.getSecurityContext();    String user = secCntx.getUserPrincipal().getName();    String _user = secCntx.getUserName();Timo
thanks for replying,but in my case :this.getAuthor() return the id of user,but in your code im returning the name,so i cant compare id to name.can i use change your code to make it return the id of current user?
ah i think i should write this: Number user = secCntx.getUserPrincipal();
A logged in user doesn't have an ID when using ADFSecurity. The ID is the name which is a string. If you have another way to identiy your users, you have to implement some kind of mapping between your IDs and the names returned by ADF security. Timo
Hi, String username=ADFContext.getCurrent().getSecurityContext().getUserName().toString();-- it will return current loggedin username of type String ,  You can use this code in any java Class. A/c to my understanding requirement is if current user and getAuthor are same you want make visible=false or true, then it's better to apply in UI Component level like below,#{securityContext.userName eq row.Author ? 'true'  :'false'};here var is the row status of table or iterator.I hope it will be useful.Regards,Bayanna K.  
in my case the type of Author  is Number,so i think i can't compare it with String.
Hi, Can you tell me are you getting UserName like 11454 (or) RAMU ??? If you are getting like this  11454 , You can comapre no probelem. Regards,Bayanna K.
one note: i think that i cant use this code because my users exist in Oracle dataBase and i dont have users in adf security.
Great that you tell us now that you don 't use ADF security! So where do you store the logged in user?How should we know?  Timo
I'm using session,i have wrote this code in LoginBean.            ADFContext.getCurrent().getSessionScope().put("currentUserId",                                                          user.getUserId());            ADFContext.getCurrent().getSessionScope().put("currentUserName",                                                          user.getUsername());
Than you use String curUser = ADFContext.getCurrent().getSessionScope().get("currentUserName");Timo
thank you a lot for helping,

Related Links

Jdeveloper 11.1.1.2 default JPA provider
ADF Tree Table
How to show popup programmatically
would like to know
Caused By: java.lang.ClassNotFoundException: oracle.adfinternal.view.faces.
getting Too many objects match the primary key oracle.jbo.Key...
ADF 11g + Task flow parameter map
Effective date in ADF
EntityObject create Row need DMLException
goLink PPR issue in 11.1.1.2
Commit  gives NPE on a Task Flow Method Call
chart & Graph Tools in jdeveloper 11
Uppercase inputs through out application
Run VOs in specific order
The Server Instance cannot be started because the Integrated Weblogic domai
ADF/JSF Table with PLUS sign to add a row

Categories

ORACLE DEV
Development Tools
Oracle Database + Options
E-Business Suite Techn...
Multimedia (formerly i...
Database Security
Recovery Manager (RMAN)
ODP.NET
Workspace Manager
Healthcare
PL/SQL XML Programming
Personalization
Instant Client
Calendar Web Services ...
Email Server
Integration - Oracle BAM
Other Languages
Install (Korean)
Oracle Clusterware
Communications Service...
Business Intelligence ...
Siebel
Oracle技术论坛
Smart Space
Technology Network Com...
QAZone e-TEST suite Fo...
e-Manager Enterprise
WebLogic
Application Integratio...
The Coherence Incubato...
Tuxedo Systems and App...
opensource
weblogic.developer.int...
weblogic.developer.int...
WebLogic Communication...
WebLogic Event Server/...
Industries
WebLogic Server - JCA
Embedded Technologies
Reflections & Referenc...
Solaris on x86
JavaMail
Sun Java System Access...
Portability & Platform...
Oracle Communications ...
CMT Servers General Di...
Java System Portal Ser...
開発ツール製品
General Java Developme...
General Java Embedded ...
インストール
Enterprise Gateway
Oracle SOA Suite (Japa...
WebCenter Sites
Platform as a Service ...
Primavera Unifier User...
Vdbench
XML Publisher (Korean)
Daily Notifications
VirtualBox
Big Data Discovery
Data Quality and Clean...
AppCloud
Chicago Area Eloqua Users
Benelux Eloqua User Group
Huntsville, Alabama El...
Markies: Sales Impact
Oracle Tape Storage
Move Goods
Manufacture and Maintain
Discussion - Accenture...
OpenStack for Oracle S...
OBIEE12C
Home of Oracle Certifi...
Marketing Elo[q]ution ...
Microservices
Oracle Management Cloud
Trade Promotions
APEX Gruppe
Resources
Application Developmen...
Data Mining
产品
Database - General (Ko...
PeopleSoft General Dis...
Beehive
WebLogic Server - General
weblogic.developer.int...
aqualogic.enterprisese...
Identity Services
weblogic.SIP.server
Web Application Develo...
Java Compiler (Develop...
AutoVue Integrations
Business Questions
Desktop
Oracle Storage Cloud S...
Imagine How

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile