This is an automated email from the ASF dual-hosted git repository. dgnatyshyn pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
The following commit(s) were added to refs/heads/develop by this push: new 4cf5db4 [DLAB-1896]: make audit hidden if value of 'auditEnabled' is false (#802) 4cf5db4 is described below commit 4cf5db4691c50a3c6093f4bf930e520b092cff20 Author: Dmytro Gnatyshyn <42860905+dg1...@users.noreply.github.com> AuthorDate: Fri Jun 26 18:52:57 2020 +0300 [DLAB-1896]: make audit hidden if value of 'auditEnabled' is false (#802) [DLAB-1896]: Hide audit in navbar if value of 'auditEnabled' is false --- .../administration/management/management.model.ts | 1 + .../resources/webapp/src/app/app.routing.module.ts | 4 +-- .../resources/webapp/src/app/core/core.module.ts | 2 ++ .../index.ts => core/services/audit.guard.ts} | 34 +++++++--------------- .../src/app/core/services/healthStatus.service.ts | 4 +++ .../webapp/src/app/core/services/index.ts | 1 + .../audit/audit-grid/audit-grid.component.scss | 4 +-- .../bucket-browser/bucket-browser.component.html | 2 -- .../bucket-browser/bucket-browser.component.ts | 2 +- .../bucket-browser/bucket-data.service.ts | 2 +- .../webapp/src/app/shared/navbar/index.ts | 2 +- .../src/app/shared/navbar/navbar.component.html | 4 +-- 12 files changed, 27 insertions(+), 35 deletions(-) diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts index 6b0f600..4387884 100644 --- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts +++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.model.ts @@ -71,6 +71,7 @@ export class BackupOptionsModel { export interface GeneralEnvironmentStatus { admin: boolean; + auditEnabled: boolean; projectAdmin: boolean; billingEnabled: boolean; billingQuoteUsed: number; diff --git a/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts b/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts index b8792e5..81663d4 100644 --- a/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts +++ b/services/self-service/src/main/resources/webapp/src/app/app.routing.module.ts @@ -33,7 +33,7 @@ import { ProjectComponent } from './administration/project/project.component'; import { RolesComponent } from './administration/roles/roles.component'; import { SwaggerComponent } from './swagger/swagger.component'; -import { AuthorizationGuard, CheckParamsGuard, CloudProviderGuard, AdminGuard } from './core/services'; +import { AuthorizationGuard, CheckParamsGuard, CloudProviderGuard, AdminGuard, AuditGuard } from './core/services'; import {AuditComponent} from './reports/audit/audit.component'; const routes: Routes = [{ @@ -84,7 +84,7 @@ const routes: Routes = [{ { path: 'audit', component: AuditComponent, - canActivate: [AuthorizationGuard, AdminGuard], + canActivate: [AuthorizationGuard, AuditGuard], }, ] }, { diff --git a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts index f815c70..84fc615 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/core.module.ts @@ -48,6 +48,7 @@ import { NoCacheInterceptor } from './interceptors/nocache.interceptor'; import { ErrorInterceptor } from './interceptors/error.interceptor'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import {AuditGuard} from './services'; @NgModule({ imports: [CommonModule], @@ -65,6 +66,7 @@ export class CoreModule { ApplicationSecurityService, AuthorizationGuard, AdminGuard, + AuditGuard, CloudProviderGuard, CheckParamsGuard, AppRoutingService, diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.guard.ts similarity index 50% copy from services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts copy to services/self-service/src/main/resources/webapp/src/app/core/services/audit.guard.ts index 7a6f2d4..ef61d05 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/audit.guard.ts @@ -17,29 +17,15 @@ * under the License. */ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { RouterModule } from '@angular/router'; -import { MaterialModule } from '../material.module'; -import { ProgressDialogModule, BubbleModule } from '../index'; +import { Injectable } from '@angular/core'; +import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; +import { HealthStatusService } from './healthStatus.service'; -import { NavbarComponent } from './navbar.component'; -import { NotificationDialogModule } from '../modal-dialog/notification-dialog'; -import {EdgeActionDialogModule} from "../modal-dialog/edge-action-dialog"; +@Injectable() +export class AuditGuard implements CanActivate { + constructor(private _healthStatus: HealthStatusService) { } -export * from './navbar.component'; - -@NgModule({ - imports: [ - CommonModule, - RouterModule, - MaterialModule, - NotificationDialogModule, - EdgeActionDialogModule, - ProgressDialogModule, - BubbleModule, - ], - declarations: [NavbarComponent], - exports: [NavbarComponent, RouterModule] -}) -export class NavbarModule { } + canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot) { + return this._healthStatus.isPassageway('audit'); + } +} diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts index 12086bc..02004f3 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/healthStatus.service.ts @@ -119,6 +119,10 @@ export class HealthStatusService { this.appRoutingService.redirectToHomePage(); return false; } + if (parameter === 'audit' && !data.auditEnabled) { + this.appRoutingService.redirectToHomePage(); + return false; + } if (parameter === 'administration' && !data.admin && !data.projectAdmin) { this.appRoutingService.redirectToNoAccessPage(); return false; diff --git a/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts b/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts index 0068a29..2005741 100644 --- a/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/core/services/index.ts @@ -26,6 +26,7 @@ export * from './userResource.service'; export * from './authorization.guard'; export * from './admin.guard'; export * from './cloudProvider.guard'; +export * from './audit.guard'; export * from './checkParams.guard'; export * from './librariesInstallation.service'; export * from './manageUngit.service'; diff --git a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss index 125a404..f1c1df0 100644 --- a/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss +++ b/services/self-service/src/main/resources/webapp/src/app/reports/audit/audit-grid/audit-grid.component.scss @@ -32,7 +32,7 @@ tr { .th_user { - width: 19%; + width: 15%; } .th_action { @@ -48,7 +48,7 @@ } .th_resource{ - width: 11%; + width: 14%; } .th_resource-type{ diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.html index 9dfa1fb..449445f 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.html @@ -190,7 +190,6 @@ </div> <div class="size">{{file.object?.size | convertFileSize}}</div> <div class="date" *ngIf="!file.isDownloading">{{convertDate(file.object?.lastModifiedDate) | date: 'dd/MM/yyyy hh:mm:ss aa' }}</div> -<!-- <div class="date" *ngIf="!file.isDownloading">{{file.object?.lastModifiedDate }}</div>--> <div class="progress-wrapper" *ngIf="file.isDownloading"> <div class="progres"> <span class="progress-bar-text">{{file.progress || 0}}% Downloading...</span> @@ -215,7 +214,6 @@ <span class="close" matTooltip="Upload is still in progress, please wait." matTooltipPosition="above" [ngClass]="{'not-allow': isFileUploading}" [matTooltipDisabled]="!isFileUploading"> <button type="button" class="close" (click)="closeUploadWindow()" [disabled]="isFileUploading" [ngClass]="{'not-allow': isFileUploading}" >×</button> </span> - </header> <ul class="upload-files"> <li class="file upload-table-header" *ngIf="addedFiles.length"> diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts index 2485a40..d3c4c73 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-browser.component.ts @@ -62,7 +62,7 @@ export class BucketBrowserComponent implements OnInit { public isFilterVisible: boolean; public buckets; public isFileUploading: boolean; - public uploadingQueueLength: number = 5; + public uploadingQueueLength: number = 4; public maxFileSize: number = 4294967296; @ViewChild(FolderTreeComponent, {static: true}) folderTreeComponent; diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts index 9eed7a9..5dae6b4 100644 --- a/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts +++ b/services/self-service/src/main/resources/webapp/src/app/resources/bucket-browser/bucket-data.service.ts @@ -23,7 +23,7 @@ import {BucketBrowserService, TodoItemNode} from '../../core/services/bucket-bro const array = [{'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'folder11/', 'size': '18 bytes', 'lastModifiedDate': '21-4-2020 11:36:36'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'folder11/dsafaraorueajkegrgavhsfnvgahsfgsdjfhagsdjfg497frgfhsdajfsgdafjsxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzdvcfdvbgffgsdfgdsafaraorueajkegrgavhsfnvgahsfgsdjfhagsdjfg497frgfhsdajfsgdafjsxzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzdvcfdvbgffgsdfgdsfgsdfgggggg', ' [...] -{'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '3.jpg', 'size': '5 bytes', 'lastModifiedDate': '14-4-2020 09:36:16'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '2.jpg', 'size': '52 bytes', 'lastModifiedDate': '17-4-2020 12:13:26'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '1test', 'size': '112 bytes', 'lastModifiedDate': '14-4-2020 04:55:02'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'test.pem', 'size': '1 KB', 'lastModifiedDate': '14-4-2020 04:57 [...] +{'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '<script>alert("hello")' + ' </script>', 'size': '5 bytes', 'lastModifiedDate': '14-4-2020 09:36:16'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '2.jpg', 'size': '52 bytes', 'lastModifiedDate': '17-4-2020 12:13:26'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '1test', 'size': '112 bytes', 'lastModifiedDate': '14-4-2020 04:55:02'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'test.pem', 'size': '1 KB', 'las [...] {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': '5.jpg', 'size': '52 bytes', 'lastModifiedDate': '17-4-2020 12:13:26'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'test', 'size': '12 bytes', 'lastModifiedDate': '14-4-2020 04:55:02'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'test.pem', 'size': '1 KB', 'lastModifiedDate': '14-4-2020 04:57:54'}, {'bucket': 'ofuks-1304-prj1-local-bucket', 'object': 'test1', 'size': '52 bytes', 'lastModifiedDate': '17-4-2020 11:22: [...] @Injectable() diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts index 7a6f2d4..65cf645 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts +++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/index.ts @@ -25,7 +25,7 @@ import { ProgressDialogModule, BubbleModule } from '../index'; import { NavbarComponent } from './navbar.component'; import { NotificationDialogModule } from '../modal-dialog/notification-dialog'; -import {EdgeActionDialogModule} from "../modal-dialog/edge-action-dialog"; +import {EdgeActionDialogModule} from '../modal-dialog/edge-action-dialog'; export * from './navbar.component'; diff --git a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html index 8f6a8ca..f24a29f 100644 --- a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html +++ b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html @@ -95,14 +95,14 @@ <ng-template #env><i class="material-icons">settings</i></ng-template> </a> </a> - <a class="nav-item has-children" *ngIf="healthStatus?.billingEnabled || true"> + <a class="nav-item has-children" *ngIf="healthStatus?.billingEnabled || healthStatus?.auditEnabled"> <span *ngIf="isExpanded">Reports</span> <a *ngIf="healthStatus?.billingEnabled" class="sub-nav-item" [routerLink]="['/billing_report']" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}" [style.margin-left.px]="isExpanded ? '30' : '0'"> <span *ngIf="isExpanded; else billing">Billing</span> <ng-template #billing><i class="material-icons">account_balance_wallet</i></ng-template> </a> - <a class="sub-nav-item" [routerLink]="['/audit']" [style.margin-left.px]="isExpanded ? '30' : '0'" + <a *ngIf="healthStatus?.auditEnabled" class="sub-nav-item" [routerLink]="['/audit']" [style.margin-left.px]="isExpanded ? '30' : '0'" [routerLinkActive]="['active']" [routerLinkActiveOptions]="{exact:true}"> <span *ngIf="isExpanded; else audit">Audit</span> <ng-template #audit><i class="material-icons">library_books</i></ng-template> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org