Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Retriving user details from Portal database

Hi Friends

Do any one knows how to retrive user(portal login user) details from Portal database.

Thank you

maruti

replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question