diff --git a/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java b/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java index a703dd88b..90d7ad22e 100644 --- a/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java +++ b/dmp-backend/notification-service/notification-web/src/main/java/gr/cite/notification/web/controllers/InAppNotificationController.java @@ -44,7 +44,6 @@ public class InAppNotificationController { private final BuilderFactory builderFactory; private final AuditService auditService; - private final NotificationService notificationService; private final CensorFactory censorFactory; private final QueryFactory queryFactory; private final MessageSource messageSource; @@ -61,7 +60,6 @@ public class InAppNotificationController { InAppNotificationService inAppNotificationService, UserScope userScope, ErrorThesaurusProperties errors) { this.builderFactory = builderFactory; this.auditService = auditService; - this.notificationService = notificationService; this.censorFactory = censorFactory; this.queryFactory = queryFactory; this.messageSource = messageSource; @@ -159,7 +157,7 @@ public class InAppNotificationController { public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException { logger.debug(new MapLogEntry("deleting" + Notification.class.getSimpleName()).And("id", id)); - this.notificationService.deleteAndSave(id); + this.inAppNotificationService.deleteAndSave(id); this.auditService.track(AuditableAction.InApp_Notification_Delete, "id", id); diff --git a/dmp-backend/notification-service/notification-web/src/main/resources/config/permissions.yml b/dmp-backend/notification-service/notification-web/src/main/resources/config/permissions.yml index c7b20e4ca..e93f4f3af 100644 --- a/dmp-backend/notification-service/notification-web/src/main/resources/config/permissions.yml +++ b/dmp-backend/notification-service/notification-web/src/main/resources/config/permissions.yml @@ -85,6 +85,12 @@ permissions: clients: [ ] allowAnonymous: true allowAuthenticated: false + DeleteNotification: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false #Tenant Configuration BrowseTenantConfiguration: roles: @@ -154,6 +160,20 @@ permissions: allowAnonymous: false allowAuthenticated: false DeleteNotificationTemplate: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false + + # In App Notification Permissions + BrowseInAppNotification: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false + DeleteInAppNotification: roles: - Admin clients: [ ] diff --git a/dmp-backend/notification-service/notification-web/target/classes/config/permissions.yml b/dmp-backend/notification-service/notification-web/target/classes/config/permissions.yml index c7b20e4ca..e93f4f3af 100644 --- a/dmp-backend/notification-service/notification-web/target/classes/config/permissions.yml +++ b/dmp-backend/notification-service/notification-web/target/classes/config/permissions.yml @@ -85,6 +85,12 @@ permissions: clients: [ ] allowAnonymous: true allowAuthenticated: false + DeleteNotification: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false #Tenant Configuration BrowseTenantConfiguration: roles: @@ -154,6 +160,20 @@ permissions: allowAnonymous: false allowAuthenticated: false DeleteNotificationTemplate: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false + + # In App Notification Permissions + BrowseInAppNotification: + roles: + - Admin + clients: [ ] + allowAnonymous: false + allowAuthenticated: false + DeleteInAppNotification: roles: - Admin clients: [ ] diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/authorization/Permission.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/authorization/Permission.java index bd4f8494b..59b247dec 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/authorization/Permission.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/authorization/Permission.java @@ -34,6 +34,10 @@ public final class Permission { public static String EditNotificationTemplate = "EditNotificationTemplate"; public static String DeleteNotificationTemplate = "DeleteNotificationTemplate"; + //InApp Notification + public static final String BrowseInAppNotification = "BrowseInAppNotification"; + public static String DeleteInAppNotification = "DeleteInAppNotification"; + // UI Pages public static String ViewTenantConfigurationPage = "ViewTenantConfigurationPage"; public static String ViewNotificationPage = "ViewNotificationPage"; diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java index bb1451d8e..d20a14b4c 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/model/censorship/InAppNotificationCensor.java @@ -27,6 +27,6 @@ public class InAppNotificationCensor extends BaseCensor { public void censor(FieldSet fields) { logger.debug(new DataLogEntry("censoring fields", fields)); if (this.isEmpty(fields)) return; - this.authService.authorizeForce(Permission.BrowseNotification); + this.authService.authorizeForce(Permission.BrowseInAppNotification); } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java index 9640fc0ef..3086fee5b 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/inappnotification/InAppNotificationServiceImpl.java @@ -86,8 +86,8 @@ public class InAppNotificationServiceImpl implements InAppNotificationService{ public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException { - logger.debug("deleting tenant: {}", id); - this.authService.authorizeForce(Permission.DeleteNotification); + logger.debug("deleting inapp notification: {}", id); + this.authService.authorizeForce(Permission.DeleteInAppNotification); this.deleterFactory.deleter(InAppNotificationDeleter.class).deleteAndSaveByIds(List.of(id)); } } diff --git a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notification/NotificationServiceImpl.java b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notification/NotificationServiceImpl.java index 26dc42061..a8b5fff5b 100644 --- a/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notification/NotificationServiceImpl.java +++ b/dmp-backend/notification-service/notification/src/main/java/gr/cite/notification/service/notification/NotificationServiceImpl.java @@ -181,7 +181,7 @@ public class NotificationServiceImpl implements NotificationService { @Override public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException { - logger.debug("deleting tenant: {}", id); + logger.debug("deleting notification: {}", id); this.authService.authorizeForce(Permission.DeleteNotification); this.deleterFactory.deleter(NotificationDeleter.class).deleteAndSaveByIds(List.of(id)); } diff --git a/dmp-frontend/src/app/ui/contact/contact-content/contact-content.component.html b/dmp-frontend/src/app/ui/contact/contact-content/contact-content.component.html index 611c28e7a..372ab5990 100644 --- a/dmp-frontend/src/app/ui/contact/contact-content/contact-content.component.html +++ b/dmp-frontend/src/app/ui/contact/contact-content/contact-content.component.html @@ -7,8 +7,7 @@