Skip to Content
0
Former Member
Jan 03, 2012 at 04:13 PM

UME API Unlock users - reason field

32 Views

Hi Experts,

I have created a web dynpro application that takes a username as input and is supposed to unlock that user. In addition i have to maintain the unlock reason field as well. The reason field is visible when the user is unlocked or locked manually from the UME.

String userId  = wdContext.currentContextElement().getUniquename(); 
	String lv_reason = wdContext.currentContextElement().getReason();
	IUserAccountFactory accountFactory = UMFactory.getUserAccountFactory();
	IUserAccount account = accountFactory.getUserAccountByLogonId(userId);
	IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());
	mutableAccount.setAttribute("com.sap.security.core.usermanagement","lockreason",new String []{lv_reason});
	
	
	mutableAccount.setLocked(false,IUserAccount.LOCKED_BY_ADMIN);
	mutableAccount.save();
	mutableAccount.commit();

So the above unlocks the user just fine but the lock reason stays unchanged.

I have obtained this (com.sap.security.core.usermanagement","lockreason" ) from the IUserAccount.getAttributes.

Any help is appreciated.

Thanks