From 8b204cac9918fd47e9663ee8fe2688d2d5f3957e Mon Sep 17 00:00:00 2001
From: Michael Shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 7 Dec 2022 15:46:52 -0800
Subject: [PATCH] disable document form components when no object permissions
---
src-ui/src/app/app.module.ts | 2 +
.../correspondent-edit-dialog.component.html | 2 +-
.../document-type-edit-dialog.component.html | 2 +-
.../storage-path-edit-dialog.component.html | 2 +-
.../tag-edit-dialog.component.html | 2 +-
.../common/input/date/date.component.html | 4 +-
.../common/input/number/number.component.html | 4 +-
.../common/input/select/select.component.html | 2 +-
.../common/input/tags/tags.component.html | 3 +-
.../common/input/tags/tags.component.ts | 1 +
.../common/input/text/text.component.html | 2 +-
.../document-detail.component.html | 12 +++--
.../document-detail.component.ts | 11 ++++
.../if-object-permissions.directive.ts | 54 +++++++++++++++++++
.../src/app/directives/if-owner.directive.ts | 9 ++--
.../src/app/services/permissions.service.ts | 19 ++++++-
src-ui/src/app/services/settings.service.ts | 5 +-
src-ui/src/styles.scss | 1 +
18 files changed, 116 insertions(+), 21 deletions(-)
create mode 100644 src-ui/src/app/directives/if-object-permissions.directive.ts
diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts
index 183a6ad25..60a6f4844 100644
--- a/src-ui/src/app/app.module.ts
+++ b/src-ui/src/app/app.module.ts
@@ -106,6 +106,7 @@ import localeTr from '@angular/common/locales/tr'
import localeZh from '@angular/common/locales/zh'
import { ShareUserComponent } from './components/common/input/share-user/share-user.component'
import { IfOwnerDirective } from './directives/if-owner.directive'
+import { IfObjectPermissionsDirective } from './directives/if-object-permissions.directive'
registerLocaleData(localeBe)
registerLocaleData(localeCs)
@@ -199,6 +200,7 @@ function initializeApp(settings: SettingsService) {
MailRuleEditDialogComponent,
ShareUserComponent,
IfOwnerDirective,
+ IfObjectPermissionsDirective,
],
imports: [
BrowserModule,
diff --git a/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html
index 857bd2f1c..83f24812f 100644
--- a/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html
+++ b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html
@@ -11,7 +11,7 @@