Examples of Roles


Examples of org.olat.core.id.Roles

      WindowControl wControl, ControllerEventListener tableEventListener, String actionCommand) {
    Locale loc = ureq.getLocale();
    Translator trans = new PackageTranslator(PACKAGE, loc);
    trans = UserManager.getInstance().getPropertyHandlerTranslator(trans);
    TableController tableCtr = new TableController(tableConfig, ureq, wControl, trans, tableEventListener);
    Roles roles = ureq.getUserSession().getRoles();
    boolean isAdministrativeUser = (roles.isAuthor() || roles.isGroupManager() || roles.isUserManager() || roles.isOLATAdmin());
    UserTableDataModel userDataModel = new UserTableDataModel(identities, loc, isAdministrativeUser);
    userDataModel.addColumnDescriptors(tableCtr, actionCommand);
    tableCtr.setTableDataModel(userDataModel);
    return tableCtr;
  }
View Full Code Here

Examples of org.olat.core.id.Roles

      UserRequest ureq, WindowControl wControl,
      UserCourseEnvironment userCourseEnv, NodeEvaluation ne,
      String nodecmd) {
    Controller controller;
    // Do not allow guests to enroll to dates
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
      Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
      String title = trans.translate("guestnoaccess.title");
      String message = trans.translate("guestnoaccess.message");
      controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
View Full Code Here

Examples of org.olat.core.id.Roles

  public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
      UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to access tasks
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
      Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
      String title = trans.translate(NLS_GUESTNOACCESS_TITLE);
      String message = trans.translate(NLS_GUESTNOACCESS_MESSAGE);
      controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
View Full Code Here

Examples of org.olat.core.id.Roles

    /*
     * TODO:pb:is ImsRepositoryResolver the right place for getting the change log?
     */
    RepositoryEntry re = courseNode.getReferencedRepositoryEntry();
    //re could be null, but if we are here it should not be null!
    Roles userRoles = ureq.getUserSession().getRoles();
    boolean showAll = false;
    showAll = userRoles.isAuthor() || userRoles.isOLATAdmin();
    //get changelog
    Formatter formatter = Formatter.getInstance(ureq.getLocale());
    ImsRepositoryResolver resolver = new ImsRepositoryResolver(re.getKey());
    QTIChangeLogMessage[] qtiChangeLog = resolver.getDocumentChangeLog();
    StringBuilder qtiChangelog = new StringBuilder();
View Full Code Here

Examples of org.olat.core.id.Roles

    boolean isGroupManager = isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_GROUPMANAGER);
    boolean isUserManager = isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_USERMANAGER);
    boolean isGuestOnly = isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_GUESTONLY);
    boolean isInstitutionalResourceManager = isIdentityPermittedOnResourceable(identity, Constants.PERMISSION_HASROLE,
        Constants.ORESOURCE_INSTORESMANAGER);
    Roles roles = new Roles(isAdmin, isUserManager, isGroupManager, isAuthor, isGuestOnly, isInstitutionalResourceManager);
    return roles;
  }
View Full Code Here

