Search in sources :

Example 41 with Collection

use of io.lumeer.api.model.Collection in project engine by Lumeer.

the class CollectionFacade method deleteCollectionAttribute.

public void deleteCollectionAttribute(String collectionId, String attributeFullName) {
    Collection collection = collectionDao.getCollectionById(collectionId);
    permissionsChecker.checkRole(collection, Role.MANAGE);
    collection.deleteAttribute(attributeFullName);
    collectionDao.updateCollection(collection.getId(), collection);
}
Also used : Collection(io.lumeer.api.model.Collection)

Example 42 with Collection

use of io.lumeer.api.model.Collection in project engine by Lumeer.

the class CollectionFacade method updateUserPermissions.

public Set<Permission> updateUserPermissions(final String collectionId, final Permission... userPermissions) {
    Collection collection = collectionDao.getCollectionById(collectionId);
    permissionsChecker.checkRole(collection, Role.MANAGE);
    collection.getPermissions().updateUserPermissions(userPermissions);
    Collection updatedCollection = collectionDao.updateCollection(collection.getId(), collection);
    return updatedCollection.getPermissions().getUserPermissions();
}
Also used : Collection(io.lumeer.api.model.Collection)

Example 43 with Collection

use of io.lumeer.api.model.Collection in project engine by Lumeer.

the class CollectionFacade method updateGroupPermissions.

public Set<Permission> updateGroupPermissions(final String collectionId, final Permission... groupPermissions) {
    Collection collection = collectionDao.getCollectionById(collectionId);
    permissionsChecker.checkRole(collection, Role.MANAGE);
    collection.getPermissions().updateGroupPermissions(groupPermissions);
    Collection updatedCollection = collectionDao.updateCollection(collection.getId(), collection);
    return updatedCollection.getPermissions().getGroupPermissions();
}
Also used : Collection(io.lumeer.api.model.Collection)

Example 44 with Collection

use of io.lumeer.api.model.Collection in project engine by Lumeer.

the class CollectionFacade method removeUserPermission.

public void removeUserPermission(final String collectionId, final String user) {
    Collection collection = collectionDao.getCollectionById(collectionId);
    permissionsChecker.checkRole(collection, Role.MANAGE);
    collection.getPermissions().removeUserPermission(user);
    collectionDao.updateCollection(collection.getId(), collection);
}
Also used : Collection(io.lumeer.api.model.Collection)

Example 45 with Collection

use of io.lumeer.api.model.Collection in project engine by Lumeer.

the class CollectionFacade method removeGroupPermission.

public void removeGroupPermission(final String collectionId, final String group) {
    Collection collection = collectionDao.getCollectionById(collectionId);
    permissionsChecker.checkRole(collection, Role.MANAGE);
    collection.getPermissions().removeGroupPermission(group);
    collectionDao.updateCollection(collection.getId(), collection);
}
Also used : Collection(io.lumeer.api.model.Collection)

Aggregations

Collection (io.lumeer.api.model.Collection)77 Test (org.junit.Test)47 JsonCollection (io.lumeer.api.dto.JsonCollection)34 DataDocument (io.lumeer.engine.api.data.DataDocument)17 MorphiaCollection (io.lumeer.storage.mongodb.model.MorphiaCollection)17 SearchQuery (io.lumeer.storage.api.query.SearchQuery)14 SoftAssertions (org.assertj.core.api.SoftAssertions)12 Document (io.lumeer.api.model.Document)8 ImportedCollection (io.lumeer.api.model.ImportedCollection)8 SuggestionQuery (io.lumeer.storage.api.query.SuggestionQuery)8 Response (javax.ws.rs.core.Response)8 JsonAttribute (io.lumeer.api.dto.JsonAttribute)7 Attribute (io.lumeer.api.model.Attribute)7 HashSet (java.util.HashSet)6 JsonQuery (io.lumeer.api.dto.JsonQuery)5 LocalDateTime (java.time.LocalDateTime)4 List (java.util.List)4 JsonDocument (io.lumeer.api.dto.JsonDocument)3 LinkType (io.lumeer.api.model.LinkType)3 CollectionDao (io.lumeer.storage.api.dao.CollectionDao)3