如何在Liferay中重新激活用户时保留密码

时间:2015-07-16 10:28:09

标签: liferay liferay-6 liferay-ide

我将逐步解释我的情景,以便你们很容易理解这个问题

   1) Im working on a portlet that creates users in to a Ldap server programatically
    2) Liferay is configured with LDAP server with the import option enabled so the groups and users are imported to liferay 
    3) The users and groups are listed in the control panel of Liferay
    4) I tried to login with those users and Login was successfull!!!
    5) Now i delete the user from my portlet  

我使用以下方法激活/停用用户

 public static void activateDeactiavteLportalUser(String  email,boolean status )
    {
        Company company;
        try
        {
            company = CompanyLocalServiceUtil.getCompanyByMx(PropsUtil.get(PropsKeys.COMPANY_DEFAULT_WEB_ID));
            long companyID = company.getCompanyId();
            User liferayuser=   UserLocalServiceUtil.getUserByEmailAddress( companyID, email );
               if(status)
               {
                   UserLocalServiceUtil.updateStatus(liferayuser.getUserId() , WorkflowConstants.STATUS_APPROVED);
               }
               else
               {
                   UserLocalServiceUtil.updateStatus(liferayuser.getUserId() , WorkflowConstants.STATUS_INACTIVE);
               }




        }
        catch ( PortalException | SystemException e )
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

现在我的问题。当我停用用户时,密码字段变空,我看到liferay的user_表已将密码列的更新更新为1。 现在我无法使用该用户登录。是否可以防止密码更新?或者我应该使用实际的删除用户方法来删除用户吗?

Liferay主题:https://www.liferay.com/community/forums/-/message_boards/message/56382345

0 个答案:

没有答案