on 11-14-2005 7:17 PM
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 !
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
newUserAccount(String userID, String uniqueID)
Creates a new user account with userID and associates it
with the user identified by the unique ID.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.