コード例 #1
0
ファイル: UserServiceImpl.java プロジェクト: tkatva/ttPortal
  public List<TtRole> getUserRoles(TtUser user) {
    List<TtRole> roles = new ArrayList<TtRole>();
    try {
      List<com.liferay.portal.model.Role> portalRoles = roleService.getUserRoles(user.getUserId());
      for (Role portalRole : portalRoles) {
        roles.add(UserServiceConversionHelper.convertPortalRoleToTtRole(portalRole));
      }

    } catch (SystemException ex) {
      Logger.getLogger(UserServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
    }
    return roles;
  }
コード例 #2
0
ファイル: UserServiceImpl.java プロジェクト: tkatva/ttPortal
 public List<TtUser> getUsersForRole(String roleName, long userId) {
   List<TtUser> roleUsrs = new ArrayList<TtUser>();
   try {
     List<Organization> usrOrgs = orgService.getUserOrganizations(userId);
     for (Organization org : usrOrgs) {
       Role role = roleService.getRole(org.getCompanyId(), roleName);
       if (role != null) {
         List<User> usrs = usrService.getRoleUsers(role.getRoleId());
         for (User usr : usrs) {
           roleUsrs.add(UserServiceConversionHelper.convertPortalUserToTtUser(usr));
         }
       }
     }
   } catch (PortalException ex) {
     Logger.getLogger(UserServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
   } catch (SystemException ex) {
     Logger.getLogger(UserServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
   }
   return roleUsrs;
 }