Hi All,
Below code will help you to lock or unlock user in Portal through WDJ/EJB.
To Lock:
//Getting user account
IUserAccount userAccount1= UMFactory.getUserAccountFactory().getUserAccountByLogonId("Enter/Pass user ID to be lock");
//Making user account properties changeable (Mutable)
IUserAccount userAccount= UMFactory.getUserAccountFactory().getMutableUserAccount(userAccount1.getUniqueID());
//Value "true" will lock the user in portal and the second parameter is a reason.
userAccount.setLocked(true, IUserAccount.LOCKED_BY_ADMIN);
//After this, commit or save
userAccount.save();
//userAccount.commit();
To Unlock:
//Getting user account
IUserAccount userAccount1= UMFactory.getUserAccountFactory().getUserAccountByLogonId("Enter/Pass user ID to be unlock");
//Making user account properties changeable
IUserAccount userAccount= UMFactory.getUserAccountFactory().getMutableUserAccount(userAccount1.getUniqueID());
//Value "false" will unlock the user in portal and the second parameter is a reason.
userAccount.setLocked(false, IUserAccount.LOCKED_BY_ADMIN);
//After this commit or save
userAccount.save();
//userAccount.commit();
This code we can integrate with the View and provide the functionality to particular user. So, that he will able to lock/unlock users in portal without having User Administration access.