cancel
Showing results for 
Search instead for 
Did you mean: 

retriving user details from user rofile in portal database

Former Member
0 Kudos

HI all,

any one knows how to retrive user details from user rpofile in portal database. I am using webdynpro appliction.Please reply.

Thank you

Maruthi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Maruti,

You need to access the logged in portal user's information right ?

This can be done as follows -

IWDClientUser clientUser = WDClientUser.getCurrentUser();

IUser user = clientUser.getSAPUser();

Now you can get the details by using -

user.get...();

You can retrieve all users details - country,department,cellphone,firstname,lastname etc..

Tell me if u need any other details.

Thanks,

Sam

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

User Management API support is available for Webdynpro. The API's fetch the values from the UserStore (R/3 or EP or LDAP) based on the configuration.

Sample code for fetching the user details is provided in the link below http://help.sap.com/saphelp_nw04/helpdata/en/f5/4dd9d47a200d46bd1c56062f49e10b/frameset.htm

Hope that helps.

Regards,

S.Divakar

Former Member
0 Kudos

HI,

Refer this link

/people/sap.user72/blog/2005/06/05/user-management-api-in-webdynpro

Regards,

RK

Dheerendra
Participant
0 Kudos

hi maruti Rao,

I m giving u sme sample code that i had tested for retreving user information from LDAP Server.....as follows it may be helpful to u....

-


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];

}

-


Similarly u can get all the attribute u needed........from that attributed file which i last gave to u.............

regard's

Dheerendra

Dheerendra
Participant
0 Kudos

Hi maruti Rao ,

All Gives U gud Idea..here i give u some brief procedure.First of all u need to add 2 jar file in ur project structure for proper working of "com.sap.security.api.IUser" Interface. After that for retriving Users data Stored on LDAP Server.

If you are using an LDAP directory as a data source for your user-related data, the ‘logical’ attribute names used by the Java application programming interface (API) of SAP User Management Engine (UME) must be mapped to the ‘physical’ attribute names used in the schema of your corporate LDAP directory.

Example Data-Source File is as Below From Where U can Get All The Information of Logged user...

<dataSources>

...

...

<dataSource id="CORP_LDAP"

className="com.sap.security.core.persistence.datasource.imp.LDAPPersistence"

isReadonly="false"

isPrimary="true">

...

<responsibleFor>

<principal type="account">

...

</principal>

<principal type="user">

<nameSpaces>

<nameSpace name="com.sap.security.core.usermanagement">

<attributes>

<attribute name="firstname" populateInitially="true"/>

<attribute name="displayname" populateInitially="true"/>

<attribute name="lastname" populateInitially="true"/>

<attribute name="fax"/>

<attribute name="email"/>

<attribute name="title"/>

<attribute name="department"/>

<attribute name="description"/>

<attribute name="mobile"/>

<attribute name="telephone"/>

<attribute name="streetaddress"/>

<attribute name="uniquename" populateInitially="true"/>

</attributes>

</nameSpace>

...

</nameSpaces>

</principal>

<principal type="group">

...

</principal>

</responsibleFor>

<attributeMapping>

<principals>

<principal type="account">

...

</principal>

<principal type="user">

<nameSpaces>

<nameSpace name="com.sap.security.core.usermanagement">

<attributes>

<attribute name="firstname">

<physicalAttribute name="givenname"/>

</attribute>

<attribute name="displayname">

<physicalAttribute name="displayname"/>

</attribute>

<attribute name="lastname">

<physicalAttribute name="sn"/>

</attribute>

<attribute name="fax">

<physicalAttribute name="facsimiletelephonenumber"/>

</attribute>

<attribute name="uniquename">

<physicalAttribute name="uid"/>

</attribute>

<attribute name="loginid">

<physicalAttribute name="null"/>

</attribute>

<attribute name="email">

<physicalAttribute name="mail"/>

</attribute>

<attribute name="mobile">

<physicalAttribute name="mobile"/>

</attribute>

<attribute name="telephone">

<physicalAttribute name="telephonenumber"/>

</attribute>

<attribute name="department">

<physicalAttribute name="ou"/>

</attribute>

<attribute name="description">

<physicalAttribute name="description"/>

</attribute>

<attribute name="streetadress">

<physicalAttribute name="postaladdress"/>

</attribute>

<attribute name="pobox">

<physicalAttribute name="postofficebox"/>

</attribute>

<attribute name="preferredlanguage">

<physicalAttribute name="preferredlanguage"/>

</attribute>

</attributes>

</nameSpace>

...

</nameSpaces>

</principal>

<principal type="group">

...

</principal>

</principals>

</attributeMapping>

</dataSources>

regard's

Dheerendra Shukla

chintan_virani
Active Contributor
0 Kudos

Maruti,

In addition to code mentioned you will need to add two external jars in the build path of your project. You can do this by right clicking on your Project Name ==> Properties ==> Java Build path ==> Libraries ==> Add external jars.

The two jar names are:-

1)com.sap.security.api.jar

2)com.sap.security.api.perm.jar.

<b>- Chintan Virani.</b>