on 03-09-2008 5:54 AM
Hi Experts,
Usually we assign roles to users by going to the portal using administrator Id. But my requirement is to assign more than 1 role to users without going to portal, but either by using CAF GP or WD or VC .Is it possible ? can anyone come across the same requirement?
If yes... can anyone help me solving this issue.
Regards,
sitara
Hi,
using webdynpro java you can do that.....
Regards,
P.manivannan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
May be of use
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do it programmatically from webdynpro:
*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.
For more information please check the following link
[http://help.sap.com/javadocs/NW04S/current/se/index.html]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can achieve this using:
import com.sap.security.api.IGroupFactory;
import com.sap.security.api.lFactory;
import com.sap.security.api.IUserAccount;
import com.sap.security.api.IUserFactory;
import com.sap.security.api.IUserMaint;
import com.sap.security.api.IUserSearchFilter;
import com.sap.security.api.UMException;
import com.sap.security.api.UMFactory;
public static void createEPuser throws UMException {
IUserFactory userFactory = UMFactory.getUserFactory();
IRoleFactory roleFactory = UMFactory.getRoleFactory();
IGroupFactory groupFactory = UMFactory.getGroupFactory();
IUserMaint user = null;
IUserAccount userAcc = null;
IUser epUser= null;
//consider already existing role and group - epRole and epGroup respectively
String uniqueIdOfRole = roleFactory.getRoleByUniqueName("pcd:portal_content/com.sap.customRoles/epRole").getUniqueID();
String uniqueIdOfGroup = groupFactory.getGroupByUniqueName("epGroup").getUniqueId();
try {
user = userFactory.newUser( "miltong" );
user.setFirstName( "Milton" );
user.setLastName( "Ghosh" );
user.setEmail( "milton.ghosh@gmail.com" );
user.save();
user.commit();
try {
userAcc = UMFactory.getUserAccountFactory().newUserAccount( "Superman",user.getUniqueID));
userAcc.setPassword( "super#1234" );
userAcc.save();
userAcc.commit();
}catch (Exception e)
{ System.out.println(e.toString());
return;
}
String uniqueIdOfUser = user.getUniqueID();
// add user to role
roleFactory.addUserToRole(uniqueIdOfUser ,uniqueIdOfRole );
// add user to group
groupFactory.addUserToGroup(uniqueIdOfUser,uniqueIdOfGroup);
// delete user
epUser=userFactory.getUserByLogonID("miltong");
userFactory.deleteUser(uniqueIdOfUser);
} catch (Exception exp)
{ System.out.println(exp.toString());
user .rollback();
}
}
Hope this helps.
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
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.