Quantcast
Channel: SCN : All Content - Web Dynpro Java
Viewing all articles
Browse latest Browse all 1288

How to lock/unlock users in Portal through WDJ/EJB

$
0
0


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.

 


Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>