Package org.olat.repository

Examples of org.olat.repository.RepositoryManager


  private boolean hasAccess(Identity identity, String token, OLATResourceable feed) {
    boolean hasAccess = false;
    if (allowsGuestAccess(feed)) {
      hasAccess = true;
    } else if (identity != null) {
      RepositoryManager resMgr = RepositoryManager.getInstance();
      RepositoryEntry repoEntry = resMgr.lookupRepositoryEntry(feed, false);
      Roles roles = ManagerFactory.getManager().getRoles(identity);
      boolean isAllowedToLaunch = resMgr.isAllowedToLaunch(identity, roles, repoEntry);
      if (isAllowedToLaunch && validAuthentication(identity, token)) {
        hasAccess = true;
      }
    }
    return hasAccess;
View Full Code Here


   * @param feed
   * @return true if the feed allows guest access.
   */
  private boolean allowsGuestAccess(OLATResourceable res) {
    boolean guestsAllowed = false;
    RepositoryManager resMgr = RepositoryManager.getInstance();
    RepositoryEntry repoEntry = resMgr.lookupRepositoryEntry(res, false);
    if (repoEntry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS) {
      guestsAllowed = true;
    }
    return guestsAllowed;
  }
View Full Code Here

   */
  public static RepositoryEntry getScormCPReference(ModuleConfiguration config, boolean strict) {
    if (config == null) throw new AssertException("missing config in CP");
    String repoSoftkey = (String) config.get(ScormEditController.CONFIG_KEY_REPOSITORY_SOFTKEY);
    if (repoSoftkey == null) throw new AssertException("invalid config when being asked for references");
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, strict);
    // entry can be null only if !strict
    return entry;
  }