Examples of org.olat.core.id.Roles

  public NodeRunConstructionResult createNodeRunConstructionResult(UserRequest ureq, WindowControl wControl,
      UserCourseEnvironment userCourseEnv, NodeEvaluation ne, String nodecmd) {
    updateModuleConfigDefaults(false);
    Controller controller;
    // Do not allow guests to access tasks
    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
      Translator trans = new PackageTranslator(PACKAGE, ureq.getLocale());
      String title = trans.translate(NLS_GUESTNOACCESS_TITLE);
      String message = trans.translate(NLS_GUESTNOACCESS_MESSAGE);
      controller = MessageUIFactory.createInfoMessage(ureq, wControl, title, message);
    } else {
View Full Code Here

Examples of org.olat.core.id.Roles

            repositoryFoldersOnDisk.add(repositoryFoldersAndFilesOnDisk[i]);
          }
        }
 
        // get all repository entries
        Roles roles = new Roles(true, true, true, true, false, true);
        List inDatabase = RepositoryManager.getInstance().genericANDQueryWithRolesRestriction(null, null, null, null, roles, null);
 
        Set inDatabaseIDs = new HashSet(inDatabase.size());
        for (Iterator iter = inDatabase.iterator(); iter.hasNext();) {
          RepositoryEntry element = (RepositoryEntry) iter.next();
View Full Code Here

Examples of org.olat.core.id.Roles

   */
  protected QuickstartPortletRunController(UserRequest ureq, WindowControl wControl) {
    super(wControl);
    this.trans = new PackageTranslator(Util.getPackageName(QuickstartPortletRunController.class), ureq.getLocale());

    Roles roles = ureq.getUserSession().getRoles();
    if (roles.isGuestOnly()) {
      this.quickstartVC = new VelocityContainer("quickstartVC", VELOCITY_ROOT + "/quickstartPortletGuest.html", trans, this);
    } else {
      this.quickstartVC = new VelocityContainer("quickstartVC", VELOCITY_ROOT + "/quickstartPortlet.html", trans, this);
    }
    helpLink = LinkFactory.createLink("quickstart.link.help", quickstartVC, this);
View Full Code Here

Examples of org.olat.core.id.Roles

   
    List typelist = new ArrayList();
    typelist.add(CourseModule.getCourseTypeName());
    // finally the search query
    long startSearchReferencable = System.currentTimeMillis();
    List results = rm.queryReferencableResourcesLimitType(id1, new Roles(false, false, false, true, false, false), typelist, null, null, null);
    long endSearchReferencable = System.currentTimeMillis();
    Tracing.logDebug("found " + results.size() + " repo entries " + (endSearchReferencable - startSearchReferencable) + "ms", RepositoryManagerTest.class);

    // only half of the items should be found
    assertTrue(results.size() == (int) (numbRes / 2));
View Full Code Here

Examples of org.olat.core.id.Roles

   *          call will just return null.
   * @return the created controller
   */
  public static MainLayoutController createLaunchController(OLATResourceable olatResourceable, String initialViewIdentifier, UserRequest ureq,
      WindowControl wControl, boolean exceptIfNoneFound) {
    Roles roles = ureq.getUserSession().getRoles();
    if (olatResourceable == null) {
      // special case after login: guest will get guesthome, other user the
      // normal home
      if (ureq.getUserSession().getRoles().isGuestOnly()) return new GuestHomeMainController(ureq, wControl);
      return new HomeMainController(ureq, wControl);

    } else if (OresHelper.isOfType(olatResourceable, BGMainController.class)) {
      if (roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a BuddyGroupMainController, but is in guest group " + roles);
      return BGControllerFactory.getInstance().createBuddyGroupMainController(ureq, wControl, initialViewIdentifier);

    } else if (OresHelper.isOfType(olatResourceable, BusinessGroup.class)) {
      if (roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a BusinessGroup, but is in guest group " + roles);
      BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
      BusinessGroup bg = bgm.loadBusinessGroup(olatResourceable.getResourceableId(), exceptIfNoneFound);
      boolean isOlatAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
      // check if allowed to start (must be member or admin)
      if (isOlatAdmin || bgm.isIdentityInBusinessGroup(ureq.getIdentity(), bg)) { 
        // only olatadmins or admins of this group can administer this group
        return BGControllerFactory.getInstance().createRunControllerFor(ureq, wControl, bg, isOlatAdmin,
            initialViewIdentifier);
      }
      // else skip

    } else if (OresHelper.isOfType(olatResourceable, RepositoryEntry.class)) {
      // it this is a respository type, the resourceableID is the repository
      // entry key
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry re = rm.lookupRepositoryEntry(olatResourceable.getResourceableId());
      MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, initialViewIdentifier, ureq, wControl);
      if (ctrl != null) return ctrl;

    } else if (OresHelper.isOfType(olatResourceable, CourseModule.class)) {
      // gets called by subscription launcher
      //FIXME:fj:make it clearer here: subscriptioncontext is always given by
      // the surrounding resource, but for launching we always need the
      // repoentry
      // if it is a course, we also take the repository entry, since a course
      // can only be called by a repoentry
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry re = rm.lookupRepositoryEntry(olatResourceable, false);
      MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, initialViewIdentifier, ureq, wControl);
      if (ctrl != null) return ctrl;
    } else if (OresHelper.isOfType(olatResourceable, AssessmentManager.class)) {
      // gets called by subscription launcher
      //FIXME:fj:make it clearer here: subscriptioncontext is always given by
      // the surrounding resource, but for launching we always need the
      // repoentry
      // if it is a course, we also take the repository entry, since a course
      // can only be called by a repoentry
      RepositoryManager rm = RepositoryManager.getInstance();
      // launch course with view identifyer assessment tool. however notifications
      // publisher data provides not existing assessmentManager resource
      OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
      RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource, false);
      MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, "assessmentTool", ureq, wControl);
     
      if (ctrl != null) return ctrl;
    } else if (OresHelper.isOfType(olatResourceable, DropboxController.class)) {
      // JumpIn-handling for task-dropbox notification
      RepositoryManager rm = RepositoryManager.getInstance();
      OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
      RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource,false);
      if (re == null) {
        return null;// found no repositoryEntry => return null
      }
      MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, "assessmentTool:nodeChoose", ureq, wControl)
      if (ctrl != null) return ctrl;
    } else if (OresHelper.isOfType(olatResourceable, ReturnboxController.class)) {
      // JumpIn-handling for task-returnbox notification
      RepositoryManager rm = RepositoryManager.getInstance();
      OLATResourceable fakedCourseResource = OresHelper.createOLATResourceableInstance(CourseModule.class, olatResourceable.getResourceableId());
      RepositoryEntry re = rm.lookupRepositoryEntry(fakedCourseResource, false);
      MainLayoutController ctrl = RepositoyUIFactory.createLaunchController(re, initialViewIdentifier, ureq, wControl)
      if (ctrl != null) return ctrl;
    }

    // --- repository ---
    else if (OresHelper.isOfType(olatResourceable, RepositoryMainController.class)) {
      return new RepositoryMainController(ureq, wControl);
    }
    // --- home ---
    else if (OresHelper.isOfType(olatResourceable, HomeMainController.class)) {
      if (roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a HomeMainController, but is in guest group " + roles);
      return new HomeMainController(ureq, wControl);
    } else if (OresHelper.isOfType(olatResourceable, SystemAdminMainController.class)) {
      if (!roles.isOLATAdmin()) throw new OLATSecurityException("Tried to launch a SystemAdminMainController, but is not in admin group " + roles);
      return new SystemAdminMainController(ureq, wControl);
    } else if (OresHelper.isOfType(olatResourceable, UserAdminMainController.class)) {
      if (!roles.isUserManager()) throw new OLATSecurityException("Tried to launch a UserAdminMainController, but is not in admin group " + roles);
      return new UserAdminMainController(ureq, wControl);
    } else if (OresHelper.isOfType(olatResourceable, BGContextManagementController.class)) {
      if (!roles.isGroupManager()) throw new OLATSecurityException("Tried to launch a BGContextManagementController, but is not in group groupmanager "
          + roles);
      return new BGContextManagementController(ureq, wControl);
    } else if (OresHelper.isOfType(olatResourceable, GuestHomeMainController.class)) {
      if (!roles.isGuestOnly()) throw new OLATSecurityException("Tried to launch a GuestMainController, but is not in guest group " + roles);
      return new GuestHomeMainController(ureq, wControl);
    } else if (OresHelper.isOfType(olatResourceable, GUIDemoMainController.class)) {
      if (!roles.isOLATAdmin()) throw new OLATSecurityException("Tried to launch a GUIDemoMainController, but is not in admin group "
          + roles);
      return new GUIDemoMainController(ureq, wControl);
    } else { // ask the handlerfactory of the repository if it can handle it
      // a repository entry ?
      RepositoryManager rm = RepositoryManager.getInstance();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.