如何在Liferay 6.2中以编程方式从角色分配/删除用户组

时间:2015-03-30 08:56:56

标签: liferay liferay-ide

我正在尝试使用以下方法从角色中删除用户组。但它不起作用。有人能帮助我找出问题吗?

  public static boolean  deleteUserGroupFromRole( String groupName, String roleName )
    {
        try
        {
            company = CompanyLocalServiceUtil.getCompanyByMx( PropsUtil.get( PropsKeys.COMPANY_DEFAULT_WEB_ID ) );
            long companyId = company.getCompanyId();

            UserGroup lportalUserGroup=   SoasLportalGroupHelper.getLportalUserGroup( groupName);
            Role role=  getRole( companyId, roleName );


            GroupLocalServiceUtil.deleteRoleGroup(role.getRoleId(), lportalUserGroup.getGroupId() );

            logger.debug( "Role : "+roleName +" has been deleted from groupName "+groupName);
            return true;
        }
        catch ( PortalException e )
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        catch ( SystemException e )
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return false;
    }

0 个答案:

没有答案