Exemplo n.º 1
0
  /**
   * Controls locks in admin view.
   *
   * @param ureq
   * @param wControl
   */
  public LockController(UserRequest ureq, WindowControl wControl) {
    super(ureq, wControl);

    myContent = createVelocityContainer("locks");

    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setDownloadOffered(false);
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
    tableCtr.addColumnDescriptor(
        new DefaultColumnDescriptor("lock.key", Cols.key.ordinal(), null, getLocale()));

    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (securityModule.isUserAllowedAdminProps(ureq.getUserSession().getRoles())) {
      tableCtr.addColumnDescriptor(
          new DefaultColumnDescriptor("lock.owner", Cols.ownerName.ordinal(), null, getLocale()));
    }
    tableCtr.addColumnDescriptor(
        new DefaultColumnDescriptor("lock.owner", Cols.ownerFullname.ordinal(), null, getLocale()));
    tableCtr.addColumnDescriptor(
        new DefaultColumnDescriptor(
            "lock.aquiretime", Cols.acquiredTime.ordinal(), null, getLocale()));
    tableCtr.addColumnDescriptor(
        new StaticColumnDescriptor("lock.release", "lock.release", translate("lock.release")));
    listenTo(tableCtr);
    resetTableModel();
    myContent.put("locktable", tableCtr.getInitialComponent());
    putInitialPanel(myContent);
  }
  public GroupAssessmentController(
      UserRequest ureq,
      WindowControl wControl,
      CourseEnvironment courseEnv,
      GTACourseNode courseNode,
      BusinessGroup assessedGroup) {
    super(ureq, wControl, "assessment_per_group");
    this.gtaNode = courseNode;
    this.courseEnv = courseEnv;
    this.assessedGroup = assessedGroup;

    withScore = courseNode.hasScoreConfigured();
    withPassed = courseNode.hasPassedConfigured();
    if (withPassed) {
      cutValue = courseNode.getCutValueConfiguration();
    }
    withComment = courseNode.hasCommentConfigured();

    Roles roles = ureq.getUserSession().getRoles();
    isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
    userPropertyHandlers =
        userManager.getUserPropertyHandlersFor(
            GTACoachedGroupGradingController.USER_PROPS_ID, isAdministrativeUser);
    setTranslator(userManager.getPropertyHandlerTranslator(getTranslator()));

    List<IdentityRef> duplicates = gtaManager.getDuplicatedMemberships(courseNode);
    duplicateMemberKeys = new ArrayList<>(duplicates.size());
    for (IdentityRef duplicate : duplicates) {
      duplicateMemberKeys.add(duplicate.getKey());
    }

    initForm(ureq);
    ModelInfos modelInfos = loadModel();
    updateGUI(modelInfos);
  }
Exemplo n.º 3
0
  private UserSession afterAuthorization(Identity identity, HttpServletRequest request) {
    UserSession usess = sessionManager.getUserSession(request);
    synchronized (usess) {
      // double check to prevent severals concurrent login
      if (usess.isAuthenticated()) {
        return usess;
      }

      sessionManager.signOffAndClear(usess);
      usess.setIdentity(identity);
      UserDeletionManager.getInstance().setIdentityAsActiv(identity);
      // set the roles (admin, author, guest)
      Roles roles = BaseSecurityManager.getInstance().getRoles(identity);
      usess.setRoles(roles);
      // set session info
      SessionInfo sinfo =
          new SessionInfo(identity.getKey(), identity.getName(), request.getSession());
      User usr = identity.getUser();
      sinfo.setFirstname(usr.getProperty(UserConstants.FIRSTNAME, null));
      sinfo.setLastname(usr.getProperty(UserConstants.LASTNAME, null));

      String remoteAddr = request.getRemoteAddr();
      sinfo.setFromIP(remoteAddr);
      sinfo.setFromFQN(remoteAddr);
      try {
        InetAddress[] iaddr = InetAddress.getAllByName(request.getRemoteAddr());
        if (iaddr.length > 0) sinfo.setFromFQN(iaddr[0].getHostName());
      } catch (UnknownHostException e) {
        // ok, already set IP as FQDN
      }
      sinfo.setAuthProvider(BaseSecurityModule.getDefaultAuthProviderIdentifier());
      sinfo.setUserAgent(request.getHeader("User-Agent"));
      sinfo.setSecure(request.isSecure());
      sinfo.setWebDAV(true);
      sinfo.setWebModeFromUreq(null);
      // set session info for this session
      usess.setSessionInfo(sinfo);
      //
      sessionManager.signOn(usess);
      return usess;
    }
  }