cancel
Showing results for 
Search instead for 
Did you mean: 

User management API

Former Member
0 Kudos

Hello,

could you please tell me how I can create Groups and add users to, within EP, using the User management API ?

do you have a javadoc on the User management API ?

best regards,

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

There is an excellent article by Will about using UME API

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/documents/a1-8-4/using the new user management api in ep 6.0

Enjoy

Lakshmi

Former Member
0 Kudos

Regarding the UM Javadocs:

They are located in both the PDK and here on SDN. I have prepared a session on creating users, etc. that will be published as part of the certification track. You might take a look at my presentation here on SDN, or Oliver's tutorial. I am wrting this from an airport lounge so I don't have my laptop right now or I would past some sample code in.

Good luck,

Will

Former Member
0 Kudos

I have my laptop now... Code to create a new User:

String uid = "testuser";

IUserMaint newUser = UMFactory.getUserFactory().newUser(uid);

newUser.setFirstName("Test");

newUser.setLastName("User");

newUser.setEmail("testuser@company.com");

newUser.commit();

IUserAccount uacc =UMFactory.getUserAccountFactory().

newUserAccount(uid,newUser.getUniqueID());

uacc.setPassword("secret");

uacc.setPasswordChangeRequired(false);

uacc.save();

uacc.commit();

Former Member
0 Kudos

hello will,

my question is more how to create a group and then bind a user which is already created, instead of how to create a user as you mentioned ...

thank you for your help ...

best regards,

Olivier.

ps: do you have a javadoc to provide ?

Former Member
0 Kudos

Hi Oliver,

please read my first post regarding location of javadocs

Developer Areas -> Enterprise Portal -> EP Development -> Quick Links -> EP6 SP2 javadocs -> User Mgt Engine

Use interface IGroupFactory.addUserToGroup()...

See the guide mentioned in previous post for details

will

Former Member
0 Kudos

Here's sample code for adding users to a group:

// assign individual user to a Group

String userid = "<unique-id of user>";

String groupid = "<unique-id of group>";

IGroupFactory grpFact = UMFactory.getGroupFactory();

// add the user

grpFact.addUserToGroup(userid, groupid);

// get rid of the user

grpFact.removeUserFromGroup(userid,groupid);

Note: the unique IDs are obtained by searching for the user or group. You can also use the appropriate factory (e.g. UserFactory)

The IDs look something like:

GRUP.CORP_LDAP_2.cn=developers,ou=groups,dc=sap,dc=corp

or

USER.CORP_LDAP.uid=i802895,ou=people,dc=sap,dc=corp

So:

String uid = "i802895";

IUser user = UMFactory.getUserFactory().getUserByLogonID(uid);

String uniqID = user.getUniqueID();

Former Member
0 Kudos

thank you for your help Will .

cheers,

Olivier.