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 BuilderFactory builderFactory;
|
||||||
private final AuditService auditService;
|
private final AuditService auditService;
|
||||||
private final NotificationService notificationService;
|
|
||||||
private final CensorFactory censorFactory;
|
private final CensorFactory censorFactory;
|
||||||
private final QueryFactory queryFactory;
|
private final QueryFactory queryFactory;
|
||||||
private final MessageSource messageSource;
|
private final MessageSource messageSource;
|
||||||
|
@ -61,7 +60,6 @@ public class InAppNotificationController {
|
||||||
InAppNotificationService inAppNotificationService, UserScope userScope, ErrorThesaurusProperties errors) {
|
InAppNotificationService inAppNotificationService, UserScope userScope, ErrorThesaurusProperties errors) {
|
||||||
this.builderFactory = builderFactory;
|
this.builderFactory = builderFactory;
|
||||||
this.auditService = auditService;
|
this.auditService = auditService;
|
||||||
this.notificationService = notificationService;
|
|
||||||
this.censorFactory = censorFactory;
|
this.censorFactory = censorFactory;
|
||||||
this.queryFactory = queryFactory;
|
this.queryFactory = queryFactory;
|
||||||
this.messageSource = messageSource;
|
this.messageSource = messageSource;
|
||||||
|
@ -159,7 +157,7 @@ public class InAppNotificationController {
|
||||||
public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
public void Delete(@PathVariable("id") UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
logger.debug(new MapLogEntry("deleting" + Notification.class.getSimpleName()).And("id", id));
|
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);
|
this.auditService.track(AuditableAction.InApp_Notification_Delete, "id", id);
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,12 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: true
|
allowAnonymous: true
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
DeleteNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
#Tenant Configuration
|
#Tenant Configuration
|
||||||
BrowseTenantConfiguration:
|
BrowseTenantConfiguration:
|
||||||
roles:
|
roles:
|
||||||
|
@ -159,3 +165,17 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
|
||||||
|
# In App Notification Permissions
|
||||||
|
BrowseInAppNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
DeleteInAppNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
|
@ -85,6 +85,12 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: true
|
allowAnonymous: true
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
DeleteNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
#Tenant Configuration
|
#Tenant Configuration
|
||||||
BrowseTenantConfiguration:
|
BrowseTenantConfiguration:
|
||||||
roles:
|
roles:
|
||||||
|
@ -159,3 +165,17 @@ permissions:
|
||||||
clients: [ ]
|
clients: [ ]
|
||||||
allowAnonymous: false
|
allowAnonymous: false
|
||||||
allowAuthenticated: false
|
allowAuthenticated: false
|
||||||
|
|
||||||
|
# In App Notification Permissions
|
||||||
|
BrowseInAppNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
||||||
|
DeleteInAppNotification:
|
||||||
|
roles:
|
||||||
|
- Admin
|
||||||
|
clients: [ ]
|
||||||
|
allowAnonymous: false
|
||||||
|
allowAuthenticated: false
|
|
@ -34,6 +34,10 @@ public final class Permission {
|
||||||
public static String EditNotificationTemplate = "EditNotificationTemplate";
|
public static String EditNotificationTemplate = "EditNotificationTemplate";
|
||||||
public static String DeleteNotificationTemplate = "DeleteNotificationTemplate";
|
public static String DeleteNotificationTemplate = "DeleteNotificationTemplate";
|
||||||
|
|
||||||
|
//InApp Notification
|
||||||
|
public static final String BrowseInAppNotification = "BrowseInAppNotification";
|
||||||
|
public static String DeleteInAppNotification = "DeleteInAppNotification";
|
||||||
|
|
||||||
// UI Pages
|
// UI Pages
|
||||||
public static String ViewTenantConfigurationPage = "ViewTenantConfigurationPage";
|
public static String ViewTenantConfigurationPage = "ViewTenantConfigurationPage";
|
||||||
public static String ViewNotificationPage = "ViewNotificationPage";
|
public static String ViewNotificationPage = "ViewNotificationPage";
|
||||||
|
|
|
@ -27,6 +27,6 @@ public class InAppNotificationCensor extends BaseCensor {
|
||||||
public void censor(FieldSet fields) {
|
public void censor(FieldSet fields) {
|
||||||
logger.debug(new DataLogEntry("censoring fields", fields));
|
logger.debug(new DataLogEntry("censoring fields", fields));
|
||||||
if (this.isEmpty(fields)) return;
|
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 {
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
logger.debug("deleting tenant: {}", id);
|
logger.debug("deleting inapp notification: {}", id);
|
||||||
this.authService.authorizeForce(Permission.DeleteNotification);
|
this.authService.authorizeForce(Permission.DeleteInAppNotification);
|
||||||
this.deleterFactory.deleter(InAppNotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
this.deleterFactory.deleter(InAppNotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class NotificationServiceImpl implements NotificationService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {
|
||||||
logger.debug("deleting tenant: {}", id);
|
logger.debug("deleting notification: {}", id);
|
||||||
this.authService.authorizeForce(Permission.DeleteNotification);
|
this.authService.authorizeForce(Permission.DeleteNotification);
|
||||||
this.deleterFactory.deleter(NotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
this.deleterFactory.deleter(NotificationDeleter.class).deleteAndSaveByIds(List.of(id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div [ngClass]="{'contact-container': !isDialog}" class="row">
|
<div [ngClass]="{'contact-container': !isDialog}" class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<mat-form-field class="full-width mb-2">
|
<mat-form-field class="mat-form-field">
|
||||||
<!-- <input matInput placeholder="{{'CONTACT.SUPPORT.SUBJECT' | translate}}" [(ngModel)]="formGroup.subject" name="contactSupportSubject" required> -->
|
|
||||||
<input matInput placeholder="{{'CONTACT.SUPPORT.SUBJECT' | translate}}" type="text" name="subject" formControlName="subject" required>
|
<input matInput placeholder="{{'CONTACT.SUPPORT.SUBJECT' | translate}}" type="text" name="subject" formControlName="subject" required>
|
||||||
<mat-error *ngIf="formGroup.get('subject').hasError('backendError')">
|
<mat-error *ngIf="formGroup.get('subject').hasError('backendError')">
|
||||||
{{formGroup.get('subject').getError('backendError').message}}</mat-error>
|
{{formGroup.get('subject').getError('backendError').message}}</mat-error>
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<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>
|
<textarea matInput placeholder="{{'CONTACT.SUPPORT.DESCRIPTION' | translate}}" type="text" name="description" formControlName="description" required></textarea>
|
||||||
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">
|
<mat-error *ngIf="formGroup.get('description').hasError('backendError')">
|
||||||
{{formGroup.get('description').getError('backendError').message}}</mat-error>
|
{{formGroup.get('description').getError('backendError').message}}</mat-error>
|
||||||
|
|
|
@ -23,6 +23,10 @@ img {
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mat-form-field {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.send-btn {
|
.send-btn {
|
||||||
background: #ffffff 0% 0% no-repeat padding-box;
|
background: #ffffff 0% 0% no-repeat padding-box;
|
||||||
border: 1px solid var(--primary-color);
|
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 { InAppNotificationService } from '@app/core/services/inapp-notification/inapp-notification.service';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
import { nameof } from 'ts-simple-nameof';
|
import { nameof } from 'ts-simple-nameof';
|
||||||
|
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-mine-inapp-notification-listing-dialog',
|
selector: 'app-mine-inapp-notification-listing-dialog',
|
||||||
|
@ -44,8 +45,9 @@ export class MineInAppNotificationListingDialogComponent extends BaseComponent i
|
||||||
nameof<InAppNotification>(x => x.trackingState),
|
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.order = { items: ['-' + nameof<InAppNotification>(x => x.createdAt)] };
|
||||||
|
lookup.isActive = [IsActive.Active];
|
||||||
this.inappNotificationService.query(lookup)
|
this.inappNotificationService.query(lookup)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(
|
.subscribe(
|
||||||
|
|
Loading…
Reference in New Issue