cancel
Showing results for 
Search instead for 
Did you mean: 

Create portal user using UME api's

Former Member
0 Kudos

Is there an example whicg explains how to create a portal user using the UME api's ? We would like to develop a Web Dynpro app for adding users in batches. See a bunch api's in the NWDS documentation which deals with user account maintanence, profile look-up etc., but none for creating users. Please advise.

Thanks !

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Srikanth,

Before using this code add the security.api jar file to your project's buildpath. For that, in your NWDS, navigate to Your_project->properties->Java Build path->Libraries->Add variable->Click on Eclipse Home->extend->plugins->com.sap.security->lib->com.sap.security.api.jar.

<b>creating a new user, user account & assigning this user to a role</b>

// creating a user

IUserFactory userfact = UMFactory.getUserFactory();

IUserMaint userMaint = userfact.newUser("TestUser");

userMaint.setDisplayName("My Name");

userMaint.setFirstName("Test");

userMaint.setLastName("User");

userMaint.save();

userMaint.commit();

// assigning a role (in this case 'administrator') to the user

IRole role = null;

role=UMFactory.getRoleFactory().getRoleByUniqueName("Administrator");

if(null!=role)

{

wdComponentAPI.getMessageManager().reportSuccess("Adding User::"userMaint.getName()" to role ::"+role.getDisplayName());

UMFactory.getRoleFactory().addUserToRole(userMaint.getUniqueID(),role.getUniqueID());

}

// creating an account for the user

IUserAccountFactory accountFact = UMFactory.getUserAccountFactory();

IUserAccount account = accountFact.newUserAccount("MyLogonID",userMaint.getUniqueID());

account.setPassword("password");

account.save();

account.commit();

Now you will be able to login with user name 'MyLogonID' and password 'password'.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Hello

newUserAccount(String userID, String uniqueID)

Creates a new user account with userID and associates it

with the user identified by the unique ID.

OR https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3641e490-0201-0010-c68f-e51...

detlev_beutner
Active Contributor
0 Kudos

Hi,

see /thread/47272 [original link is broken]

Hope it helps

Detlev

PS: Please consider rewarding points for helpful answers on SDN. Thanks in advance!