From f73119df2ccbe37c1bd97731075efaa42e262b8d Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Wed, 13 Jun 2018 18:29:30 +0100 Subject: [PATCH] mgr/dashboard: User permissions control (frontend) Signed-off-by: Ricardo Marques --- .../frontend/src/app/app-routing.module.ts | 2 + .../block/rbd-form/rbd-form.component.html | 10 ++-- .../ceph/block/rbd-form/rbd-form.component.ts | 7 ++- .../block/rbd-list/rbd-list.component.html | 29 +++++++---- .../ceph/block/rbd-list/rbd-list.component.ts | 10 ++-- .../rbd-snapshot-list.component.html | 38 ++++++++++----- .../rbd-snapshot-list.component.spec.ts | 16 ++++++- .../rbd-snapshot-list.component.ts | 9 +++- .../ceph/cluster/hosts/hosts.component.html | 5 +- .../cluster/hosts/hosts.component.spec.ts | 9 ++++ .../app/ceph/cluster/hosts/hosts.component.ts | 48 +++++++++++++------ .../osd/osd-list/osd-list.component.html | 3 +- .../osd/osd-list/osd-list.component.spec.ts | 14 +++++- .../osd/osd-list/osd-list.component.ts | 8 +++- .../dashboard/health/health.component.html | 23 ++++++--- .../rgw-bucket-list.component.html | 18 +++++-- .../rgw-bucket-list.component.ts | 10 +++- .../rgw-user-list.component.html | 18 +++++-- .../rgw-user-list.component.spec.ts | 3 +- .../rgw-user-list/rgw-user-list.component.ts | 10 +++- .../frontend/src/app/core/core.module.ts | 11 ++--- .../core/forbidden/forbidden.component.html | 10 ++++ .../core/forbidden/forbidden.component.scss | 13 +++++ .../forbidden/forbidden.component.spec.ts | 24 ++++++++++ .../app/core/forbidden/forbidden.component.ts | 10 ++++ .../navigation/navigation.component.html | 36 +++++++++----- .../navigation/navigation.component.ts | 11 ++++- .../src/app/shared/api/auth.service.ts | 2 +- .../src/app/shared/models/credentials.ts | 1 + .../src/app/shared/models/permissions.ts | 43 +++++++++++++++++ .../services/api-interceptor.service.ts | 3 ++ .../shared/services/auth-storage.service.ts | 13 +++-- 32 files changed, 374 insertions(+), 93 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.html create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.scss create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.spec.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/core/forbidden/forbidden.component.ts create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/models/permissions.ts diff --git a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts index 03ef61c75128..3ed80e16c40c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/app-routing.module.ts @@ -20,6 +20,7 @@ import { RgwDaemonListComponent } from './ceph/rgw/rgw-daemon-list/rgw-daemon-li import { RgwUserFormComponent } from './ceph/rgw/rgw-user-form/rgw-user-form.component'; import { RgwUserListComponent } from './ceph/rgw/rgw-user-list/rgw-user-list.component'; import { LoginComponent } from './core/auth/login/login.component'; +import { ForbiddenComponent } from './core/forbidden/forbidden.component'; import { NotFoundComponent } from './core/not-found/not-found.component'; import { AuthGuardService } from './shared/services/auth-guard.service'; import { ModuleStatusGuardService } from './shared/services/module-status-guard.service'; @@ -107,6 +108,7 @@ const routes: Routes = [ { path: 'cephfs', component: CephfsListComponent, canActivate: [AuthGuardService] }, { path: 'configuration', component: ConfigurationComponent, canActivate: [AuthGuardService] }, { path: 'mirroring', component: MirroringComponent, canActivate: [AuthGuardService] }, + { path: '403', component: ForbiddenComponent }, { path: '404', component: NotFoundComponent }, { path: 'osd', component: OsdListComponent, canActivate: [AuthGuardService] }, { path: '**', redirectTo: '/404' } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html index 9ee46fab0997..bb52bee45c1a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.html @@ -76,15 +76,16 @@
+ *ngIf="mode === 'editing' || !poolPermission.read"> + *ngIf="mode === 'editing' || !poolPermission.read">