Ejemplo n.º 1
0
  private void sendMailToCollabrators(List<User> users, Resource resource, User apiCaller) {
    try {
      String flag = "";
      String collectionOrQuizTitle = "";
      Learnguide learnguide = learnguideRepository.findByContent(resource.getGooruOid());
      Assessment assessment = assessmentRepository.findQuizContent(resource.getGooruOid());
      if (resource
              .getResourceType()
              .getName()
              .equalsIgnoreCase(ResourceType.Type.CLASSPLAN.getType())
          || resource
              .getResourceType()
              .getName()
              .equalsIgnoreCase(ResourceType.Type.CLASSBOOK.getType())) {
        collectionOrQuizTitle = learnguide.getLesson();
        if (collectionOrQuizTitle == null) {
          collectionOrQuizTitle = learnguide.getTitle();
        }
        flag = COLLECTION;
      } else if (resource
              .getResourceType()
              .getName()
              .equalsIgnoreCase(ResourceType.Type.ASSESSMENT_QUIZ.getType())
          || resource
              .getResourceType()
              .getName()
              .equalsIgnoreCase(ResourceType.Type.ASSESSMENT_EXAM.getType())) {
        collectionOrQuizTitle = assessment.getName();
        if (collectionOrQuizTitle == null) {
          collectionOrQuizTitle = assessment.getTitle();
        }
        flag = "quiz";
      }
      for (User user : users) {

        mailHandler.sendMailForCollaborator(
            user.getPartyUid(),
            apiCaller.getUsername(),
            resource.getGooruOid(),
            collectionOrQuizTitle,
            flag);
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public static Segment getCollectionSegment(Learnguide collection, String segmentId) {
   for (Segment segment : collection.getResourceSegments()) {
     if (segment.getSegmentId().equals(segmentId)) {
       return segment;
     }
   }
   return null;
 }
Ejemplo n.º 3
0
  public boolean hasRelatedContentPlayPermission(Learnguide learnguide, User user) {
    if (learnguide == null) {
      // To an empty collection people don't have access!
      return false;
    }

    boolean hasCollaboratorPermission = hasCollaboratorPermission(learnguide, user);

    boolean hasUnrestrictedContentAccess = getOperationAuthorizer().hasUnrestrictedContentAccess();

    if (hasUnrestrictedContentAccess
        || learnguide.getSharing().equalsIgnoreCase(PUBLIC)
        || hasCollaboratorPermission
        || learnguide.getUser().getUserId() == user.getUserId()
        || hasSubOrgPermission(learnguide.getOrganization().getPartyUid())) {
      return true;
    }
    return false;
  }
Ejemplo n.º 4
0
 public boolean hasCollaboratorPermission(Learnguide learnguide, User user) {
   List<User> userList =
       learnguideRepository.findCollaborators(learnguide.getGooruOid(), user.getPartyUid());
   return userList.size() > 0 ? true : false;
 }