List of usage examples for com.liferay.portal.kernel.model Group getOrganizationId
public long getOrganizationId();
From source file:com.liferay.site.teams.web.internal.display.context.SiteTeamsDisplayContext.java
License:Open Source License
protected void addBreadcrumbEntries() throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay) _request.getAttribute(WebKeys.THEME_DISPLAY); Group group = themeDisplay.getScopeGroup(); if (group.isOrganization()) { Organization organization = OrganizationLocalServiceUtil.getOrganization(group.getOrganizationId()); UsersAdminUtil.addPortletBreadcrumbEntries(organization, _request, _renderResponse); } else {/*from w w w.ja v a 2 s .c o m*/ PortalUtil.addPortletBreadcrumbEntry(_request, group.getDescriptiveName(themeDisplay.getLocale()), null); } PortalUtil.addPortletBreadcrumbEntry(_request, LanguageUtil.get(_request, "manage-teams"), themeDisplay.getURLCurrent()); }
From source file:com.liferay.social.activities.web.internal.util.SocialActivitiesQueryHelper.java
License:Open Source License
public List<SocialActivitySet> getSocialActivitySets(Group group, Layout layout, Scope scope, int start, int end) { if (scope == Scope.ALL) { if (!group.isUser()) { return _socialActivitySetLocalService.getGroupActivitySets(group.getGroupId(), start, end); }//from ww w . j av a 2 s. co m return _socialActivitySetLocalService.getUserViewableActivitySets(group.getClassPK(), start, end); } else if (group.isOrganization()) { return _socialActivitySetLocalService.getOrganizationActivitySets(group.getOrganizationId(), start, end); } else if (!group.isUser()) { return _socialActivitySetLocalService.getGroupActivitySets(group.getGroupId(), start, end); } else if (layout.isPublicLayout() || (scope == Scope.ME)) { return _socialActivitySetLocalService.getUserActivitySets(group.getClassPK(), start, end); } else if (scope == Scope.CONNECTIONS) { return _socialActivitySetLocalService.getRelationActivitySets(group.getClassPK(), SocialRelationConstants.TYPE_BI_CONNECTION, start, end); } else if (scope == Scope.FOLLOWING) { return _socialActivitySetLocalService.getRelationActivitySets(group.getClassPK(), SocialRelationConstants.TYPE_UNI_FOLLOWER, start, end); } else if (scope == Scope.MY_SITES) { return _socialActivitySetLocalService.getUserGroupsActivitySets(group.getClassPK(), start, end); } else { return Collections.emptyList(); } }
From source file:com.liferay.social.activities.web.internal.util.SocialActivitiesQueryHelper.java
License:Open Source License
public int getSocialActivitySetsCount(Group group, Layout layout, Scope scope) { if (scope == Scope.ALL) { if (!group.isUser()) { return _socialActivitySetLocalService.getGroupActivitySetsCount(group.getGroupId()); }/*w ww . ja va 2s . c om*/ return _socialActivitySetLocalService.getUserViewableActivitySetsCount(group.getClassPK()); } else if (group.isOrganization()) { return _socialActivitySetLocalService.getOrganizationActivitySetsCount(group.getOrganizationId()); } else if (!group.isUser()) { return _socialActivitySetLocalService.getGroupActivitySetsCount(group.getGroupId()); } else if (layout.isPublicLayout() || (scope == Scope.ME)) { return _socialActivitySetLocalService.getUserActivitySetsCount(group.getClassPK()); } else if (scope == Scope.CONNECTIONS) { return _socialActivitySetLocalService.getRelationActivitySetsCount(group.getClassPK(), SocialRelationConstants.TYPE_BI_CONNECTION); } else if (scope == Scope.FOLLOWING) { return _socialActivitySetLocalService.getRelationActivitySetsCount(group.getClassPK(), SocialRelationConstants.TYPE_UNI_FOLLOWER); } else if (scope == Scope.MY_SITES) { return _socialActivitySetLocalService.getUserGroupsActivitySetsCount(group.getClassPK()); } else { return 0; } }
From source file:eu.gerhards.liferay.services.angular.service.impl.AngularRoleServiceImpl.java
License:Open Source License
public List<UserGroupRole> checkUserGroupRoles(long userId, List<UserGroupRole> userGroupRoles) throws PortalException { List<UserGroupRole> oldUserGroupRoles = null; PermissionChecker permissionChecker = getPermissionChecker(); if (userId != CompanyConstants.SYSTEM) { // Add back any user group roles that the administrator does not // have the rights to remove or that have a mandatory membership User user = UserLocalServiceUtil.getUser(userId); List<UserGroup> userGroups = user.getUserGroups(); for (UserGroup userGroup : userGroups) { List<UserGroupRole> roles = UserGroupRoleLocalServiceUtil.getUserGroupRoles(userId, userGroup.getUserGroupId()); oldUserGroupRoles.addAll(roles); }// w ww.ja v a 2s . co m for (UserGroupRole oldUserGroupRole : oldUserGroupRoles) { Role role = oldUserGroupRole.getRole(); Group group = oldUserGroupRole.getGroup(); if (userGroupRoles.contains(oldUserGroupRole)) { continue; } if (role.getType() == RoleConstants.TYPE_ORGANIZATION) { Organization organization = OrganizationLocalServiceUtil .getOrganization(group.getOrganizationId()); if (!UserGroupRolePermissionUtil.contains(permissionChecker, group, role) || OrganizationMembershipPolicyUtil.isRoleProtected(getPermissionChecker(), userId, organization.getOrganizationId(), role.getRoleId()) || OrganizationMembershipPolicyUtil.isRoleRequired(userId, organization.getOrganizationId(), role.getRoleId())) { userGroupRoles.add(oldUserGroupRole); } } else if (role.getType() == RoleConstants.TYPE_SITE) { if (!userGroupRoles.contains(oldUserGroupRole) && (!UserGroupRolePermissionUtil.contains(permissionChecker, group, role) || SiteMembershipPolicyUtil.isRoleProtected(getPermissionChecker(), userId, group.getGroupId(), role.getRoleId()) || SiteMembershipPolicyUtil.isRoleRequired(userId, group.getGroupId(), role.getRoleId()))) { userGroupRoles.add(oldUserGroupRole); } } } } // Check that the administrator has the permission to add a new user // group role and that the user group role membership is allowed for (UserGroupRole userGroupRole : userGroupRoles) { if ((oldUserGroupRoles == null) || !oldUserGroupRoles.contains(userGroupRole)) { UserGroupRolePermissionUtil.check(permissionChecker, userGroupRole.getGroupId(), userGroupRole.getRoleId()); } } return userGroupRoles; }