Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member


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.

Labels in this area