cancel
Showing results for 
Search instead for 
Did you mean: 

Removing the Role

Former Member
0 Kudos

Hello Experts,

I want to remove the role for the corresponding user in runtime, by clicking the deletebutton next to that role.

Role1 deleteimage | Role2 deleteimage | Role3 deleteimage

I acheived this for the Role which is currently selected.

How can i acheive this?

Valuable answers will be rewarded.

Regards,

Aksiti.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

One idea would be to create a portal component which takes the pcd path of role as request parameter and unassignes the role for the current user.

Check UME api to remove role from current user here:

http://help.sap.com/javadocs/NW04/current/um/index.html

code:

UMFactory.getRoleFactory().removeUserFromRole(<userid>,<roleid>);

So when you render the delete icon have a href calling your portal component to delete role with appropriate pcd path to role.

Regards,

Praveen Gudapati

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello

Can u tell me how to pass parameter dynamically in HTMLB onClientClick function?

If i am passing onClientClick('<%=Roleid%>') means, it is not displaying the value of the Roleid.

it is only showing <%=RoleiD%>

Former Member
0 Kudos

IUser user = null;

String portal_user_name =null;

int y_v_no_of_roles = 0 ;

IRole irole = null;

try

{

user = (IUser)WDClientUser.getCurrentUser().getSAPUser();

}

catch(WDUMException e)

{

wdComponentAPI.getMessageManager().reportSuccess("fail to get current user1" +e.getLocalizedMessage());

}

try

{

irole = UMFactory.getRoleFactory().getRoleByUniqueName(wdContext.nodePortal_Role_Name().getPortal_Role_NameElementAt(i).getRole_Name().trim());

}

catch(UMException e)

{

wdComponentAPI.getMessageManager().reportSuccess("Fail to get Role" +e.getLocalizedMessage());

}

if(user.isMemberOfRole(irole.getUniqueID(),true))

{

String useruid=user.getUniqueID();

String roleuid=irole.getUniqueID();

try

{

UMFactory.getRoleFactory().RemoveUserFromRole(useruid,roleuid);

}

catch(UMException e)

{

wdComponentAPI.getMessageManager().reportException("Fail to add user" +e.getLocalizedMessage(),true);

}

}

this code for your requirement