add belongs to current tenant logic to notification, notification template, annotation status ui pages

This commit is contained in:
CITE\amentis 2024-09-06 13:02:47 +03:00
parent dcad5a9adc
commit f74cd9233d
7 changed files with 19 additions and 13 deletions

View File

@ -24,7 +24,8 @@ export class StatusEditorResolver extends BaseEditorResolver {
nameof<Status>(x => x.createdAt),
nameof<Status>(x => x.updatedAt),
nameof<Status>(x => x.hash),
nameof<Status>(x => x.isActive)
nameof<Status>(x => x.isActive),
nameof<Status>(x => x.belongsToCurrentTenant)
]
}

View File

@ -74,7 +74,7 @@
</ng-template>
<ng-template #actions let-row="row" let-item>
<div *ngIf="!isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div *ngIf="row?.belongsToCurrentTenant && !isDeleted(row)" class="row" (click)="$event.stopPropagation()">
<div class="col-auto">
<button mat-icon-button [matMenuTriggerFor]="actionsMenu">
<mat-icon>more_horiz</mat-icon>

View File

@ -24,6 +24,7 @@ import { StatusService } from '@annotation-service/services/http/status.service'
import { AnnotationServiceEnumUtils } from '@annotation-service/core/formatting/enum-utils.service';
import { InternalStatusTypePipe } from '@annotation-service/core/formatting/pipes/internal-status-type.pipe';
import { IsActiveTypePipe } from '@annotation-service/core/formatting/pipes/is-active-type.pipe';
import { AppPermission } from '@app/core/common/enum/permission.enum';
@Component({
templateUrl: './status-listing.component.html',
@ -44,7 +45,8 @@ export class StatusListingComponent extends BaseListingComponent<Status, StatusL
nameof<Status>(x => x.updatedAt),
nameof<Status>(x => x.createdAt),
nameof<Status>(x => x.hash),
nameof<Status>(x => x.isActive)
nameof<Status>(x => x.isActive),
nameof<Status>(x => x.belongsToCurrentTenant)
];
rowIdentity = x => x.id;
@ -74,11 +76,11 @@ export class StatusListingComponent extends BaseListingComponent<Status, StatusL
}
protected canEdit(status: Status): boolean {
return status?.isActive === IsActive.Active;
return this.authService.hasPermission(AppPermission.EditStatus) && status?.belongsToCurrentTenant && status?.isActive === IsActive.Active;
}
protected canDelete(status: Status): boolean {
return status?.isActive === IsActive.Active;
return this.authService.hasPermission(AppPermission.EditStatus) && status?.belongsToCurrentTenant && status?.isActive === IsActive.Active;
}
protected initializeLookup(): StatusLookup {

View File

@ -113,7 +113,7 @@
<div class="container-fluid">
<div class="row">
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.SUBJECT-FIELD-OPTIONS' | translate}}
<mat-checkbox [checked]="subjectFieldOptionsEnabled" (change)="subjectFieldOptionsSelectionChanged($event)" [disabled]="isDeleted"></mat-checkbox>
<mat-checkbox [checked]="subjectFieldOptionsEnabled" (change)="subjectFieldOptionsSelectionChanged($event)" [disabled]="formGroup.disabled"></mat-checkbox>
</h4>
</div>
</div>
@ -176,7 +176,7 @@
<div class="container-fluid">
<div class="row">
<h4 class="col-md-12">{{'NOTIFICATION-SERVICE.NOTIFICATION-TEMPLATE-EDITOR.FIELDS.BODY-FIELD-OPTIONS' | translate}}
<mat-checkbox [checked]="bodyFieldOptionsEnabled" (change)="bodyFieldOptionsSelectionChanged($event)" [disabled]="isDeleted"></mat-checkbox>
<mat-checkbox [checked]="bodyFieldOptionsEnabled" (change)="bodyFieldOptionsSelectionChanged($event)" [disabled]="formGroup.disabled"></mat-checkbox>
</h4>
</div>
</div>

View File

@ -53,7 +53,8 @@ export class NotificationTemplateEditorResolver extends BaseEditorResolver {
nameof<NotificationTemplate>(x => x.createdAt),
nameof<NotificationTemplate>(x => x.updatedAt),
nameof<NotificationTemplate>(x => x.hash),
nameof<NotificationTemplate>(x => x.isActive)
nameof<NotificationTemplate>(x => x.isActive),
nameof<NotificationTemplate>(x => x.belongsToCurrentTenant)
]
}

View File

@ -49,7 +49,8 @@ export class NotificationTemplateListingComponent extends BaseListingComponent<N
nameof<NotificationTemplate>(x => x.updatedAt),
nameof<NotificationTemplate>(x => x.createdAt),
nameof<NotificationTemplate>(x => x.hash),
nameof<NotificationTemplate>(x => x.isActive)
nameof<NotificationTemplate>(x => x.isActive),
nameof<NotificationTemplate>(x => x.belongsToCurrentTenant)
];
rowIdentity = x => x.id;
@ -79,11 +80,11 @@ export class NotificationTemplateListingComponent extends BaseListingComponent<N
}
protected canEdit(notificationTemplate: NotificationTemplate): boolean {
return this.authService.hasPermission(AppPermission.EditNotificationTemplate) && notificationTemplate?.isActive === IsActive.Active;
return this.authService.hasPermission(AppPermission.EditNotificationTemplate) && notificationTemplate?.belongsToCurrentTenant && notificationTemplate?.isActive === IsActive.Active;
}
protected canDelete(notificationTemplate: NotificationTemplate): boolean {
return this.authService.hasPermission(AppPermission.DeleteNotificationTemplate) && notificationTemplate?.isActive === IsActive.Active;
return this.authService.hasPermission(AppPermission.DeleteNotificationTemplate) && notificationTemplate?.belongsToCurrentTenant && notificationTemplate?.isActive === IsActive.Active;
}
protected initializeLookup(): NotificationTemplateLookup {

View File

@ -56,7 +56,8 @@ export class NotificationListingComponent extends BaseListingComponent<Notificat
nameof<Notification>(x => x.createdAt),
nameof<Notification>(x => x.updatedAt),
nameof<Notification>(x => x.hash),
nameof<Notification>(x => x.isActive)
nameof<Notification>(x => x.isActive),
nameof<Notification>(x => x.belongsToCurrentTenant)
];
rowIdentity = x => x.id;
@ -85,7 +86,7 @@ export class NotificationListingComponent extends BaseListingComponent<Notificat
}
protected canDelete(notification: Notification): boolean {
return notification?.isActive === IsActive?.Active;
return notification?.belongsToCurrentTenant && notification?.isActive === IsActive?.Active;
}
protected initializeLookup(): NotificationLookup {