Search in sources :

Example 21 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class AbstractFeedCourseNode method getReferencedRepositoryEntry.

/**
 * @see org.olat.course.nodes.CourseNode#getReferencedRepositoryEntry()
 */
@Override
public RepositoryEntry getReferencedRepositoryEntry() {
    this.config = getModuleConfiguration();
    String repoSoftkey = (String) config.get(CONFIG_KEY_REPOSITORY_SOFTKEY);
    RepositoryManager rm = RepositoryManager.getInstance();
    RepositoryEntry entry = rm.lookupRepositoryEntryBySoftkey(repoSoftkey, false);
    return entry;
}
Also used : RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 22 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchByOwnerLimitAccess.

/**
 * Do search for all resources of a given type where identity is owner.
 * @param owner
 * @param access
 */
public void doSearchByOwnerLimitAccess(Identity owner) {
    RepositoryManager rm = RepositoryManager.getInstance();
    List<RepositoryEntry> entries = rm.queryByOwnerLimitAccess(owner, RepositoryEntry.ACC_USERS, Boolean.TRUE);
    filterRepositoryEntries(entries);
    repoTableModel.setObjects(entries);
    tableCtr.setFilters(null, null);
    tableCtr.modelChanged();
    displaySearchResults(null);
}
Also used : RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 23 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchAllReferencables.

/**
 * Implementation of referencable search: find repo entries that are
 * owned by the uer or set to referencable and have at lease BA settings
 * @param ureq
 */
private void doSearchAllReferencables(UserRequest ureq, String limitType, boolean updateFilters) {
    searchType = SearchType.searchForm;
    RepositoryManager rm = RepositoryManager.getInstance();
    List<String> restrictedTypes;
    if (limitType != null) {
        restrictedTypes = Collections.singletonList(limitType);
    } else {
        Collection<String> s = searchForm.getRestrictedTypes();
        restrictedTypes = (s == null) ? null : new ArrayList<String>(s);
    }
    Roles roles = ureq.getUserSession().getRoles();
    Identity ident = ureq.getIdentity();
    String name = searchForm.getDisplayName();
    String author = searchForm.getAuthor();
    String desc = searchForm.getDescription();
    List<RepositoryEntry> entries;
    if (searchForm.isAdminSearch()) {
        entries = rm.queryResourcesLimitType(null, restrictedTypes, name, author, desc, true, false);
    } else if (enableSearchforAllInSearchForm == Can.referenceable) {
        entries = rm.queryReferencableResourcesLimitType(ident, roles, restrictedTypes, name, author, desc);
    } else if (enableSearchforAllInSearchForm == Can.copyable) {
        entries = rm.queryCopyableResourcesLimitType(ident, roles, restrictedTypes, name, author, desc);
    } else {
        entries = new ArrayList<RepositoryEntry>();
    }
    filterRepositoryEntries(entries);
    repoTableModel.setObjects(entries);
    if (updateFilters) {
        updateFilters(entries, null);
    }
    tableCtr.modelChanged();
    displaySearchResults(ureq);
}
Also used : ArrayList(java.util.ArrayList) RepositoryManager(org.olat.repository.RepositoryManager) Roles(org.olat.core.id.Roles) RepositoryEntry(org.olat.repository.RepositoryEntry) Identity(org.olat.core.id.Identity)

Example 24 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchForReferencableResourcesLimitType.

/**
 * Do search for all resources that the user can reference either because he
 * is the owner of the resource or because he has author rights and the resource
 * is set to at least BA in the BARG settings and the resource has the flag
 * 'canReference' set to true.
 * @param owner The current identity
 * @param limitTypes List of Types to limit the search
 * @param roles The users roles
 */
public void doSearchForReferencableResourcesLimitType(Identity owner, String[] limitTypes, Roles roles) {
    RepositoryManager rm = RepositoryManager.getInstance();
    List<String> restrictedTypes = new ArrayList<String>();
    if (limitTypes == null) {
        restrictedTypes = null;
    } else {
        restrictedTypes.addAll(Arrays.asList(limitTypes));
    }
    List<RepositoryEntry> entries = rm.queryReferencableResourcesLimitType(owner, roles, restrictedTypes, null, null, null);
    filterRepositoryEntries(entries);
    repoTableModel.setObjects(entries);
    tableCtr.setFilters(null, null);
    tableCtr.modelChanged();
    displaySearchResults(null);
}
Also used : ArrayList(java.util.ArrayList) RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 25 with RepositoryManager

use of org.olat.repository.RepositoryManager in project OpenOLAT by OpenOLAT.

the class RepositorySearchController method doSearchByTypeLimitAccess.

/**
 * Used by repository main controller to execute predefined searches.
 *
 * @param restrictedTypes
 * @param ureq
 */
public void doSearchByTypeLimitAccess(String[] restrictedTypes, UserRequest ureq) {
    searchType = null;
    RepositoryManager rm = RepositoryManager.getInstance();
    List<String> types = Arrays.asList(restrictedTypes);
    List<RepositoryEntry> entries = rm.queryByTypeLimitAccess(ureq.getIdentity(), ureq.getUserSession().getRoles(), types);
    filterRepositoryEntries(entries);
    repoTableModel.setObjects(entries);
    tableCtr.setFilters(null, null);
    tableCtr.modelChanged();
    displaySearchResults(ureq);
}
Also used : RepositoryManager(org.olat.repository.RepositoryManager) RepositoryEntry(org.olat.repository.RepositoryEntry)

Aggregations

RepositoryManager (org.olat.repository.RepositoryManager)136 RepositoryEntry (org.olat.repository.RepositoryEntry)122 Path (javax.ws.rs.Path)42 Identity (org.olat.core.id.Identity)32 Produces (javax.ws.rs.Produces)30 Roles (org.olat.core.id.Roles)30 RestSecurityHelper.getIdentity (org.olat.restapi.security.RestSecurityHelper.getIdentity)26 ArrayList (java.util.ArrayList)20 Consumes (javax.ws.rs.Consumes)20 PUT (javax.ws.rs.PUT)18 MailPackage (org.olat.core.util.mail.MailPackage)16 GET (javax.ws.rs.GET)14 BaseSecurity (org.olat.basesecurity.BaseSecurity)14 AssertException (org.olat.core.logging.AssertException)14 SearchRepositoryEntryParameters (org.olat.repository.model.SearchRepositoryEntryParameters)14 IdentitiesAddEvent (org.olat.admin.securitygroup.gui.IdentitiesAddEvent)12 Controller (org.olat.core.gui.control.Controller)12 OLATResourceable (org.olat.core.id.OLATResourceable)12 UserRequest (org.olat.core.gui.UserRequest)10 WindowControl (org.olat.core.gui.control.WindowControl)10