/**
  * @see org.olat.search.service.indexer.Indexer#checkAccess(org.olat.core.id.context.ContextEntry,
  *     org.olat.core.id.context.BusinessControl, org.olat.core.id.Identity,
  *     org.olat.core.id.Roles)
  */
 @Override
 public boolean checkAccess(
     final ContextEntry contextEntry,
     final BusinessControl businessControl,
     final Identity identity,
     final Roles roles) {
   // TODO:chg: check with collabTools if forum is enabled
   final ContextEntry ce = businessControl.popLauncherContextEntry();
   final Long resourceableId = ce.getOLATResourceable().getResourceableId();
   final Message message = ForumManager.getInstance().loadMessage(resourceableId);
   Message threadtop = message.getThreadtop();
   if (threadtop == null) {
     threadtop = message;
   }
   final boolean isMessageHidden = Status.getStatus(threadtop.getStatusCode()).isHidden();
   // assumes that if is owner then is moderator so it is allowed to see the hidden forum threads
   // TODO: (LD) fix this!!!
   // here it is checked if the identity is owner of the forum tool but it has no way to find out
   // whether is owner of the group that owns the forum tool
   final boolean isOwner =
       BaseSecurityManager.getInstance()
           .isIdentityPermittedOnResourceable(
               identity, Constants.PERMISSION_ACCESS, contextEntry.getOLATResourceable());
   if (isMessageHidden && !isOwner) {
     return false;
   }
   return true;
 }
Example #2
0
  @Override
  public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) return;

    ContextEntry ce = entries.remove(0);
    if ("test".equals(ce.getOLATResourceable().getResourceableTypeName())) {
      Long resourceId = ce.getOLATResourceable().getResourceableId();
      if (resourceId != null && resourceId.longValue() >= 0) {
        // event(ureq, startButton, Event.CHANGED_EVENT);
      }
    }
  }
  public IdentityAssessmentEditController(
      WindowControl wControl,
      UserRequest ureq,
      StackedController stackPanel,
      Identity assessedIdentity,
      ICourse course,
      boolean mayEdit,
      boolean headers) {

    super(ureq, wControl);
    this.stackPanel = stackPanel;
    this.mayEdit = mayEdit;
    main = new Panel("main");
    assessedUserCourseEnvironment =
        AssessmentHelper.createAndInitUserCourseEnvironment(assessedIdentity, course);
    this.ores = OresHelper.clone(course);
    this.headers = headers;
    doIdentityAssessmentOverview(ureq, true);
    putInitialPanel(main);

    BusinessControl bc = getWindowControl().getBusinessControl();
    ContextEntry ce = bc.popLauncherContextEntry();
    if (ce != null) {
      OLATResourceable oresNode = ce.getOLATResourceable();
      if (OresHelper.isOfType(oresNode, CourseNode.class)) {
        Long courseNodeId = oresNode.getResourceableId();
        Structure runStructure =
            assessedUserCourseEnvironment.getCourseEnvironment().getRunStructure();
        CourseNode courseNode = runStructure.getNode(courseNodeId.toString());
        if (courseNode instanceof AssessableCourseNode) {
          doEditNodeAssessment(ureq, (AssessableCourseNode) courseNode);
        }
      }
    }
  }
  @Override
  public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) return;

    ContextEntry currentEntry = entries.get(0);
    String cmd = currentEntry.getOLATResourceable().getResourceableTypeName();
    Controller selectedCtrl = selectMenuItem(ureq, cmd);
    if (selectedCtrl instanceof Activateable2) {
      List<ContextEntry> subEntries = entries.subList(1, entries.size());
      ((Activateable2) selectedCtrl).activate(ureq, subEntries, currentEntry.getTransientState());
    }
  }
 @Override
 public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
   if (entries == null || entries.isEmpty()) {
     if (currentCtrl == null) {
       if (isGuestonly) {
         doOpenMyEntries(ureq);
         segmentView.select(myEntriesLink);
       } else {
         boolean markEmpty = doOpenMark(ureq).isEmpty();
         if (markEmpty) {
           doOpenMyEntries(ureq);
           segmentView.select(myEntriesLink);
         } else {
           segmentView.select(favoriteLink);
         }
       }
     }
     addToHistory(ureq, currentCtrl);
   } else {
     ContextEntry entry = entries.get(0);
     String segment = entry.getOLATResourceable().getResourceableTypeName();
     List<ContextEntry> subEntries = entries.subList(1, entries.size());
     if ("Favorits".equals(segment)) {
       if (isGuestonly) {
         doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
         segmentView.select(myEntriesLink);
       } else {
         doOpenMark(ureq).activate(ureq, subEntries, entry.getTransientState());
         segmentView.select(favoriteLink);
       }
     } else if ("My".equals(segment)) {
       doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
       segmentView.select(myEntriesLink);
     } else if ("Search".equals(segment)) {
       doSearchEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
       segmentView.select(searchLink);
     } else {
       doOpenMyEntries(ureq).activate(ureq, subEntries, entry.getTransientState());
       segmentView.select(myEntriesLink);
     }
   }
 }
  @Override
  public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) return;

    ContextEntry entry = entries.get(0);
    String type = entry.getOLATResourceable().getResourceableTypeName();
    if ("changepw".equals(type)) {
      String email = null;
      if (entries.size() > 1) {
        email = entries.get(1).getOLATResourceable().getResourceableTypeName();
      }
      openChangePassword(ureq, email);
    } else if ("registration".equals(type)) {
      if (registrationModule.isSelfRegistrationEnabled()
          && registrationModule.isSelfRegistrationLinkEnabled()) {
        List<ContextEntry> subEntries = entries.subList(1, entries.size());
        openRegistration(ureq).activate(ureq, subEntries, entry.getTransientState());
      }
    }
  }