mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 13:33:08 +00:00
refactored security plugin
This commit is contained in:
@@ -69,11 +69,12 @@ public class UsageReportRestPermissionEvaluatorPlugin extends RestObjectPermissi
|
||||
Context context = ContextUtil.obtainContext(request.getHttpServletRequest());
|
||||
UUID uuidObject = null;
|
||||
try {
|
||||
if (Objects.isNull(targetId)) {
|
||||
return true;
|
||||
}
|
||||
if (configurationService.getBooleanProperty("usage-statistics.authorization.admin.usage", true)) {
|
||||
return authorizeService.isAdmin(context);
|
||||
}
|
||||
if (Objects.nonNull(targetId)) {
|
||||
if (StringUtils.equalsIgnoreCase(UsageReportRest.NAME, targetType)) {
|
||||
} else if (StringUtils.equalsIgnoreCase(UsageReportRest.NAME, targetType)) {
|
||||
if (StringUtils.countMatches(targetId.toString(), "_") != 1) {
|
||||
throw new IllegalArgumentException("Must end in objectUUID_reportId, example: "
|
||||
+ "1911e8a4-6939-490c-b58b-a5d70f8d91fb_TopCountries");
|
||||
@@ -92,9 +93,7 @@ public class UsageReportRestPermissionEvaluatorPlugin extends RestObjectPermissi
|
||||
if (Objects.isNull(dso)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return authorizeService.authorizeActionBoolean(context, dso, restPermission.getDspaceApiActionId());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user