Пример #1
0
  private static LayoutSet _getParentLayoutSet(LayoutSet layoutSet) throws Exception {

    Group group = layoutSet.getGroup();

    if (group.isSite()) {
      Group parentGroup = group.getParentGroup();

      if (parentGroup != null) {
        return LayoutSetLocalServiceUtil.getLayoutSet(
            parentGroup.getGroupId(), layoutSet.isPrivateLayout());
      }
    } else if (group.isUser()) {
      User user = UserLocalServiceUtil.getUser(group.getClassPK());

      List<Organization> organizations =
          OrganizationLocalServiceUtil.getUserOrganizations(user.getUserId());

      if (!organizations.isEmpty()) {
        Organization organization = organizations.get(0);

        Group parentGroup = organization.getGroup();

        return LayoutSetLocalServiceUtil.getLayoutSet(
            parentGroup.getGroupId(), layoutSet.isPrivateLayout());
      }
    }

    return null;
  }
  protected boolean isValidAssignment(KaleoTaskAssignment kaleoTaskAssignment, Group group)
      throws PortalException {

    long roleId = kaleoTaskAssignment.getAssigneeClassPK();

    Role role = _roleLocalService.getRole(roleId);

    if (role.getType() == RoleConstants.TYPE_REGULAR) {
      return true;
    } else if ((group != null)
        && group.isOrganization()
        && (role.getType() == RoleConstants.TYPE_ORGANIZATION)) {

      return true;
    } else if ((group != null) && group.isSite() && (role.getType() == RoleConstants.TYPE_SITE)) {

      return true;
    }

    return false;
  }