fix notification, inapp notification permissions
This commit is contained in:
parent
141ef488e5
commit
951f34e0cc
|
@ -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);
|
||||
|
||||
|
|
|
@ -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: [ ]
|
||||
|
|
|
@ -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: [ ]
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
</div>
|
||||
<div [ngClass]="{'contact-container': !isDialog}" class="row">
|
||||
<div class="col-md-12">
|
||||
<mat-form-field class="full-width mb-2">
|
||||
<!-- <input matInput placeholder="{{'CONTACT.SUPPORT.SUBJECT' | translate}}" [(ngModel)]="formGroup.subject" name="contactSupportSubject" required> -->
|
||||
<mat-form-field class="mat-form-field">
|
||||
<input matInput placeholder="{{'CONTACT.SUPPORT.SUBJECT' | translate}}" type="text" name="subject" formControlName="subject" required>
|
||||
<mat-error *ngIf="formGroup.get('subject').hasError('backendError')">
|
||||
{{formGroup.get('subject').getError('backendError').message}}</mat-error>
|
||||
|
@ -17,7 +16,7 @@
|
|||
</mat-form-field>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<mat-form-field class="full-width">
|
||||
<mat-form-field class="mat-form-field">
|
||||
<textarea matInput placeholder="{{'CONTACT.SUPPORT.DESCRIPTION' | translate}}" type="text" name="description" formControlName="description" required></textarea>
|
||||
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">
|
||||
{{formGroup.get('description').getError('backendError').message}}</mat-error>
|
||||
|
|
|
@ -23,6 +23,10 @@ img {
|
|||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.mat-form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.send-btn {
|
||||
background: #ffffff 0% 0% no-repeat padding-box;
|
||||
border: 1px solid var(--primary-color);
|
||||
|
|
|
@ -12,6 +12,7 @@ import { InAppNotificationLookup } from '@app/core/query/inapp-notification.look
|
|||
import { InAppNotificationService } from '@app/core/services/inapp-notification/inapp-notification.service';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { nameof } from 'ts-simple-nameof';
|
||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||
|
||||
@Component({
|
||||
selector: 'app-mine-inapp-notification-listing-dialog',
|
||||
|
@ -44,8 +45,9 @@ export class MineInAppNotificationListingDialogComponent extends BaseComponent i
|
|||
nameof<InAppNotification>(x => x.trackingState),
|
||||
]
|
||||
};
|
||||
lookup.page = { offset: 0, size: 10 };
|
||||
lookup.page = { offset: 0, size: 10 };
|
||||
lookup.order = { items: ['-' + nameof<InAppNotification>(x => x.createdAt)] };
|
||||
lookup.isActive = [IsActive.Active];
|
||||
this.inappNotificationService.query(lookup)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
|
|
Loading…
Reference in New Issue