on 04-11-2006 4:18 PM
Hi Friends
Do any one knows how to retrive user(portal login user) details from Portal database.
Thank you
maruti
hi maruti ....what the problem is with u guy's.....
it is too much simple to get the user Details from portals database.....first of plz noted some points.
1. u must use the IUser InterFace.
2. also the Data abt a user is mapped thrgh the attribute-mapping xml file which mapped to the LDAP Server.
Also the my following code Snippet may solves ur's problem....as i had worked on same and get successfully data of the logged user from Back-end...
-
String userID = "";
String [] nameSpace, attrib = new String[100], nSpace;
try{
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
nSpace = user.getAttributeNamespaces();
// for(int k =3 ; k < nSpace.length; k++)
// {
// wdComponentAPI.getMessageManager().reportSuccess("NameSpace: "+nSpace[k]);
// nameSpace = user.getAttributeNames(nSpace[k]);
nameSpace = user.getAttributeNames("com.sap.security.core.usermanagement");
for(int i = 0 ; i < nameSpace.length; i++)
{
if(nameSpace<i>.equals("uniquename"))
{
attrib = user.getAttribute("com.sap.security.core.usermanagement",nameSpace<i>);
//wdComponentAPI.getMessageManager().reportSuccess(":::::::: "nameSpace<i>" "+attrib.length);
for(int j =0 ; j < attrib.length; j++)
{
//wdComponentAPI.getMessageManager().reportSuccess("Login ID::::::-->"+attrib[j]);
wdContext.currentContextElement().setLoginid(attrib[j]);
}
userID = attrib[0];
}
//----
if(nameSpace<i>.equals("firstname"))
{
attrib = user.getAttribute("com.sap.security.core.usermanagement",nameSpace<i>);
//wdComponentAPI.getMessageManager().reportSuccess(":::::::: "nameSpace<i>" "+attrib.length);
for(int j =0 ; j < attrib.length; j++)
{
// wdComponentAPI.getMessageManager().reportSuccess("FirstName::::::-->"+attrib[j]);
wdContext.currentContextElement().setFirstname(attrib[j]);
}
userID = attrib[0];
}
//----
//----
if(nameSpace<i>.equals("lastname"))
{
attrib = user.getAttribute("com.sap.security.core.usermanagement",nameSpace<i>);
//wdComponentAPI.getMessageManager().reportSuccess(":::::::: "nameSpace<i>" "+attrib.length);
for(int j =0 ; j < attrib.length; j++)
{
// wdComponentAPI.getMessageManager().reportSuccess("lastname::::::-->"+attrib[j]);
wdContext.currentContextElement().setLastname(attrib[j]);
}
userID = attrib[0];
}
//----
//----
-
with Best Regard's
Dheerendra k Shukla
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.