Home > Java, Portal, SAP NetWeaver > SAP UME API

SAP UME API

In my previous blog SAP UME Configuration, I explained how to configure UME utilize ABAP user management. During web development, we always need to do coding for authorization or  user management like search, creation and change. SAP provides an set of API for this purpose.

The UME API document can be visited at: http://help.sap.com/javadocs/NW04S/current/se/com/sap/security/api/IUserFactory.html

Before using these API, you need to add the public part of DC com.sap.security.api to your custom DCs like web dynpro which locates in software component SAP-JEE.

The following codesnip for creating new user and a new role. Then search all the users and check whether the test user tempUMERole is created successfully.

String usrName = "temp" ;
String roleName = "Administrator" ;
IUserFactory iuf = UMFactory.getUserFactory() ;
IRoleFactory irf = UMFactory.getRoleFactory() ;
 
ISearchResult isr = iuf.getUniqueIDs();
IRole irr = irf.getRoleByUniqueName("tempUMERole") ;
 
IUserMaint newUser = iuf.newUser("tempUMEAPI") ;
newUser.setDisplayName("temp") ;
newUser.setFirstName("firstname") ;
newUser.setLastName("lastname") ;
newUser.save() ;
newUser.commit() ;
 
IRole newRole = irf.newRole("tempUMERole") ;
newRole.setDescription("Temp role for test") ;
newRole.save() ;
newRole.commit();
wdComponentAPI.getMessageManager().reportSuccess(irr.getDescription()) ;
while(isr.hasNext())
{
String userID = (String)isr.next() ;
 
IUser user = iuf.getUser(userID) ;
if("tempUMEAPI".equals(user.getName()))
wdComponentAPI.getMessageManager().reportSuccess(user.getName()) ;
}
}catch(UMException ep){
ep.printStackTrace();
}

Reference

User Management Engine (UME)

  1. mrkanister
    April 7th, 2011 at 20:56 | #1

    “Before using these API, you need to add the public part of DC com.sap.security.api to your custom DCs like web dynpro which locates in software component SAP-JEE.”

    i can only find “com.sap.security.api.sda” in the dc dependencies:(

  2. April 18th, 2011 at 09:34 | #2

    I believe it is the correct dc, as .sda is the suffix.

  1. No trackbacks yet.