View Full Code Here

   
    // grab any shared folder that is configured
    OlatRootFolderImpl sharedFolder = null;
    String sfSoftkey = getCourseConfig().getSharedFolderSoftkey();
    if (sfSoftkey != null) {
      RepositoryManager rm = RepositoryManager.getInstance();
      RepositoryEntry re = rm.lookupRepositoryEntryBySoftkey(sfSoftkey, false);
      if (re != null) {
        sharedFolder = SharedFolderManager.getInstance().getSharedFolder(re.getOlatResource());
        if (sharedFolder != null){
          sharedFolder.setLocalSecurityCallback(new ReadOnlyCallback());
          //add local course folder's children as read/write source and any sharedfolder as subfolder
View Full Code Here

    // export learning groups
    PersistingCourseGroupManager.getInstance(this).exportCourseLeaningGroups(fExportedDataDir);
    // export right groups
    PersistingCourseGroupManager.getInstance(this).exportCourseRightGroups(fExportedDataDir);
    // export repo metadata
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry myRE = rm.lookupRepositoryEntry(this, true);
    RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(myRE, fExportedDataDir);
    importExport.exportDoExportProperties();
   
    //OLAT-5368: do intermediate commit to avoid transaction timeout
    // discussion intermediatecommit vs increased transaction timeout:
View Full Code Here

  public String getMountPoint() { return MOUNTPOINT; }

  public VFSContainer getContainer(Identity identity) {
    MergeSource cfRoot = new MergeSource(null, null);
    RepositoryManager rm = RepositoryManager.getInstance();
    List courseEntries = rm.queryByOwner(identity, CourseModule.getCourseTypeName());
   
    for (Iterator iter = courseEntries.iterator(); iter.hasNext();) {
      RepositoryEntry re = (RepositoryEntry) iter.next();
      OLATResourceable res = re.getOlatResource();
      ICourse course = CourseFactory.loadCourse(res.getResourceableId());
View Full Code Here

   */
  public VFSContainer getContainer(Identity identity) {
    MergeSource rootContainer = new MergeSource(null, "root");

    SharedFolderManager sfm = SharedFolderManager.getInstance();
    RepositoryManager repoManager = RepositoryManager.getInstance();
    List<RepositoryEntry> ownerEntries = (List<RepositoryEntry>) repoManager.queryByOwner(identity, SharedFolderFileResource.TYPE_NAME);
    for (RepositoryEntry repoEntry : ownerEntries) {
      rootContainer.addContainer(sfm.getNamedSharedFolder(repoEntry));
    }

    // see /olat3/webapp/WEB-INF/olat_extensions.xml
    if (publiclyReadableFolders != null && publiclyReadableFolders.size() > 0) {
      // Temporarily save added entries. This is needed to make sure not to add
      // an
      // entry twice.
      List<RepositoryEntry> addedEntries = new ArrayList<RepositoryEntry>(ownerEntries);
      //
      String firstItem = publiclyReadableFolders.get(0);
      // If the first value in the list is '*', list all resource folders.
      if (firstItem != null && firstItem.equals("*")) {
        // fake role that represents normally logged in user
        Roles registeredUserRole = new Roles(false, false, false, false, false, false);
        List<RepositoryEntry> allEntries = (List<RepositoryEntry>) repoManager.queryByTypeLimitAccess(SharedFolderFileResource.TYPE_NAME,
            registeredUserRole);
        for (RepositoryEntry entry : allEntries) {
          addReadonlyFolder(rootContainer, entry, sfm, addedEntries);
        }
      } else {
        // only list the specified folders
        for (String folder : publiclyReadableFolders) {
          try {
            Long repoKey = Long.parseLong(folder);
            RepositoryEntry entry = repoManager.lookupRepositoryEntry(repoKey);
            if (entry != null) {
              if (entry.getAccess() >= RepositoryEntry.ACC_USERS) {
                // add folder (which is a repo entry) to root container if not
                // present
                addReadonlyFolder(rootContainer, entry, sfm, addedEntries);
View Full Code Here

     * problems: A tries to reference this test, after test editor has been
     * started
     */
    changeEmail = new ContactMessage(ureq.getIdentity());

    RepositoryManager rm = RepositoryManager.getInstance();
    // the owners of this qtiPkg
    RepositoryEntry myEntry = rm.lookupRepositoryEntry(qtiPackage.getRepresentingResourceable(), false);
    SecurityGroup qtiPkgOwners = myEntry.getOwnerGroup();

    // add qti resource owners as group
    ContactList cl = new ContactList("qtiPkgOwners");
    cl.addAllIdentites(ManagerFactory.getManager().getIdentitiesOfSecurityGroup(qtiPkgOwners));
    changeEmail.addEmailTo(cl);

    StringBuilder result = new StringBuilder();
    result.append(translate("qti.restricted.leading"));
    for (Iterator iter = referencees.iterator(); iter.hasNext();) {
      ReferenceImpl element = (ReferenceImpl) iter.next();
      // FIXME:discuss:possible performance/cache problem
      if ("CourseModule".equals(element.getSource().getResourceableTypeName())) {
        ICourse course = CourseFactory.loadCourse(element.getSource().getResourceableId());

        // the course owners

        RepositoryEntry entry = rm.lookupRepositoryEntry(course, false);
        String courseTitle = course.getCourseTitle();
        SecurityGroup owners = entry.getOwnerGroup();
        List stakeHoldersIds = ManagerFactory.getManager().getIdentitiesOfSecurityGroup(owners);

        // add stakeholders as group
View Full Code Here

      return null;
    }
    File courseExportData = ImportCourseController.getExportDataDir(course);
    // get the export data directory
    // create the repository entry
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry re = rm.createRepositoryEntryInstance("administrator");
    RepositoryEntryImportExport importExport = new RepositoryEntryImportExport(courseExportData);
    String softKey = importExport.getSoftkey();
    RepositoryEntry existingEntry = rm.lookupRepositoryEntryBySoftkey(softKey, false);
    if (existingEntry != null) {
      Tracing.logInfo("RepositoryEntry with softkey " + softKey + " already exists. Course will not be deployed.", CourseFactory.class);
      CourseFactory.deleteCourse(newCourseResource);
      return existingEntry;
    }
    // ok, continue import
    newCourseResource = OLATResourceManager.getInstance().findOrPersistResourceable(newCourseResource);
    re.setOlatResource(newCourseResource);
    re.setSoftkey(softKey);
    re.setInitialAuthor(importExport.getInitialAuthor());
    re.setDisplayname(importExport.getDisplayName());
    re.setResourcename(importExport.getResourceName());
    re.setDescription(importExport.getDescription());
    re.setCanLaunch(true);
   
    // set access configuration
    re.setAccess(access);
   
    course = openCourseEditSession(course.getResourceableId());
    // create group management
    CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager();
    cgm.createCourseGroupmanagement(course.getResourceableId().toString());
    // import groups
    cgm.importCourseLearningGroups(courseExportData);
    cgm.importCourseRightGroups(courseExportData);

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
    securityManager.createAndPersistPolicy(ownerGroup, Constants.PERMISSION_ACCESS, ownerGroup);
    // members of this group are always authors also
    securityManager.createAndPersistPolicy(ownerGroup, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR);
    securityManager.addIdentityToSecurityGroup(securityManager.findIdentityByName("administrator"), ownerGroup);
    re.setOwnerGroup(ownerGroup);
    // save the repository entry
    rm.saveRepositoryEntry(re);
    // Create course admin policy for owner group of repository entry
    // -> All owners of repository entries are course admins
    securityManager.createAndPersistPolicy(re.getOwnerGroup(), Constants.PERMISSION_ADMIN, re.getOlatResource());
   
    // deploy any referenced repository entries of the editor structure. This will also
View Full Code Here

   * @return The help-course run controller
   */
  public static Controller createHelpCourseLaunchController(UserRequest ureq, WindowControl wControl) {
    // Find repository entry for this course
    String helpCourseSoftKey = CourseModule.getHelpCourseSoftKey();
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = null;
    if (helpCourseSoftKey != null) {
      entry = rm.lookupRepositoryEntryBySoftkey(helpCourseSoftKey, false);
    }
    if (entry == null) {
      wControl.setError("error.helpcourse.not.configured");
      // create empty main controller
      LayoutMain3ColsController emptyCtr = new LayoutMain3ColsController(ureq, wControl, null, null, null, null);
      return emptyCtr;
    } else {
      // Increment launch counter
      rm.incrementLaunchCounter(entry);
      OLATResource ores = entry.getOlatResource();
      ICourse course = loadCourse(ores);
     
      ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(entry);
      WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, wControl)
View Full Code Here

TOP

Related Classes of org.olat.repository.RepositoryManager

Copyright © 2018 www.massapicom. 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.