public static PortletPreferences getPortalPreferences(long companyId) throws SystemException { return PortletPreferencesLocalServiceUtil.getPreferences(companyId, companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY, PortletKeys.PREFS_PLID_SHARED, PortletKeys.LIFERAY_PORTAL); } }
/** * Method description * * * @return * * @throws PortalException * @throws SystemException */ public User getPortalUser() throws PortalException, SystemException { return UserLocalServiceUtil.getUserById(portalUserId); }
public static UserData getLiferayUserByEmailNoException(String email, Long companyId) { try { User user = UserLocalServiceUtil.getUserByEmailAddress(companyId, email); return convertLiferayUser(user); } catch (Exception e) { return null; } }
public List<Role> getUserRoles() throws SystemException { return RoleLocalServiceUtil.getUserRoles(getUserId()); }
public static List<UserData> getAllUsers() { try { return convertLiferayUsers(UserLocalServiceUtil.getUsers(0, UserLocalServiceUtil.getUsersCount())); } catch (SystemException e) { throw new LiferayBridgeException(e); } }
private void resourcePermission(long companyId, ExpandoColumn expandoColumn, String roleName) { try { if (roleLocalService != null && resourcePermissionLocalService != null) { Role permissionRole = roleLocalService.getRole(companyId, roleName); resourcePermissionLocalService.setResourcePermissions(companyId, ExpandoColumn.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(expandoColumn.getColumnId()), permissionRole.getRoleId(), new String[]{ActionKeys.VIEW, ActionKeys.UPDATE}); } } catch (Exception e) { LOGGER.error("resource permission", e); throw new RuntimeException(e); } }
@Override public void delete(UserGroup userGroup) { try { List<User> users = userLocalService.getUserGroupUsers(userGroup.getUserGroupId()); long[] userIds = toIdArray(users.toArray(new User[]{})); userLocalService.unsetUserGroupUsers(userGroup.getUserGroupId(), userIds); userGroupLocalService.deleteUserGroup(userGroup); } catch (Exception e) { String msg = String.format("Failed to delete UserGroup [%s]", userGroup.getName()); log(msg, e); throw new RuntimeException(msg, e); } }
private LinkedList<String> getUserGroupRoleByRoleAndGroup(Idea idea, LinkedList<String> toEmail, String roleName) throws PortalException, SystemException { Role roleInnovationsslussen = roleLocalService.getRole(idea.getCompanyId(), roleName); List<UserGroupRole> roleUsersInnovationsslussen = userGroupRoleLocalService.getUserGroupRolesByGroupAndRole(idea.getGroupId(), roleInnovationsslussen.getRoleId()); for (UserGroupRole userGroupRole : roleUsersInnovationsslussen) { String email = userGroupRole.getUser().getEmailAddress(); if (!toEmail.contains(email)) { toEmail.add(email); } } return toEmail; }
public static UserData getLiferayUser(String login, Long companyId) { try { User user = UserLocalServiceUtil.getUserByScreenName(companyId, login); return convertLiferayUser(user); } catch (Exception e) { throw new LiferayBridgeException(e); } }
/** * Creates an ExpandoUtil instance which is dependent on the Liferay runtime. No additional configuration is needed. * @return a new ExpandoUtil instance */ public static ExpandoUtil createDefaultExpandoUtil() { ExpandoUtil expandoUtil = new ExpandoUtil(); expandoUtil.expandoColumnService = ExpandoColumnLocalServiceUtil.getService(); expandoUtil.expandoTableService = ExpandoTableLocalServiceUtil.getService(); expandoUtil.expandoValueService = ExpandoValueLocalServiceUtil.getService(); expandoUtil.roleLocalService = RoleLocalServiceUtil.getService(); expandoUtil.resourcePermissionLocalService = ResourcePermissionLocalServiceUtil.getService(); return expandoUtil; }
@Override public Organization findByName(String organizationName, long companyId) { try { return organizationLocalService.getOrganization(companyId, organizationName); } catch (Exception e) { String msg = String.format("Failed to find organization [%s] in company [%s]", organizationName, companyId); log(msg, e); } return null; }
@Override public UserGroup findByName(String userGroupName, long companyId) { try { return userGroupLocalService.getUserGroup(companyId, userGroupName); } catch (Exception e) { String msg = String.format("Unable to find UserGroup [%s] for companyId [%s]", userGroupName, companyId); log(msg, e); } return null; }
/** * Default constructor taking no arguments. The dependencies are thus looked up by the constructor itself. */ public SocialRelationService() { this.socialRelationLocalService = SocialRelationLocalServiceUtil.getService(); this.socialRequestLocalService = SocialRequestLocalServiceUtil.getService(); this.userLocalService = UserLocalServiceUtil.getService(); }
public static List<UserData> getUsersByCompanyId(Long companyId) { try { if (companyId == null) { return new ArrayList<UserData>(0); } return convertLiferayUsers(UserLocalServiceUtil.getCompanyUsers(companyId, 0, Integer.MAX_VALUE)); } catch (SystemException e) { throw new LiferayBridgeException(e); } }
@Override public void addUser(UserGroup userGroup, User... users) { if (isInvalid(users)) return; if (userGroup != null) { try { userLocalService.addUserGroupUsers(userGroup.getUserGroupId(), toIdArray(users)); } catch (Exception e) { String msg = String.format("Failed to add users [%s] to UserGroup [%s]", toScreenNames(users), userGroup.getName()); log(msg, e); } } }
public static User getUser(String user) { if (debug) { log("getting user from liferay " + user); } try { return UserLocalServiceUtil.getUserById(Long.valueOf(user,10)); } catch (Exception ex) { throw new RuntimeException(ex); } }
public List<Role> getUserRoles() throws SystemException { return RoleLocalServiceUtil.getUserRoles(getUserId()); }
public static PortletPreferences getPortalPreferences(long companyId) throws SystemException { return PortletPreferencesLocalServiceUtil.getPreferences(companyId, companyId, PortletKeys.PREFS_OWNER_TYPE_COMPANY, PortletKeys.PREFS_PLID_SHARED, PortletKeys.LIFERAY_PORTAL); }
public static UserData getLiferayUserByEmail(String email, Long companyId) { try { User user = UserLocalServiceUtil.getUserByEmailAddress(companyId, email); return convertLiferayUser(user); } catch (Exception e) { throw new LiferayBridgeException(e); } }
@Override public UserData getUserByLogin(String login, Long companyId) throws UserSourceException { try { User user = UserLocalServiceUtil.getUserByScreenName(companyId, login); return LiferayUserConverter.convertLiferayUser(user); } catch (Exception e) { throw new UserSourceException(e); } }