From a86af342ebd079ba2effec547f36426e39176263 Mon Sep 17 00:00:00 2001 From: Sean Engelhardt Date: Thu, 21 Feb 2019 11:40:56 +0100 Subject: [PATCH] Add history permission into client Requires the permission "core.can_see_history" to see the history in the navigation. Disables navigating in the timeline and clearing the history for everyone than than the super admin --- .../history-list/history-list.component.html | 5 ++- .../history-list/history-list.component.ts | 32 ++++++++++++------- client/src/app/site/history/history.config.ts | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/client/src/app/site/history/components/history-list/history-list.component.html b/client/src/app/site/history/components/history-list/history-list.component.html index f851221eb..79773a23d 100644 --- a/client/src/app/site/history/components/history-list/history-list.component.html +++ b/client/src/app/site/history/components/history-list/history-list.component.html @@ -4,7 +4,10 @@ diff --git a/client/src/app/site/history/components/history-list/history-list.component.ts b/client/src/app/site/history/components/history-list/history-list.component.ts index 1d0f8b125..de8d67a3c 100644 --- a/client/src/app/site/history/components/history-list/history-list.component.ts +++ b/client/src/app/site/history/components/history-list/history-list.component.ts @@ -10,6 +10,7 @@ import { History } from 'app/shared/models/core/history'; import { HistoryRepositoryService } from 'app/core/repositories/history/history-repository.service'; import { isDetailNavigable } from 'app/shared/models/base/detail-navigable'; import { ListViewBaseComponent } from 'app/site/base/list-view-base'; +import { OperatorService } from 'app/core/core-services/operator.service'; import { ViewHistory } from '../../models/view-history'; import { ViewModelStoreService } from 'app/core/core-services/view-model-store.service'; @@ -36,6 +37,9 @@ export class HistoryListComponent extends ListViewBaseComponent { - await this.repo.browseHistory(history); - const element = this.viewModelStore.get(history.getCollectionString(), history.getModelId()); - let message = this.translate.instant('OpenSlides is temporarily reset to following timestamp:'); - console.log(message); - message += ' ' + history.getLocaleString('DE-de'); + if (this.operator.isInGroupIds(2)) { + await this.repo.browseHistory(history); + const element = this.viewModelStore.get(history.getCollectionString(), history.getModelId()); + let message = this.translate.instant('OpenSlides is temporarily reset to following timestamp:'); + message += ' ' + history.getLocaleString('DE-de'); - if (isDetailNavigable(element)) { - this.raiseError(message); - this.router.navigate([element.getDetailStateURL()]); - } else { - this.raiseError(message); + if (isDetailNavigable(element)) { + this.raiseError(message); + this.router.navigate([element.getDetailStateURL()]); + } else { + this.raiseError(message); + } } } @@ -123,7 +129,9 @@ export class HistoryListComponent extends ListViewBaseComponent