cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign the role for created user thru dynpro App

Former Member
0 Kudos

Hi All

How to assign the role for currently created user from Webdynpro App.

when i enter into the portal after creating the user

i am getting the following messgae in the portal

"No portal roles are assigned for this user.If this problem persists, contact your system administrator."

how to assign the user defined role for the created user from dynpro App

Regards

Dhina Kar J

Edited by: Dhinakaran Jeyachandran on Feb 1, 2008 12:19 PM

Edited by: Dhinakaran Jeyachandran on Feb 1, 2008 12:35 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

In the User Administration section of your portal find your newly created user and below select "Assigned Roles" tab then press <Modify> button and look through available roles on portal then just simply add and save. But if you want to do it programmatically see below:

IUserAcountFactory userFactory = UMFactory.getUserAccountFactory();
// IUser - read only but with IUserAccount is possible to set up user data
IUserAccountSearchFilter userFilter = userFactory.getUserAccountSearchFilter();
userFilter.setLogonUid("superuser", ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult sr = userFactory.search(userFilter);
for (final Iterator i = new PrincipalIterator(sr); i.hasNext();) { 
  IUserAccount user = (IUserAccount) i.next();
  ....
}

Execute the same search for IRole (or IGroup if needed) get the unique id of them and use newRole(...) and addUserToRole(...) methods from IRoleFactory.

Of course you don't need search for this principals if you know uniqueness of them. Use appropriate factories to get'em all by this unique id.

All the features see in [javadocs|http://help.sap.com/javadocs/NW04S/current/se/index.html]

Former Member
0 Kudos

I am asking thru webdynpro coding not in the portal

Dhina

Former Member
0 Kudos

Hi,

I think it only can be done with WD Java, not ABAP.

Best regards