Minor improvements to error checkups
This commit is contained in:
parent
13f41dfd8b
commit
4cc44814e2
|
@ -48,8 +48,12 @@ public class TagController extends BaseController {
|
|||
//ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
|
||||
/*List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type);
|
||||
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/
|
||||
List<Tag> tags = this.getApiContext().getOperationsContext().getElasticRepository().getDatasetRepository().query(new DatasetCriteria()).stream().map(Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
if (this.getApiContext().getOperationsContext().getElasticRepository().getDatasetRepository().exists()) {
|
||||
List<Tag> tags = this.getApiContext().getOperationsContext().getElasticRepository().getDatasetRepository().query(new DatasetCriteria()).stream().map(Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tag>>().payload(tags).status(ApiMessageCode.NO_MESSAGE));
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tag>>().payload(tags).status(ApiMessageCode.NO_MESSAGE));
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ResponseItem<List<Tag>>().status(ApiMessageCode.ERROR_MESSAGE).message("Elastic Services are not available"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class DatasetManager {
|
|||
QueryableList<eu.eudat.data.entities.Dataset> authItems;
|
||||
if (!datasetTableRequest.getCriteria().getIsPublic()) {
|
||||
if (principal.getId() == null) {
|
||||
throw new UnauthorisedException();
|
||||
throw new UnauthorisedException("You are not allowed to access those datasets");
|
||||
}
|
||||
if (datasetTableRequest.getCriteria().getRole() != null)
|
||||
roles.add(datasetTableRequest.getCriteria().getRole());
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
"src/assets",
|
||||
"src/favicon.ico",
|
||||
{ "glob": "**/*", "input": "node_modules/tinymce", "output": "/tinymce/" }
|
||||
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.scss",
|
||||
|
|
|
@ -48,7 +48,9 @@ export class AuthService extends BaseService {
|
|||
return principal;
|
||||
}
|
||||
const principalJson = localStorage.getItem('principal');
|
||||
if (!principalJson) { return null; }
|
||||
if (principalJson === null || principalJson === undefined) {
|
||||
return null;
|
||||
}
|
||||
let principalObj = JSON.parse(principalJson) as Principal;
|
||||
principalObj.expiresAt = new Date(principalObj.expiresAt);
|
||||
if (principalObj.expiresAt < new Date()) {
|
||||
|
|
Loading…
Reference in New Issue