authz changes
This commit is contained in:
parent
a0554724a8
commit
cfbd3233ec
|
@ -4,5 +4,5 @@ import java.util.EnumSet;
|
|||
|
||||
public enum AuthorizationFlags {
|
||||
None, Permission, DmpAssociated, Public, Owner;
|
||||
public static final EnumSet<AuthorizationFlags> OwnerOrDmpAssociatedOrPermissionOrPublic = EnumSet.of(DmpAssociated, Permission, Public, Owner);
|
||||
public static final EnumSet<AuthorizationFlags> OwnerOrDmpAssociatedOrPermission = EnumSet.of(DmpAssociated, Permission, Owner);
|
||||
}
|
||||
|
|
|
@ -3,15 +3,11 @@ package eu.eudat.authorization;
|
|||
public final class Permission {
|
||||
/////// Should Remove after Refactor
|
||||
|
||||
public static String AnonymousRole = "AnonymousRole";
|
||||
public static String AdminRole = "AdminRole";
|
||||
public static String ManagerRole = "ManagerRole";
|
||||
public static String UserRole = "UserRole";
|
||||
public static String AuthenticatedRole = "AuthenticatedRole";
|
||||
public static String PublicRole = "PublicRole";
|
||||
public static String DatasetProfileManagerRole = "DatasetProfileManagerRole";
|
||||
|
||||
/////
|
||||
public static String DeferredAffiliation = "DeferredAffiliation";
|
||||
|
||||
//Public
|
||||
public static String PublicBrowseDescription = "PublicBrowseDescription";
|
||||
|
@ -73,6 +69,8 @@ public final class Permission {
|
|||
//Dmp
|
||||
public static String BrowseDmp = "BrowseDmp";
|
||||
public static String EditDmp = "EditDmp";
|
||||
public static String NewDmp = "NewDmp";
|
||||
|
||||
public static String DeleteDmp = "DeleteDmp";
|
||||
public static String CloneDmp = "CloneDmp";
|
||||
public static String CreateNewVersionDmp = "CreateNewVersionDmp";
|
||||
|
|
|
@ -98,7 +98,7 @@ public class ReferenceEntity extends TenantScopedBaseEntity {
|
|||
@Column(name = "created_by", columnDefinition = "uuid")
|
||||
private UUID createdById;
|
||||
|
||||
public static final String _createdById = "createdBy";
|
||||
public static final String _createdById = "createdById";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DescriptionCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDescription);
|
||||
this.authService.authorizeForce(Permission.BrowseDescription, Permission.DeferredAffiliation);
|
||||
|
||||
FieldSet descriptionReferenceFields = fields.extractPrefixed(this.asIndexerPrefix(Description._descriptionReferences));
|
||||
this.censorFactory.censor(DescriptionReferenceCensor.class).censor(descriptionReferenceFields, userId);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DmpCensor extends BaseCensor {
|
|||
if (fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDmp);
|
||||
this.authService.authorizeForce(Permission.BrowseDmp, Permission.DeferredAffiliation);
|
||||
|
||||
FieldSet dmpUsersFields = fields.extractPrefixed(this.asIndexerPrefix(Dmp._dmpUsers));
|
||||
this.censorFactory.censor(DmpUserCensor.class).censor(dmpUsersFields, userId);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DmpDescriptionTemplateCensor extends BaseCensor{
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDescription);
|
||||
this.authService.authorizeForce(Permission.BrowseDescription, Permission.DeferredAffiliation);
|
||||
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpDescriptionTemplate._dmp));
|
||||
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
|
||||
FieldSet descriptionTemplatesFields = fields.extractPrefixed(this.asIndexerPrefix(DmpDescriptionTemplate._descriptionTemplates));
|
||||
|
|
|
@ -38,7 +38,7 @@ public class DmpReferenceCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDmpDescriptionTemplate);
|
||||
this.authService.authorizeForce(Permission.BrowseDmpDescriptionTemplate, Permission.DeferredAffiliation);
|
||||
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._dmp));
|
||||
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
|
||||
FieldSet templateFields = fields.extractPrefixed(this.asIndexerPrefix(DmpReference._reference));
|
||||
|
|
|
@ -37,7 +37,7 @@ public class DmpUserCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseDmpUser);
|
||||
this.authService.authorizeForce(Permission.BrowseDmpUser, Permission.DeferredAffiliation);
|
||||
FieldSet dmpFields = fields.extractPrefixed(this.asIndexerPrefix(DmpUser._dmp));
|
||||
this.censorFactory.censor(DmpCensor.class).censor(dmpFields, userId);
|
||||
FieldSet userFields = fields.extractPrefixed(this.asIndexerPrefix(DmpUser._user));
|
||||
|
|
|
@ -31,6 +31,6 @@ public class EntityDoiCensor extends BaseCensor{
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseEntityDoi);
|
||||
this.authService.authorizeForce(Permission.BrowseEntityDoi, Permission.DeferredAffiliation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ReferenceTypeCensor extends BaseCensor {
|
|||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
|
||||
this.authService.authorizeForce(Permission.BrowseReferenceType);
|
||||
this.authService.authorizeForce(Permission.BrowseReferenceType, Permission.DeferredAffiliation);
|
||||
FieldSet definitionFields = fields.extractPrefixed(this.asIndexerPrefix(ReferenceType._definition));
|
||||
this.censorFactory.censor(ReferenceTypeDefinitionCensor.class).censor(definitionFields, userId);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class UserCensor extends BaseCensor {
|
|||
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||
if (fields == null || fields.isEmpty())
|
||||
return;
|
||||
this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseUser);
|
||||
this.authService.authorizeAtLeastOneForce(userId != null ? List.of(new OwnedResource(userId)) : null, Permission.BrowseUser, Permission.DeferredAffiliation);
|
||||
|
||||
FieldSet rolesFields = fields.extractPrefixed(this.asIndexerPrefix(User._roles));
|
||||
this.censorFactory.censor(UserRoleCensor.class).censor(rolesFields, userId);
|
||||
|
|
|
@ -5,9 +5,12 @@ import eu.eudat.authorization.Permission;
|
|||
import eu.eudat.commons.enums.DmpUserRole;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.DmpReferenceEntity;
|
||||
import eu.eudat.data.DmpUserEntity;
|
||||
import eu.eudat.data.ReferenceEntity;
|
||||
import eu.eudat.model.DmpUser;
|
||||
import eu.eudat.model.PublicDmpUser;
|
||||
import eu.eudat.query.utils.BuildSubQueryInput;
|
||||
import eu.eudat.query.utils.QueryUtilsService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.query.FieldResolver;
|
||||
|
@ -173,7 +176,7 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
|||
if (userId != null || usePublic ) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
usePublic ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildPublicDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, usePublic)) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
||||
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(DmpUserEntity._userId), userId) : queryContext.CriteriaBuilder.or() //Creates a false query
|
||||
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildDmpUserAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId)) : queryContext.CriteriaBuilder.or() //Creates a false query
|
||||
));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
|
@ -183,7 +186,7 @@ public class DmpUserQuery extends QueryBase<DmpUserEntity> {
|
|||
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.enums.EntityType;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.data.EntityDoiEntity;
|
||||
import eu.eudat.data.*;
|
||||
import eu.eudat.model.Dmp;
|
||||
import eu.eudat.model.EntityDoi;
|
||||
import eu.eudat.query.utils.BuildSubQueryInput;
|
||||
import eu.eudat.query.utils.QueryUtilsService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.query.FieldResolver;
|
||||
import gr.cite.tools.data.query.QueryBase;
|
||||
|
@ -151,10 +153,19 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
|
||||
|
||||
|
||||
public EntityDoiQuery(
|
||||
) {
|
||||
UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService) {
|
||||
this.userScope = userScope;
|
||||
this.authService = authService;
|
||||
this.queryUtilsService = queryUtilsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -167,6 +178,27 @@ public class EntityDoiQuery extends QueryBase<EntityDoiEntity> {
|
|||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives)|| this.isEmpty(this.repositoryIds) || this.isEmpty(this.excludedIds) || this.isEmpty(this.types);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
||||
if (this.authorize.contains(AuthorizationFlags.None)) return null;
|
||||
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseUser)) return null;
|
||||
UUID userId;
|
||||
if (this.authorize.contains(AuthorizationFlags.Owner)) userId = this.userScope.getUserIdSafe();
|
||||
else userId = null;
|
||||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
||||
if (userId != null || usePublic) {
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(EntityDoiEntity._entityId)).value( queryContext.CriteriaBuilder.in(queryContext.Root.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||
} else {
|
||||
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
package eu.eudat.query;
|
||||
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.enums.DmpAccessType;
|
||||
import eu.eudat.commons.enums.DmpStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.ReferenceSourceType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.data.DmpReferenceEntity;
|
||||
import eu.eudat.data.DmpUserEntity;
|
||||
import eu.eudat.data.ReferenceEntity;
|
||||
import eu.eudat.model.PublicReference;
|
||||
import eu.eudat.model.Reference;
|
||||
import eu.eudat.query.utils.BuildSubQueryInput;
|
||||
import eu.eudat.query.utils.QueryUtilsService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.query.FieldResolver;
|
||||
import gr.cite.tools.data.query.QueryBase;
|
||||
import gr.cite.tools.data.query.QueryContext;
|
||||
|
@ -163,9 +172,16 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
this.authorize = values;
|
||||
return this;
|
||||
}
|
||||
private final UserScope userScope;
|
||||
|
||||
private final AuthorizationService authService;
|
||||
private final QueryUtilsService queryUtilsService;
|
||||
|
||||
public ReferenceQuery(
|
||||
) {
|
||||
UserScope userScope, AuthorizationService authService, QueryUtilsService queryUtilsService) {
|
||||
this.userScope = userScope;
|
||||
this.authService = authService;
|
||||
this.queryUtilsService = queryUtilsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,6 +194,38 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
|
|||
return this.isEmpty(this.ids) || this.isEmpty(this.isActives) || this.isEmpty(this.sources) ||this.isEmpty(this.excludedIds) || this.isEmpty(this.typeIds) || this.isEmpty(this.referenceSourceTypes)|| this.isFalseQuery(this.dmpReferenceQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X, Y> Predicate applyAuthZ(QueryContext<X, Y> queryContext) {
|
||||
if (this.authorize.contains(AuthorizationFlags.None)) return null;
|
||||
if (this.authorize.contains(AuthorizationFlags.Permission) && this.authService.authorize(Permission.BrowseReference)) return null;
|
||||
UUID userId;
|
||||
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
||||
if (this.authorize.contains(AuthorizationFlags.DmpAssociated)) userId = this.userScope.getUserIdSafe();
|
||||
else userId = null;
|
||||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
if (userId != null || usePublic ) {
|
||||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
queryContext.CriteriaBuilder.isNull(queryContext.Root.get(ReferenceEntity._createdById)),
|
||||
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
||||
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class)
|
||||
.query(queryContext.Query)
|
||||
.criteriaBuilder(queryContext.CriteriaBuilder)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpReferenceEntity._referenceId))
|
||||
.filterFunc((subQueryRoot, cb) ->
|
||||
cb.in(subQueryRoot.get(DmpReferenceEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, userId, usePublic))
|
||||
)
|
||||
))) : queryContext.CriteriaBuilder.or() //Creates a false query
|
||||
));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
return queryContext.CriteriaBuilder.and(predicatesArray);
|
||||
} else {
|
||||
return queryContext.CriteriaBuilder.or(); //Creates a false query
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
|
|
|
@ -155,10 +155,19 @@ public class UserQuery extends QueryBase<UserEntity> {
|
|||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
boolean usePublic = this.authorize.contains(AuthorizationFlags.Public);
|
||||
if (usePublic){
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._isActive)).value(IsActive.Active));
|
||||
}else if (userId != null) {
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userId));
|
||||
if (userId != null || usePublic) {
|
||||
UUID finalUserId = userId;
|
||||
predicates.add(queryContext.CriteriaBuilder.or(
|
||||
userId != null ? queryContext.CriteriaBuilder.in(queryContext.Root.get(UserEntity._id)).value(userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
|
||||
queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpUserEntity.class, UUID.class)
|
||||
.query(queryContext.Query)
|
||||
.criteriaBuilder(queryContext.CriteriaBuilder)
|
||||
.keyPathFunc((subQueryRoot) -> subQueryRoot.get(DmpUserEntity._userId))
|
||||
.filterFunc((subQueryRoot, cb) ->
|
||||
cb.in(subQueryRoot.get(DmpUserEntity._dmpId)).value(queryUtilsService.buildDmpAuthZSubQuery(queryContext.Query, queryContext.CriteriaBuilder, finalUserId, usePublic))
|
||||
)
|
||||
)))
|
||||
));
|
||||
}
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
|
|
@ -3,14 +3,10 @@ package eu.eudat.service.dashborad;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.OwnedResource;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.JsonHandlingService;
|
||||
import eu.eudat.commons.XmlHandlingService;
|
||||
import eu.eudat.commons.enums.*;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.commons.types.dashborad.RecentActivityItemEntity;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||
import eu.eudat.event.EventBroker;
|
||||
import eu.eudat.model.*;
|
||||
import eu.eudat.model.builder.PublicReferenceTypeBuilder;
|
||||
import eu.eudat.model.builder.RecentActivityItemBuilder;
|
||||
|
@ -21,15 +17,12 @@ import eu.eudat.query.lookup.DmpLookup;
|
|||
import eu.eudat.service.elastic.ElasticQueryHelperService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||
import gr.cite.tools.data.query.QueryFactory;
|
||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.management.InvalidApplicationException;
|
||||
|
@ -76,14 +69,14 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
List<RecentActivityItemEntity> recentActivityItemEntities = new ArrayList<>();
|
||||
DescriptionLookup descriptionLookup = model.asDescriptionLookup();
|
||||
descriptionLookup.getPage().setOffset(0);
|
||||
QueryResult<Description> descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(Description._status).ensure(Description._label));
|
||||
QueryResult<Description> descriptions = this.elasticQueryHelperService.collect(descriptionLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Description._id).ensure(Description._updatedAt).ensure(Description._status).ensure(Description._label));
|
||||
if (!this.conventionService.isListNullOrEmpty(descriptions.getItems())) {
|
||||
for (Description description : descriptions.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Description, description.getId(), description.getUpdatedAt(), description.getLabel(), description.getStatus().getValue()));
|
||||
}
|
||||
|
||||
DmpLookup dmpLookup = model.asDmpLookup();
|
||||
dmpLookup.getPage().setOffset(0);
|
||||
QueryResult<Dmp> dmps = this.elasticQueryHelperService.collect(dmpLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic, new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._updatedAt).ensure(Dmp._label).ensure(Dmp._status));
|
||||
QueryResult<Dmp> dmps = this.elasticQueryHelperService.collect(dmpLookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, new BaseFieldSet().ensure(Dmp._id).ensure(Dmp._updatedAt).ensure(Dmp._label).ensure(Dmp._status));
|
||||
if (!this.conventionService.isListNullOrEmpty(dmps.getItems())) {
|
||||
for (Dmp dmp : dmps.getItems()) recentActivityItemEntities.add(new RecentActivityItemEntity(RecentActivityItemType.Dmp, dmp.getId(), dmp.getUpdatedAt(), dmp.getLabel(), dmp.getStatus().getValue()));
|
||||
}
|
||||
|
@ -102,7 +95,7 @@ public class DashboardServiceImpl implements DashboardService {
|
|||
if (model.getPage() != null){
|
||||
recentActivityItemEntities = recentActivityItemEntities.stream().skip(model.getPage().getOffset()).limit(model.getPage().getSize()).toList();
|
||||
}
|
||||
return this.builderFactory.builder(RecentActivityItemBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(model.getProject()), recentActivityItemEntities);
|
||||
return this.builderFactory.builder(RecentActivityItemBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(model.getProject()), recentActivityItemEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,20 +3,14 @@ package eu.eudat.service.deposit;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commonmodels.models.FileEnvelopeModel;
|
||||
import eu.eudat.commonmodels.models.description.DescriptionModel;
|
||||
import eu.eudat.commonmodels.models.description.FieldModel;
|
||||
import eu.eudat.commonmodels.models.description.PropertyDefinitionFieldSetItemModel;
|
||||
import eu.eudat.commonmodels.models.description.PropertyDefinitionFieldSetModel;
|
||||
import eu.eudat.commonmodels.models.dmp.DmpModel;
|
||||
import eu.eudat.commons.enums.StorageType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.configurations.deposit.DepositProperties;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.DescriptionTemplateEntity;
|
||||
import eu.eudat.data.DmpEntity;
|
||||
import eu.eudat.depositinterface.repository.DepositClient;
|
||||
import eu.eudat.depositinterface.repository.DepositConfiguration;
|
||||
import eu.eudat.model.DescriptionTemplate;
|
||||
import eu.eudat.model.EntityDoi;
|
||||
import eu.eudat.model.StorageFile;
|
||||
import eu.eudat.model.builder.commonmodels.DepositConfigurationBuilder;
|
||||
|
@ -25,7 +19,6 @@ import eu.eudat.model.persist.StorageFilePersist;
|
|||
import eu.eudat.model.persist.deposit.DepositAuthenticateRequest;
|
||||
import eu.eudat.model.persist.deposit.DepositRequest;
|
||||
import eu.eudat.model.persist.EntityDoiPersist;
|
||||
import eu.eudat.query.DescriptionTemplateQuery;
|
||||
import eu.eudat.query.DmpQuery;
|
||||
import eu.eudat.service.entitydoi.EntityDoiService;
|
||||
import eu.eudat.service.storage.StorageFileProperties;
|
||||
|
@ -55,7 +48,6 @@ import java.net.URI;
|
|||
import java.net.URLConnection;
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DepositServiceImpl implements DepositService {
|
||||
|
@ -182,7 +174,7 @@ public class DepositServiceImpl implements DepositService {
|
|||
}
|
||||
|
||||
//GK: Fifth Transform them to the DepositModel
|
||||
DmpModel depositModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic)
|
||||
DmpModel depositModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(depositClient.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission)
|
||||
.setRepositoryId(dmpDepositModel.getRepositoryId()).setPdfFile(pdfEnvelope).setRdaJsonFile(jsonEnvelope).build(dmpEntity);
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import eu.eudat.data.*;
|
|||
import eu.eudat.errorcode.ErrorThesaurusProperties;
|
||||
import eu.eudat.event.DescriptionTouchedEvent;
|
||||
import eu.eudat.event.EventBroker;
|
||||
import eu.eudat.integrationevent.outbox.descriptiontouched.DescriptionTouchedIntegrationEvent;
|
||||
import eu.eudat.integrationevent.outbox.descriptiontouched.DescriptionTouchedIntegrationEventHandler;
|
||||
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEvent;
|
||||
import eu.eudat.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
|
||||
|
@ -208,7 +207,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
this.descriptionTouchedIntegrationEventHandler.handle(DescriptionTouchedIntegrationEventHandler.buildEventFromPersistModel(model));
|
||||
|
||||
this.elasticService.persistDescription(data);
|
||||
return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Description._id), data);
|
||||
return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Description._id), data);
|
||||
}
|
||||
|
||||
private void sendNotification(DescriptionEntity description) throws InvalidApplicationException {
|
||||
|
@ -358,7 +357,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
this.elasticService.persistDescription(data);
|
||||
this.eventBroker.emit(new DescriptionTouchedEvent(data.getId()));
|
||||
}
|
||||
return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Description._id), data);
|
||||
return this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Description._id), data);
|
||||
}
|
||||
|
||||
private @NotNull PropertyDefinitionEntity buildPropertyDefinitionEntity(PropertyDefinitionPersist persist, eu.eudat.commons.types.descriptiontemplate.DefinitionEntity definition, Map<String, List<UUID>> fieldToReferenceMap){
|
||||
|
@ -746,7 +745,7 @@ public class DescriptionServiceImpl implements DescriptionService {
|
|||
public StorageFile uploadFieldFile(DescriptionFieldFilePersist model, MultipartFile file, FieldSet fields) throws IOException {
|
||||
this.authorizationService.authorizeForce(Permission.EditDescription);
|
||||
|
||||
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).ids(model.getDescriptionTemplateId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).first();
|
||||
DescriptionTemplateEntity descriptionTemplate = this.queryFactory.query(DescriptionTemplateQuery.class).ids(model.getDescriptionTemplateId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).first();
|
||||
if (descriptionTemplate == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDescriptionTemplateId(), DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
eu.eudat.commons.types.descriptiontemplate.DefinitionEntity definition = this.xmlHandlingService.fromXmlSafe(eu.eudat.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplate.getDefinition());
|
||||
|
|
|
@ -211,7 +211,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
||||
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
||||
}
|
||||
|
||||
private void updateVersionStatusAndSave(DescriptionTemplateEntity data, DescriptionTemplateStatus previousStatus, DescriptionTemplateStatus newStatus) {
|
||||
|
@ -470,8 +470,8 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
|
||||
this.authorizationService.authorizeForce(Permission.CloneDescriptionTemplate);
|
||||
|
||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fields, query.firstAs(fields));
|
||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fields, query.firstAs(fields));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -603,7 +603,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
||||
return this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplate._id), data);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
|
|
@ -106,7 +106,7 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy
|
|||
this.entityManager.flush();
|
||||
|
||||
this.eventBroker.emit(new DescriptionTemplateTypeTouchedEvent(data.getId()));
|
||||
return this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, DescriptionTemplateType._id), data);
|
||||
return this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, DescriptionTemplateType._id), data);
|
||||
}
|
||||
|
||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
|
|
|
@ -75,7 +75,6 @@ import javax.management.InvalidApplicationException;
|
|||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -200,7 +199,7 @@ public class DmpServiceImpl implements DmpService {
|
|||
this.inviteUsers(data.getId(), model.getUsers());
|
||||
}
|
||||
|
||||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||
}
|
||||
|
||||
private void sendNotification(DmpEntity dmp) throws InvalidApplicationException {
|
||||
|
@ -376,7 +375,7 @@ public class DmpServiceImpl implements DmpService {
|
|||
public Dmp buildClone(CloneDmpPersist model, FieldSet fields) throws MyForbiddenException, MyValidationException, MyApplicationException, MyNotFoundException, IOException, InvalidApplicationException {
|
||||
this.authorizationService.authorizeForce(Permission.CloneDmp);
|
||||
|
||||
DmpEntity existingDmpEntity = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(model.getId()).firstAs(fields);
|
||||
DmpEntity existingDmpEntity = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(model.getId()).firstAs(fields);
|
||||
if (!this.conventionService.isValidGuid(model.getId()) || existingDmpEntity == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -501,7 +500,7 @@ public class DmpServiceImpl implements DmpService {
|
|||
.collect();
|
||||
|
||||
this.elasticService.persistDmp(dmpEntity);
|
||||
return this.builderFactory.builder(DmpUserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fieldSet, DmpUser._id, DmpUser._hash), persisted);
|
||||
return this.builderFactory.builder(DmpUserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fieldSet, DmpUser._id, DmpUser._hash), persisted);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -522,7 +521,7 @@ public class DmpServiceImpl implements DmpService {
|
|||
if (dmpEntity == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getDmpId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
this.elasticService.persistDmp(dmpEntity);
|
||||
|
||||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -159,7 +159,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||
return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||
}
|
||||
|
||||
private void updateVersionStatusAndSave(DmpBlueprintEntity data, DmpBlueprintStatus previousStatus, DmpBlueprintStatus newStatus) {
|
||||
|
@ -336,8 +336,8 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
this.authorizationService.authorizeForce(Permission.CloneDmpBlueprint);
|
||||
|
||||
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fields, query.firstAs(fields));
|
||||
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fields, query.firstAs(fields));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -435,7 +435,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||
return this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, DmpBlueprint._id), data);
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
|
|
@ -109,7 +109,7 @@ public class EntityDoiServiceImpl implements EntityDoiService {
|
|||
this.entityManager.flush();
|
||||
|
||||
this.eventBroker.emit(new EntityDoiTouchedEvent(data.getId()));
|
||||
return this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, EntityDoi._id), data);
|
||||
return this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, EntityDoi._id), data);
|
||||
}
|
||||
|
||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
|
|
|
@ -25,16 +25,13 @@ import gr.cite.tools.logging.LoggerService;
|
|||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.annotations.FlushModeType;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
@ -99,7 +96,7 @@ public class LanguageServiceImpl implements LanguageService {
|
|||
//
|
||||
// this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Language._id), data);
|
||||
return this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Language._id), data);
|
||||
}
|
||||
|
||||
public String getPayload(String code) throws IOException {
|
||||
|
|
|
@ -11,7 +11,6 @@ import eu.eudat.model.builder.LockBuilder;
|
|||
import eu.eudat.model.deleter.LockDeleter;
|
||||
import eu.eudat.model.persist.LockPersist;
|
||||
import eu.eudat.query.LockQuery;
|
||||
import eu.eudat.query.lookup.LockLookup;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.deleter.DeleterFactory;
|
||||
|
@ -104,11 +103,11 @@ public class LockServiceImpl implements LockService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Lock._id), data);
|
||||
return this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Lock._id), data);
|
||||
}
|
||||
|
||||
public boolean isLocked(UUID target) throws InvalidApplicationException {
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).targetIds(target);
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).targetIds(target);
|
||||
if (query.count() == 1) {
|
||||
LockEntity lock = query.first();
|
||||
if (lock.getLockedBy().equals(this.userScope.getUserId())) {
|
||||
|
@ -128,7 +127,7 @@ public class LockServiceImpl implements LockService {
|
|||
|
||||
private Long forceUnlock(UUID target) throws InvalidApplicationException {
|
||||
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).targetIds(target);
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).targetIds(target);
|
||||
Long availableLocks = query.count();
|
||||
long deletedLocks = 0L;
|
||||
if (availableLocks > 0) {
|
||||
|
@ -154,7 +153,7 @@ public class LockServiceImpl implements LockService {
|
|||
|
||||
public void unlock(UUID target) throws InvalidApplicationException {
|
||||
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).targetIds(target);
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).targetIds(target);
|
||||
if (query.count() == 1) {
|
||||
LockEntity lock = query.first();
|
||||
if (!lock.getLockedBy().equals(this.userScope.getUserId())) {
|
||||
|
|
|
@ -144,7 +144,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, PrefillingSource._id), data);
|
||||
return this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, PrefillingSource._id), data);
|
||||
}
|
||||
|
||||
private @NotNull PrefillingSourceDefinitionEntity buildDefinitionEntity(PrefillingSourceDefinitionPersist persist) {
|
||||
|
@ -361,7 +361,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
|
|||
eu.eudat.commons.types.descriptiontemplate.DefinitionEntity descriptionTemplateDefinition = this.xmlHandlingService.fromXml(eu.eudat.commons.types.descriptiontemplate.DefinitionEntity.class, descriptionTemplateEntity.getDefinition());
|
||||
|
||||
Description description = new Description();
|
||||
description.setDescriptionTemplate(this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, descriptionTemplateEntity));
|
||||
description.setDescriptionTemplate(this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, descriptionTemplateEntity));
|
||||
return mapPrefilledEntityToDescription(description, descriptionTemplateDefinition, prefillingSourceDefinition, prefillingSourceEntity.getLabel(), externalData.getResults().getFirst());//TODO
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ReferenceServiceImpl implements ReferenceService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Reference._id), data);
|
||||
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Reference._id), data);
|
||||
}
|
||||
|
||||
private @NotNull DefinitionEntity buildDefinitionEntity(DefinitionPersist persist){
|
||||
|
@ -187,7 +187,7 @@ public class ReferenceServiceImpl implements ReferenceService {
|
|||
ReferenceEntity referenceEntity = buildReferenceEntityFromExternalData(result, data);
|
||||
referenceEntities.add(referenceEntity);
|
||||
}
|
||||
externalModels = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), referenceEntities);
|
||||
externalModels = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), referenceEntities);
|
||||
}
|
||||
|
||||
List<Reference> models = this.fetchReferenceFromDb(lookup);
|
||||
|
@ -236,10 +236,10 @@ public class ReferenceServiceImpl implements ReferenceService {
|
|||
}
|
||||
|
||||
private List<Reference> fetchReferenceFromDb(ReferenceSearchLookup lookup){
|
||||
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).sourceTypes(ReferenceSourceType.Internal).typeIds(lookup.getTypeId());
|
||||
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).sourceTypes(ReferenceSourceType.Internal).typeIds(lookup.getTypeId());
|
||||
|
||||
List<ReferenceEntity> data = query.collectAs(lookup.getProject());
|
||||
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
}
|
||||
|
||||
private ExternalDataResult getReferenceData(ReferenceTypeEntity referenceType, ExternalReferenceCriteria externalReferenceCriteria, String key) {
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ReferenceTypeServiceImpl implements ReferenceTypeService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, ReferenceType._id), data);
|
||||
return this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, ReferenceType._id), data);
|
||||
}
|
||||
|
||||
private @NotNull ReferenceTypeDefinitionEntity buildDefinitionEntity(ReferenceTypeDefinitionPersist persist){
|
||||
|
|
|
@ -7,7 +7,6 @@ import eu.eudat.commons.enums.StorageType;
|
|||
import eu.eudat.commons.enums.SupportiveMaterialFieldType;
|
||||
import eu.eudat.commons.scope.user.UserScope;
|
||||
import eu.eudat.data.StorageFileEntity;
|
||||
import eu.eudat.model.Description;
|
||||
import eu.eudat.model.StorageFile;
|
||||
import eu.eudat.model.builder.StorageFileBuilder;
|
||||
import eu.eudat.model.persist.StorageFilePersist;
|
||||
|
@ -94,7 +93,7 @@ public class StorageFileServiceImpl implements StorageFileService {
|
|||
|
||||
this.entityManager.persist(storageFile);
|
||||
this.entityManager.flush();
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,7 +141,7 @@ public class StorageFileServiceImpl implements StorageFileService {
|
|||
file.delete();
|
||||
|
||||
this.entityManager.merge(storageFile);
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
logger.warn("problem reading byte content of storage file " + fileId, ex);
|
||||
|
@ -181,7 +180,7 @@ public class StorageFileServiceImpl implements StorageFileService {
|
|||
this.entityManager.persist(data);
|
||||
|
||||
this.entityManager.merge(storageFile);
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
return this.builderFactory.builder(StorageFileBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, StorageFile._id), storageFile);
|
||||
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
|
|
@ -30,21 +30,12 @@ import jakarta.xml.bind.JAXBException;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
@Service
|
||||
|
@ -104,7 +95,7 @@ public class SupportiveMaterialServiceImpl implements SupportiveMaterialService{
|
|||
if (d == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), SupportiveMaterial.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
} else {
|
||||
List<SupportiveMaterialEntity> data = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).languageCodes(model.getLanguageCode()).types(model.getType()).collect();
|
||||
List<SupportiveMaterialEntity> data = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).languageCodes(model.getLanguageCode()).types(model.getType()).collect();
|
||||
|
||||
if(data != null && !data.isEmpty()){
|
||||
throw new MyApplicationException("Could not create a new Data with same type and lang code !");
|
||||
|
@ -126,7 +117,7 @@ public class SupportiveMaterialServiceImpl implements SupportiveMaterialService{
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, SupportiveMaterial._id), d);
|
||||
return this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, SupportiveMaterial._id), d);
|
||||
}
|
||||
|
||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
|
|
|
@ -112,7 +112,7 @@ public class TagServiceImpl implements TagService {
|
|||
this.entityManager.flush();
|
||||
|
||||
this.eventBroker.emit(new TagTouchedEvent(data.getId()));
|
||||
return this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Tag._id), data);
|
||||
return this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Tag._id), data);
|
||||
}
|
||||
|
||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||
|
|
|
@ -130,7 +130,7 @@ public class TenantServiceImpl implements TenantService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, Tenant._id), data);
|
||||
return this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Tenant._id), data);
|
||||
}
|
||||
|
||||
private @NotNull TenantConfigEntity buildConfigEntity(TenantConfigPersist persist) throws InvalidAlgorithmParameterException, NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, BadPaddingException, InvalidKeyException {
|
||||
|
|
|
@ -134,8 +134,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
|||
TransformerRepository repository = getRepository(repositoryId);
|
||||
if (repository == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{repositoryId, TransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
//GK: Second get the Target Data Management Plan
|
||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(dmpId);
|
||||
DmpModel dmpFileTransformerModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(query.first());
|
||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(dmpId);
|
||||
DmpModel dmpFileTransformerModel = this.builderFactory.builder(DmpCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(query.first());
|
||||
if (dmpFileTransformerModel == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{dmpId, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
FileEnvelopeModel fileEnvelope = repository.exportDmp(dmpFileTransformerModel, format);
|
||||
|
@ -155,8 +155,8 @@ public class FileTransformerServiceImpl implements FileTransformerService {
|
|||
if (repository == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{format, TransformerRepository.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
//GK: Second get the Target Data Management Plan
|
||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(descriptionId);
|
||||
DescriptionModel descriptionFileTransformerModel = this.builderFactory.builder(DescriptionCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(query.first());
|
||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(descriptionId);
|
||||
DescriptionModel descriptionFileTransformerModel = this.builderFactory.builder(DescriptionCommonModelBuilder.class).useSharedStorage(repository.getConfiguration().isUseSharedStorage()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(query.first());
|
||||
if (descriptionFileTransformerModel == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{descriptionId, Description.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
FileEnvelopeModel fileEnvelope = repository.exportDescription(descriptionFileTransformerModel, format);
|
||||
|
|
|
@ -178,7 +178,7 @@ public class UserServiceImpl implements UserService {
|
|||
this.eventBroker.emit(new UserTouchedEvent(data.getId()));
|
||||
|
||||
this.userTouchedIntegrationEventHandler.handle(data.getId());
|
||||
return this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, User._id), data);
|
||||
return this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, User._id), data);
|
||||
}
|
||||
|
||||
private @NotNull AdditionalInfoEntity buildAdditionalInfoEntity(UserAdditionalInfoPersist persist){
|
||||
|
@ -276,7 +276,7 @@ public class UserServiceImpl implements UserService {
|
|||
this.eventBroker.emit(new UserTouchedEvent(data.getId()));
|
||||
|
||||
this.userTouchedIntegrationEventHandler.handle(data.getId());
|
||||
return this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, User._id), data);
|
||||
return this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, User._id), data);
|
||||
}
|
||||
|
||||
//region mine
|
||||
|
|
|
@ -96,7 +96,7 @@ public class UserSettingsServiceImpl implements UserSettingsService {
|
|||
|
||||
this.entityManager.flush();
|
||||
|
||||
return this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(BaseFieldSet.build(fields, UserSettings._id, UserSettings._key), data);
|
||||
return this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, UserSettings._id, UserSettings._key), data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,19 +2,15 @@ package eu.eudat.controllers;
|
|||
|
||||
import eu.eudat.audit.AuditableAction;
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.authorization.Permission;
|
||||
import eu.eudat.commons.enums.DmpAccessType;
|
||||
import eu.eudat.commons.enums.DmpStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.commons.enums.StorageType;
|
||||
import eu.eudat.convention.ConventionService;
|
||||
import eu.eudat.data.StorageFileEntity;
|
||||
import eu.eudat.model.StorageFile;
|
||||
import eu.eudat.model.builder.PublicDescriptionBuilder;
|
||||
import eu.eudat.model.persist.DescriptionFieldFilePersist;
|
||||
import eu.eudat.model.persist.StorageFilePersist;
|
||||
import eu.eudat.service.storage.StorageFileService;
|
||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import eu.eudat.model.Description;
|
||||
import eu.eudat.model.Dmp;
|
||||
|
@ -40,7 +36,6 @@ import gr.cite.tools.exception.MyNotFoundException;
|
|||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
@ -54,8 +49,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.io.IOException;
|
||||
import java.net.URLConnection;
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
|
||||
import static eu.eudat.authorization.AuthorizationFlags.Public;
|
||||
|
@ -138,7 +131,7 @@ public class DescriptionController {
|
|||
|
||||
this.censorFactory.censor(DescriptionCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
QueryResult<Description> queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic, null);
|
||||
QueryResult<Description> queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, null);
|
||||
|
||||
this.auditService.track(AuditableAction.Description_Query, "lookup", lookup);
|
||||
|
||||
|
@ -152,8 +145,8 @@ public class DescriptionController {
|
|||
|
||||
this.censorFactory.censor(DescriptionCensor.class).censor(fieldSet, null);
|
||||
|
||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
DescriptionQuery query = this.queryFactory.query(DescriptionQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Description model = this.builderFactory.builder(DescriptionBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -85,10 +85,10 @@ public class DescriptionTemplateController {
|
|||
|
||||
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
DescriptionTemplateQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
DescriptionTemplateQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<DescriptionTemplateEntity> data = query.collectAs(lookup.getProject());
|
||||
List<DescriptionTemplate> models = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<DescriptionTemplate> models = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.DescriptionTemplate_Query, "lookup", lookup);
|
||||
|
@ -102,8 +102,8 @@ public class DescriptionTemplateController {
|
|||
|
||||
this.censorFactory.censor(DescriptionTemplateCensor.class).censor(fieldSet, null);
|
||||
|
||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
DescriptionTemplateQuery query = this.queryFactory.query(DescriptionTemplateQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
DescriptionTemplate model = this.builderFactory.builder(DescriptionTemplateBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplate.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import gr.cite.tools.logging.LoggerService;
|
|||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -69,10 +68,10 @@ public class DescriptionTemplateTypeController {
|
|||
|
||||
this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
DescriptionTemplateTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
DescriptionTemplateTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<DescriptionTemplateTypeEntity> data = query.collectAs(lookup.getProject());
|
||||
List<DescriptionTemplateType> models = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<DescriptionTemplateType> models = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.DescriptionTemplateType_Query, "lookup", lookup);
|
||||
|
@ -87,8 +86,8 @@ public class DescriptionTemplateTypeController {
|
|||
|
||||
this.censorFactory.censor(DescriptionTemplateTypeCensor.class).censor(fieldSet, null);
|
||||
|
||||
DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
DescriptionTemplateType model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
DescriptionTemplateTypeQuery query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
DescriptionTemplateType model = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DescriptionTemplateType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ public class DmpBlueprintController {
|
|||
logger.debug("querying {}", DmpBlueprint.class.getSimpleName());
|
||||
|
||||
this.censorFactory.censor(DmpBlueprintCensor.class).censor(lookup.getProject(), null);
|
||||
DmpBlueprintQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
DmpBlueprintQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<DmpBlueprintEntity> data = query.collectAs(lookup.getProject());
|
||||
List<DmpBlueprint> models = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<DmpBlueprint> models = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.DmpBlueprint_Query, "lookup", lookup);
|
||||
|
@ -98,8 +98,8 @@ public class DmpBlueprintController {
|
|||
|
||||
this.censorFactory.censor(DmpBlueprintCensor.class).censor(fieldSet, null);
|
||||
|
||||
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
DmpBlueprintQuery query = this.queryFactory.query(DmpBlueprintQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
DmpBlueprint model = this.builderFactory.builder(DmpBlueprintBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, DmpBlueprint.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -5,11 +5,7 @@ import eu.eudat.authorization.AuthorizationFlags;
|
|||
import eu.eudat.commons.enums.DmpAccessType;
|
||||
import eu.eudat.commons.enums.DmpStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.model.builder.DescriptionBuilder;
|
||||
import eu.eudat.model.builder.PublicDmpBuilder;
|
||||
import eu.eudat.model.censorship.PublicDescriptionCensor;
|
||||
import eu.eudat.query.DescriptionQuery;
|
||||
import eu.eudat.query.DmpDescriptionTemplateQuery;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import eu.eudat.model.*;
|
||||
import eu.eudat.model.builder.DmpBuilder;
|
||||
|
@ -123,8 +119,7 @@ public class DmpController {
|
|||
|
||||
this.censorFactory.censor(DmpCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
|
||||
QueryResult<Dmp> queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic, null);
|
||||
QueryResult<Dmp> queryResult = this.elasticQueryHelperService.collect(lookup, AuthorizationFlags.OwnerOrDmpAssociatedOrPermission, null);
|
||||
|
||||
this.auditService.track(AuditableAction.Dmp_Query, "lookup", lookup);
|
||||
|
||||
|
@ -137,8 +132,8 @@ public class DmpController {
|
|||
|
||||
this.censorFactory.censor(DmpCensor.class).censor(fieldSet, null);
|
||||
|
||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
DmpQuery query = this.queryFactory.query(DmpQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Dmp model = this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -75,10 +75,10 @@ public class EntityDoiController {
|
|||
|
||||
this.censorFactory.censor(EntityDoiCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
EntityDoiQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
EntityDoiQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<EntityDoiEntity> data = query.collectAs(lookup.getProject());
|
||||
List<EntityDoi> models = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<EntityDoi> models = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.EntityDoi_Query, "lookup", lookup);
|
||||
|
@ -92,8 +92,8 @@ public class EntityDoiController {
|
|||
|
||||
this.censorFactory.censor(EntityDoiCensor.class).censor(fieldSet, null);
|
||||
|
||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
EntityDoi model = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
EntityDoiQuery query = this.queryFactory.query(EntityDoiQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
EntityDoi model = this.builderFactory.builder(EntityDoiBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, EntityDoi.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import eu.eudat.authorization.AuthorizationFlags;
|
|||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import eu.eudat.data.LanguageEntity;
|
||||
import eu.eudat.model.Language;
|
||||
import eu.eudat.model.UserContactInfo;
|
||||
import eu.eudat.model.builder.LanguageBuilder;
|
||||
import eu.eudat.model.censorship.LanguageCensor;
|
||||
import eu.eudat.model.persist.LanguagePersist;
|
||||
|
@ -35,12 +34,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import javax.management.InvalidApplicationException;
|
||||
import java.io.IOException;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static eu.eudat.authorization.AuthorizationFlags.Public;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(path = {"api/language"})
|
||||
public class LanguageController {
|
||||
|
@ -81,9 +79,9 @@ public class LanguageController {
|
|||
|
||||
this.censorFactory.censor(LanguageCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
LanguageQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
LanguageQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<LanguageEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Language> models = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Language> models = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.Language_Query, "lookup", lookup);
|
||||
|
@ -97,8 +95,8 @@ public class LanguageController {
|
|||
|
||||
this.censorFactory.censor(LanguageCensor.class).censor(fieldSet, null);
|
||||
|
||||
LanguageQuery query = this.queryFactory.query(LanguageQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Language model = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
LanguageQuery query = this.queryFactory.query(LanguageQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Language model = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Language.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -116,8 +114,8 @@ public class LanguageController {
|
|||
|
||||
this.censorFactory.censor(LanguageCensor.class).censor(fieldSet, null);
|
||||
|
||||
LanguageQuery query = this.queryFactory.query(LanguageQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).codes(code);
|
||||
Language model = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
LanguageQuery query = this.queryFactory.query(LanguageQuery.class).authorize(EnumSet.of(Public)).codes(code);
|
||||
Language model = this.builderFactory.builder(LanguageBuilder.class).authorize(EnumSet.of(Public)).build(fieldSet, query.firstAs(fieldSet));
|
||||
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{code, Language.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
@ -139,10 +137,10 @@ public class LanguageController {
|
|||
|
||||
this.censorFactory.censor(LanguageCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
LanguageQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
LanguageQuery query = lookup.enrich(this.queryFactory).authorize(EnumSet.of(Public));
|
||||
query.setOrder(new Ordering().addAscending(Language._ordinal));
|
||||
List<LanguageEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Language> models = this.builderFactory.builder(LanguageBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Language> models = this.builderFactory.builder(LanguageBuilder.class).authorize(EnumSet.of(Public)).build(lookup.getProject(), data);
|
||||
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
|
|
|
@ -85,9 +85,9 @@ public class LockController {
|
|||
|
||||
this.censorFactory.censor(LockCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
LockQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
LockQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<LockEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Lock> models = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Lock> models = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.Lock_Query, "lookup", lookup);
|
||||
|
@ -101,8 +101,8 @@ public class LockController {
|
|||
|
||||
this.censorFactory.censor(LockCensor.class).censor(fieldSet, null);
|
||||
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Lock model = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Lock model = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Lock.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -137,8 +137,8 @@ public class LockController {
|
|||
|
||||
this.censorFactory.censor(LockCensor.class).censor(fieldSet, null);
|
||||
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).targetIds(targetId);
|
||||
Lock model = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
LockQuery query = this.queryFactory.query(LockQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).targetIds(targetId);
|
||||
Lock model = this.builderFactory.builder(LockBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{targetId, Lock.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -89,9 +89,9 @@ public class PrefillingSourceController {
|
|||
|
||||
this.censorFactory.censor(PrefillingSourceCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
PrefillingSourceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
PrefillingSourceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<PrefillingSourceEntity> data = query.collectAs(lookup.getProject());
|
||||
List<PrefillingSource> models = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<PrefillingSource> models = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.PrefillingSource_Query, "lookup", lookup);
|
||||
|
@ -105,8 +105,8 @@ public class PrefillingSourceController {
|
|||
|
||||
this.censorFactory.censor(PrefillingSourceCensor.class).censor(fieldSet, null);
|
||||
|
||||
PrefillingSourceQuery query = this.queryFactory.query(PrefillingSourceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
PrefillingSource model = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
PrefillingSourceQuery query = this.queryFactory.query(PrefillingSourceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
PrefillingSource model = this.builderFactory.builder(PrefillingSourceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, PrefillingSource.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@ public class ReferenceController {
|
|||
|
||||
this.censorFactory.censor(ReferenceCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<ReferenceEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Reference> models = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Reference> models = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.Reference_Query, "lookup", lookup);
|
||||
|
@ -111,8 +111,8 @@ public class ReferenceController {
|
|||
|
||||
this.censorFactory.censor(ReferenceCensor.class).censor(fieldSet, null);
|
||||
|
||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Reference model = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
ReferenceQuery query = this.queryFactory.query(ReferenceQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Reference model = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Reference.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import eu.eudat.audit.AuditableAction;
|
|||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import eu.eudat.data.ReferenceTypeEntity;
|
||||
import eu.eudat.model.Reference;
|
||||
import eu.eudat.model.ReferenceType;
|
||||
import eu.eudat.model.builder.ReferenceTypeBuilder;
|
||||
import eu.eudat.model.censorship.ReferenceTypeCensor;
|
||||
|
@ -81,9 +80,9 @@ public class ReferenceTypeController{
|
|||
|
||||
this.censorFactory.censor(ReferenceTypeCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
ReferenceTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
ReferenceTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<ReferenceTypeEntity> data = query.collectAs(lookup.getProject());
|
||||
List<ReferenceType> models = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<ReferenceType> models = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.ReferenceType_Query, "lookup", lookup);
|
||||
|
@ -97,8 +96,8 @@ public class ReferenceTypeController{
|
|||
|
||||
this.censorFactory.censor(ReferenceTypeCensor.class).censor(fieldSet, null);
|
||||
|
||||
ReferenceTypeQuery query = this.queryFactory.query(ReferenceTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
ReferenceType model = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
ReferenceTypeQuery query = this.queryFactory.query(ReferenceTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
ReferenceType model = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -116,8 +115,8 @@ public class ReferenceTypeController{
|
|||
|
||||
this.censorFactory.censor(ReferenceTypeCensor.class).censor(fieldSet, null);
|
||||
|
||||
ReferenceTypeQuery query = this.queryFactory.query(ReferenceTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).codes(code);
|
||||
ReferenceType model = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
ReferenceTypeQuery query = this.queryFactory.query(ReferenceTypeQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).codes(code);
|
||||
ReferenceType model = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{code, ReferenceType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package eu.eudat.controllers;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.tdunning.math.stats.Sort;
|
||||
import eu.eudat.audit.AuditableAction;
|
||||
import eu.eudat.authorization.AuthorizationFlags;
|
||||
import eu.eudat.commons.enums.SupportiveMaterialFieldType;
|
||||
import eu.eudat.service.storage.StorageFileService;
|
||||
import gr.cite.tools.fieldset.BaseFieldSet;
|
||||
import gr.cite.tools.validation.ValidationFilterAnnotation;
|
||||
import eu.eudat.data.SupportiveMaterialEntity;
|
||||
|
@ -17,7 +15,6 @@ import eu.eudat.model.result.QueryResult;
|
|||
import eu.eudat.query.SupportiveMaterialQuery;
|
||||
import eu.eudat.query.lookup.SupportiveMaterialLookup;
|
||||
import eu.eudat.service.supportivematerial.SupportiveMaterialService;
|
||||
import gr.cite.commons.web.authz.service.AuthorizationService;
|
||||
import gr.cite.tools.auditing.AuditService;
|
||||
import gr.cite.tools.data.builder.BuilderFactory;
|
||||
import gr.cite.tools.data.censor.CensorFactory;
|
||||
|
@ -83,9 +80,9 @@ public class SupportiveMaterialController {
|
|||
|
||||
this.censorFactory.censor(SupportiveMaterialCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
SupportiveMaterialQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
SupportiveMaterialQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<SupportiveMaterialEntity> data = query.collectAs(lookup.getProject());
|
||||
List<SupportiveMaterial> models = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<SupportiveMaterial> models = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.SupportiveMaterial_Query, "lookup", lookup);
|
||||
|
@ -99,8 +96,8 @@ public class SupportiveMaterialController {
|
|||
|
||||
this.censorFactory.censor(SupportiveMaterialCensor.class).censor(fieldSet, null);
|
||||
|
||||
SupportiveMaterialQuery query = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
SupportiveMaterial model = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
SupportiveMaterialQuery query = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
SupportiveMaterial model = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, SupportiveMaterial.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -117,7 +114,7 @@ public class SupportiveMaterialController {
|
|||
logger.debug("querying {}", SupportiveMaterial.class.getSimpleName());
|
||||
|
||||
|
||||
SupportiveMaterialQuery query = this.queryFactory.query(SupportiveMaterialQuery.class).types(SupportiveMaterialFieldType.of(type)).languageCodes(language).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
SupportiveMaterialQuery query = this.queryFactory.query(SupportiveMaterialQuery.class).types(SupportiveMaterialFieldType.of(type)).languageCodes(language).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<SupportiveMaterialEntity> data = query.collectAs(new BaseFieldSet().ensure(SupportiveMaterial._id).ensure(SupportiveMaterial._payload));
|
||||
byte[] content;
|
||||
if (data.size() == 1) content = data.getFirst().getPayload().getBytes();
|
||||
|
|
|
@ -23,7 +23,6 @@ import gr.cite.tools.fieldset.FieldSet;
|
|||
import gr.cite.tools.logging.LoggerService;
|
||||
import gr.cite.tools.logging.MapLogEntry;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -71,10 +70,10 @@ public class TagController {
|
|||
|
||||
this.censorFactory.censor(TagCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
TagQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
TagQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<TagEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Tag> models = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Tag> models = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.Tag_Query, "lookup", lookup);
|
||||
|
@ -88,8 +87,8 @@ public class TagController {
|
|||
|
||||
this.censorFactory.censor(TagCensor.class).censor(fieldSet, null);
|
||||
|
||||
TagQuery query = this.queryFactory.query(TagQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Tag model = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
TagQuery query = this.queryFactory.query(TagQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Tag model = this.builderFactory.builder(TagBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Tag.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -82,10 +82,10 @@ public class TenantController {
|
|||
logger.debug("querying {}", Tenant.class.getSimpleName());
|
||||
|
||||
this.censorFactory.censor(TenantCensor.class).censor(lookup.getProject(), null);
|
||||
TenantQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
TenantQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<TenantEntity> data = query.collectAs(lookup.getProject());
|
||||
List<Tenant> models = this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<Tenant> models = this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
for (Tenant model : models) {
|
||||
models.set(models.indexOf(model), this.tenantService.decryptTenant(model));
|
||||
}
|
||||
|
@ -102,8 +102,8 @@ public class TenantController {
|
|||
|
||||
this.censorFactory.censor(TenantCensor.class).censor(fieldSet, null);
|
||||
|
||||
TenantQuery query = this.queryFactory.query(TenantQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
Tenant model = this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
TenantQuery query = this.queryFactory.query(TenantQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
Tenant model = this.builderFactory.builder(TenantBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, Tenant.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -98,10 +98,10 @@ public class UserController {
|
|||
|
||||
this.censorFactory.censor(UserCensor.class).censor(lookup.getProject(), null);
|
||||
|
||||
UserQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
UserQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
|
||||
List<UserEntity> data = query.collectAs(lookup.getProject());
|
||||
List<User> models = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<User> models = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.User_Query, "lookup", lookup);
|
||||
|
@ -118,7 +118,7 @@ public class UserController {
|
|||
UserQuery query = lookup.enrich(this.queryFactory).dmpAssociated(true).isActive(IsActive.Active);
|
||||
|
||||
List<UserEntity> data = query.collectAs(lookup.getProject());
|
||||
List<DmpAssociatedUser> models = this.builderFactory.builder(DmpAssociatedUserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<DmpAssociatedUser> models = this.builderFactory.builder(DmpAssociatedUserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.User_DmpAssociatedQuery, "lookup", lookup);
|
||||
|
@ -132,8 +132,8 @@ public class UserController {
|
|||
|
||||
this.censorFactory.censor(UserCensor.class).censor(fieldSet, id);
|
||||
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).ids(id);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).ids(id);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{id, User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -151,8 +151,8 @@ public class UserController {
|
|||
|
||||
this.censorFactory.censor(UserCensor.class).censor(fieldSet, null);
|
||||
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).emails(email);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).emails(email);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{email, User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
@ -183,8 +183,8 @@ public class UserController {
|
|||
|
||||
this.censorFactory.censor(UserCensor.class).censor(fieldSet, this.userScope.getUserId());
|
||||
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
UserQuery query = this.queryFactory.query(UserQuery.class).ids(this.userScope.getUserId()).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
User model = this.builderFactory.builder(UserBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
if (model == null)
|
||||
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{this.userScope.getUserId(), User.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
|
|
|
@ -73,9 +73,9 @@ public class UserSettingsController {
|
|||
public QueryResult<UserSettings> Query(@RequestBody UserSettingsLookup lookup) throws MyApplicationException, MyForbiddenException {
|
||||
logger.debug("querying {}", UserSettings.class.getSimpleName());
|
||||
this.censorFactory.censor(UserSettingsCensor.class).censor(lookup.getProject(), null);
|
||||
UserSettingsQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic);
|
||||
UserSettingsQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission);
|
||||
List<UserSettingsEntity> data = query.collectAs(lookup.getProject());
|
||||
List<UserSettings> models = this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(lookup.getProject(), data);
|
||||
List<UserSettings> models = this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(lookup.getProject(), data);
|
||||
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
|
||||
|
||||
this.auditService.track(AuditableAction.User_Settings_Query, "lookup", lookup);
|
||||
|
@ -98,8 +98,8 @@ public class UserSettingsController {
|
|||
UserSettings._updatedAt,
|
||||
UserSettings._type
|
||||
));
|
||||
UserSettingsQuery query = this.queryFactory.query(UserSettingsQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).keys(key);
|
||||
UserSettings model = this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermissionOrPublic).build(fieldSet, query.firstAs(fieldSet));
|
||||
UserSettingsQuery query = this.queryFactory.query(UserSettingsQuery.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).keys(key);
|
||||
UserSettings model = this.builderFactory.builder(UserSettingsBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(fieldSet, query.firstAs(fieldSet));
|
||||
|
||||
this.auditService.track(AuditableAction.User_Settings_Lookup, Map.ofEntries(
|
||||
new AbstractMap.SimpleEntry<String, Object>("key", key)
|
||||
|
|
|
@ -2,48 +2,29 @@ permissions:
|
|||
extendedClaims: [ ]
|
||||
policies:
|
||||
###### Should Remove after Refactor
|
||||
PublicRole:
|
||||
roles: [ ]
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
AdminRole:
|
||||
roles:
|
||||
- Admin
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DescriptionTemplateEditorRole:
|
||||
roles:
|
||||
- DescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
ManagerRole:
|
||||
roles:
|
||||
- Manager
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
UserRole:
|
||||
roles:
|
||||
- User
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
AuthenticatedRole:
|
||||
roles: []
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: true
|
||||
AnonymousRole:
|
||||
roles: []
|
||||
clients: [ ]
|
||||
allowAnonymous: true
|
||||
allowAuthenticated: true
|
||||
|
||||
######
|
||||
|
||||
# public
|
||||
DeferredAffiliation:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
# public
|
||||
PublicBrowseDescription:
|
||||
roles: [ ]
|
||||
|
@ -278,6 +259,8 @@ permissions:
|
|||
roles:
|
||||
- Admin
|
||||
- DescriptionTemplateEditor
|
||||
- Manager
|
||||
- User
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
@ -341,6 +324,15 @@ permissions:
|
|||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
NewDmp:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
DeleteDmp:
|
||||
roles:
|
||||
- Admin
|
||||
|
@ -394,6 +386,9 @@ permissions:
|
|||
BrowseDmpBlueprint:
|
||||
roles:
|
||||
- Admin
|
||||
- User
|
||||
- Manager
|
||||
- DescriptionTemplateEditor
|
||||
clients: [ ]
|
||||
allowAnonymous: false
|
||||
allowAuthenticated: false
|
||||
|
|
|
@ -17,6 +17,7 @@ export enum AppPermission {
|
|||
//Dmp
|
||||
BrowseDmp = "BrowseDmp",
|
||||
EditDmp = "EditDmp",
|
||||
NewDmp = "NewDmp",
|
||||
DeleteDmp= "DeleteDmp",
|
||||
CloneDmp = "CloneDmp",
|
||||
CreateNewVersionDmp = "CreateNewVersionDmp",
|
||||
|
|
Loading…
Reference in New Issue