permissions

This commit is contained in:
Timo 2020-12-14 09:53:40 +02:00
parent 39b7dbfbe3
commit 333253b4ce
20 changed files with 304 additions and 157 deletions

View File

@ -95,6 +95,8 @@ import { UserListingScreenComponent } from './screens/admin/users/user-listing-s
import { NotificationsComponent } from './components/notifications/notifications.component';
import { RulesScreenComponent } from './screens/admin/rules-screen/rules-screen.component';
import { WatermarkScreenComponent } from './screens/admin/watermark-screen/watermark-screen.component';
import { PdfViewerScreenComponent } from './screens/pdf-viewer-screen/pdf-viewer-screen.component';
import { HtmlDebugScreenComponent } from './screens/html-debug-screen/html-debug-screen.component';
export function HttpLoaderFactory(httpClient: HttpClient) {
return new TranslateHttpLoader(httpClient, '/assets/i18n/', '.json');
@ -115,6 +117,23 @@ const routes = [
path: 'info',
component: AppInfoComponent
},
{
path: 'pdf-preview/:fileId',
component: PdfViewerScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
routeGuards: [AuthGuard, RedRoleGuard]
}
},
{
path: 'html-debug/:fileId',
component: HtmlDebugScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
routeGuards: [AuthGuard, RedRoleGuard]
}
},
{
path: 'ui',
component: BaseScreenComponent,
@ -184,7 +203,8 @@ const routes = [
component: WatermarkScreenComponent,
canActivate: [CompositeRouteGuard],
data: {
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard]
routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard],
requiredRoles: ['RED_ADMIN']
}
}
]
@ -269,7 +289,9 @@ const matImports = [
UserListingScreenComponent,
NotificationsComponent,
RulesScreenComponent,
WatermarkScreenComponent
WatermarkScreenComponent,
PdfViewerScreenComponent,
HtmlDebugScreenComponent
],
imports: [
BrowserModule,

View File

@ -18,13 +18,27 @@ export class RedRoleGuard implements CanActivate {
obs.next(false);
obs.complete();
} else {
// we have at least 1 RED Role -> if it's not user he must be admin
if (!this._userService.isUser() && state.url.startsWith('/ui/projects')) {
this._router.navigate(['/ui/admin']);
obs.next(false);
obs.complete();
return;
}
if (route.data.requiredRoles) {
if (this._userService.hasAnyRole(route.data.requiredRoles)) {
obs.next(true);
obs.complete();
} else {
console.log('this case');
this._router.navigate(['/ui/projects']);
obs.next(false);
obs.complete();
}
} else {
obs.next(true);
obs.complete();
}
obs.next(true);
obs.complete();
}
});
}

View File

@ -14,7 +14,7 @@
[routerLinkActiveOptions]="{ exact: true }"
routerLinkActive="active"
translate="rule-editor"
*ngIf="screen === 'rules' || root"
*ngIf="(screen === 'rules' || root) && userPreferenceService.areDevFeaturesEnabled"
></a>
<a
@ -23,7 +23,7 @@
[routerLinkActiveOptions]="{ exact: true }"
routerLinkActive="active"
translate="user-management"
*ngIf="screen === 'users' || root"
*ngIf="(screen === 'users' || root) && userPreferenceService.areDevFeaturesEnabled"
></a>
<a
@ -32,7 +32,7 @@
[routerLinkActiveOptions]="{ exact: true }"
routerLinkActive="active"
translate="watermark"
*ngIf="screen === 'watermark' || root"
*ngIf="(screen === 'watermark' || root) && permissionService.isAdmin()"
></a>
<ng-container *ngIf="dictionary">

View File

@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { TypeValue } from '@redaction/red-ui-http';
import { AppStateService } from '../../state/app-state.service';
import { UserPreferenceService } from '../../common/service/user-preference.service';
import { PermissionsService } from '../../common/service/permissions.service';
@Component({
selector: 'redaction-admin-breadcrumbs',
@ -13,7 +15,12 @@ export class AdminBreadcrumbsComponent implements OnInit {
public root: boolean;
public screen: string;
constructor(private readonly _activatedRoute: ActivatedRoute, private _appStateService: AppStateService) {
constructor(
public readonly userPreferenceService: UserPreferenceService,
public readonly permissionService: PermissionsService,
private readonly _activatedRoute: ActivatedRoute,
private readonly _appStateService: AppStateService
) {
this._activatedRoute.params.subscribe((params) => {
const url = this._activatedRoute.snapshot.url;
this.root = url.length === 1;

View File

@ -11,7 +11,7 @@
<input formControlName="projectName" name="projectName" type="text" />
</div>
<div class="red-input-group" *ngIf="!project">
<div class="red-input-group required" *ngIf="!project">
<mat-form-field floatLabel="always">
<mat-label>{{ 'project-listing.add-edit-dialog.form.template' | translate }}</mat-label>
<mat-select value="EFSA 1 (Vertebrate Authors)" style="width: 100%;">

View File

@ -36,12 +36,14 @@ export class IconsModule {
'expand',
'folder',
'fullscreen',
'html-file',
'info',
'lightning',
'logout',
'menu',
'needs-work',
'notification',
'new-tab',
'pages',
'plus',
'preview',

View File

@ -72,6 +72,28 @@
tooltip="file-preview.fullscreen"
tooltipPosition="before"
></redaction-circle-button>
<!-- Dev Mode Features-->
<redaction-circle-button
*ngIf="userPreferenceService.areDevFeaturesEnabled"
(action)="openSSRFilePreview()"
icon="red:new-tab"
type="primary"
class="ml-8"
tooltip="file-preview.new-tab-ssr"
tooltipPosition="before"
></redaction-circle-button>
<redaction-circle-button
*ngIf="userPreferenceService.areDevFeaturesEnabled"
(action)="openHTMLDebug()"
icon="red:html-file"
type="primary"
class="ml-8"
tooltip="file-preview.html-debug"
tooltipPosition="before"
></redaction-circle-button>
<!-- End Dev Mode Features-->
<redaction-circle-button
[routerLink]="['/ui/projects/' + appStateService.activeProjectId]"
class="ml-8"

View File

@ -487,4 +487,14 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
this.pagesPanelActive = true;
this.selectPage($event);
}
// <!-- Dev Mode Features-->
async openSSRFilePreview() {
window.open(`/pdf-preview/${this.fileId}`, '_blank');
}
async openHTMLDebug() {
window.open(`/html-debug/${this.fileId}`, '_blank');
}
// <!-- End Dev Mode Features-->
}

View File

@ -0,0 +1,2 @@
<section [innerHTML]="htmlData"></section>
<redaction-full-page-loading-indicator [displayed]="loading"></redaction-full-page-loading-indicator>

View File

@ -0,0 +1,7 @@
section {
height: calc(100vh - 40px);
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}

View File

@ -0,0 +1,49 @@
import { ChangeDetectorRef, Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FileDownloadService } from '../file/service/file-download.service';
import { DebugControllerService } from '@redaction/red-ui-http';
import { FileType } from '../file/model/file-type';
import { FileStatusWrapper } from '../file/model/file-status.wrapper';
import { mergeMap } from 'rxjs/operators';
@Component({
selector: 'redaction-html-debug-screen',
templateUrl: './html-debug-screen.component.html',
styleUrls: ['./html-debug-screen.component.scss']
})
export class HtmlDebugScreenComponent {
private _fileId: string;
htmlData: any;
loading: boolean;
constructor(
private readonly _activatedRoute: ActivatedRoute,
private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _debugControllerService: DebugControllerService,
private readonly _fileDownloadService: FileDownloadService
) {
this._activatedRoute.params.subscribe((params) => {
this._fileId = params.fileId;
this._loadDebugHTML();
});
}
private _loadDebugHTML() {
this.loading = true;
const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null);
this._fileDownloadService
.loadFile(FileType.ANNOTATED, fileStatus)
.pipe(
mergeMap((fileData) => {
return this._debugControllerService.debugHtmlTablesForm(fileData, true);
})
)
.subscribe((data) => {
this.htmlData = data;
this.loading = false;
console.log(this.htmlData);
});
}
}

View File

@ -0,0 +1 @@
<div #viewer class="viewer"></div>

View File

@ -0,0 +1,4 @@
.viewer {
width: 100vw;
height: 100vh;
}

View File

@ -0,0 +1,74 @@
import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import WebViewer, { WebViewerInstance } from '@pdftron/webviewer';
import { environment } from '../../../environments/environment';
import { FileDownloadService } from '../file/service/file-download.service';
import { ActivatedRoute } from '@angular/router';
import { FileType } from '../file/model/file-type';
import { FileStatusWrapper } from '../file/model/file-status.wrapper';
@Component({
selector: 'redaction-pdf-viewer-screen',
templateUrl: './pdf-viewer-screen.component.html',
styleUrls: ['./pdf-viewer-screen.component.scss']
})
export class PdfViewerScreenComponent implements OnInit {
private _instance: WebViewerInstance;
@ViewChild('viewer', { static: true })
private _viewer: ElementRef;
private _fileId: string;
private _fileData: any;
constructor(
private readonly _activatedRoute: ActivatedRoute,
private readonly _changeDetectorRef: ChangeDetectorRef,
private readonly _fileDownloadService: FileDownloadService
) {
this._activatedRoute.params.subscribe((params) => {
this._fileId = params.fileId;
this._loadFile();
});
}
ngOnInit(): void {
this._loadViewer();
}
private _loadViewer() {
WebViewer(
{
licenseKey: environment.licenseKey ? atob(environment.licenseKey) : null,
isReadOnly: true,
path: '/assets/wv-resources',
css: '/assets/pdftron/stylesheet.css'
},
this._viewer.nativeElement
).then((instance) => {
this._instance = instance;
instance.docViewer.on('documentLoaded', () => {
this._changeDetectorRef.detectChanges();
});
if (this._fileData) {
this._loadDocumentIntoViewer();
}
});
}
private _loadFile() {
const fileStatus = new FileStatusWrapper({ fileId: this._fileId, lastProcessed: new Date().toISOString() }, null);
this._fileDownloadService.loadFile(FileType.ANNOTATED, fileStatus).subscribe((data) => {
this._fileData = data;
this._loadDocumentIntoViewer();
});
}
private _loadDocumentIntoViewer() {
if (this._instance) {
this._instance.loadDocument(this._fileData, {
filename: 'document.pdf'
});
}
}
}

View File

@ -113,4 +113,20 @@ export class UserService {
private _hasAnyRedRole(u: User) {
return u.roles.indexOf('RED_USER') >= 0 || u.roles.indexOf('RED_MANAGER') >= 0 || u.roles.indexOf('RED_ADMIN') >= 0;
}
hasAnyRole(requiredRoles: string[], user?: User) {
if (!user) {
user = this.user;
}
if (requiredRoles && requiredRoles.length > 0) {
for (let role of requiredRoles) {
if (user.roles.indexOf(role) >= 0) {
return true;
}
}
return false;
} else {
return true;
}
}
}

View File

@ -106,7 +106,7 @@
"description": "Description",
"name": "Name",
"due-date": "Due Date",
"template": "Project Template"
"template": "Project Template",
},
"actions": {
"save": "Save",
@ -260,6 +260,8 @@
"assign-me": "Assign to me",
"last-reviewer": "Last Reviewed by:",
"fullscreen": "Full Screen (F)",
"new-tab-ssr": "Open Document in Server Side Rendering Mode",
"html-debug": "Open Document HTML Debug",
"exit-fullscreen": "Exit Full Screen (F)"
},
"annotation-actions": {

View File

@ -0,0 +1,15 @@
<svg id="Capa_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g fill="currentColor">
<path d="M315.36,4.64C312.341,1.645,308.253-0.024,304,0H48C21.49,0,0,21.491,0,48v416c0,26.51,21.49,48,48,48h112v-32H48
c-8.837,0-16-7.163-16-16V48c0-8.837,7.163-16,16-16h240v64c0,17.673,14.327,32,32,32h64v48h32v-64
c0.025-4.253-1.645-8.341-4.64-11.36L315.36,4.64z"/>
<polygon points="176,288 208,288 208,416 240,416 240,288 272,288 272,256 176,256 "/>
<polygon
points="128,320 96,320 96,256 64,256 64,416 96,416 96,352 128,352 128,416 160,416 160,256 128,256 "/>
<path d="M406.08,257.28c-5.99-2.465-12.875-1.075-17.44,3.52L352,297.44l-36.64-36.64c-6.223-6.274-16.353-6.316-22.627-0.093
c-3.013,2.988-4.715,7.05-4.733,11.293v144h32V310.56l20.64,20.64c6.241,6.204,16.319,6.204,22.56,0l20.8-20.64V416h32V272
C415.968,265.541,412.055,259.735,406.08,257.28z"/>
<path d="M464,384V256h-32v144c0,8.837,7.163,16,16,16h64v-32H464z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
viewBox="0 0 502 502" style="enable-background:new 0 0 502 502;" xml:space="preserve">
<g fill="currentColor">
<path d="M492,0H73.939c-5.523,0-10,4.478-10,10v53.974C28.558,64.72,0,93.713,0,129.271v307.397C0,472.692,29.308,502,65.332,502
h307.398c35.557,0,64.549-28.557,65.296-63.938H492c5.523,0,10-4.478,10-10V10C502,4.478,497.523,0,492,0z M418.061,436.668
c0,24.996-20.335,45.332-45.332,45.332H65.332C40.335,482,20,461.664,20,436.668V129.271c0-24.996,20.335-45.332,45.332-45.332
h307.398c24.996,0,45.332,20.336,45.332,45.332V436.668z M482,418.062h-43.939V129.271c0-36.024-29.308-65.332-65.332-65.332
H83.939V20H482V418.062z"/>
<path d="M60.413,122.959c-5.523,0-10,4.478-10,10v221.327c0,5.522,4.477,10,10,10s10-4.478,10-10V132.959
C70.413,127.437,65.936,122.959,60.413,122.959z"/>
<path d="M60.413,387.321c-5.523,0-10,4.478-10,10v35.658c0,5.522,4.477,10,10,10s10-4.478,10-10v-35.658
C70.413,391.799,65.936,387.321,60.413,387.321z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -25,11 +25,7 @@ export class DebugControllerService {
public configuration = new Configuration();
protected basePath = '';
constructor(
protected httpClient: HttpClient,
@Optional() @Inject(BASE_PATH) basePath: string,
@Optional() configuration: Configuration
) {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
@ -47,37 +43,15 @@ export class DebugControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public debugClassificationsForm(
file: Blob,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public debugClassificationsForm(
file: Blob,
inline?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public debugClassificationsForm(
file: Blob,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public debugClassificationsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public debugClassificationsForm(
file: Blob,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public debugClassificationsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (file === null || file === undefined) {
throw new Error(
'Required parameter file was null or undefined when calling debugClassifications.'
);
throw new Error('Required parameter file was null or undefined when calling debugClassifications.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -89,18 +63,13 @@ export class DebugControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -144,37 +113,15 @@ export class DebugControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public debugHtmlTablesForm(
file: Blob,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public debugHtmlTablesForm(
file: Blob,
inline?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public debugHtmlTablesForm(
file: Blob,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public debugHtmlTablesForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public debugHtmlTablesForm(
file: Blob,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public debugHtmlTablesForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (file === null || file === undefined) {
throw new Error(
'Required parameter file was null or undefined when calling debugHtmlTables.'
);
throw new Error('Required parameter file was null or undefined when calling debugHtmlTables.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -186,18 +133,13 @@ export class DebugControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -223,7 +165,8 @@ export class DebugControllerService {
formParams = (formParams.append('file', <any>file) as any) || formParams;
}
return this.httpClient.request<any>('post', `${this.basePath}/debug/htmlTables`, {
return this.httpClient.request('post', `${this.basePath}/debug/htmlTables`, {
responseType: 'text',
body: convertFormParamsToString ? formParams.toString() : formParams,
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@ -241,37 +184,15 @@ export class DebugControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public debugSectionsForm(
file: Blob,
inline?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public debugSectionsForm(
file: Blob,
inline?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public debugSectionsForm(
file: Blob,
inline?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public debugSectionsForm(file: Blob, inline?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public debugSectionsForm(
file: Blob,
inline?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public debugSectionsForm(file: Blob, inline?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (file === null || file === undefined) {
throw new Error(
'Required parameter file was null or undefined when calling debugSections.'
);
throw new Error('Required parameter file was null or undefined when calling debugSections.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -283,18 +204,13 @@ export class DebugControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
@ -339,41 +255,15 @@ export class DebugControllerService {
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public redactionForm(
file: Blob,
inline?: boolean,
flatRedaction?: boolean,
observe?: 'body',
reportProgress?: boolean
): Observable<any>;
public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'body', reportProgress?: boolean): Observable<any>;
public redactionForm(
file: Blob,
inline?: boolean,
flatRedaction?: boolean,
observe?: 'response',
reportProgress?: boolean
): Observable<HttpResponse<any>>;
public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public redactionForm(
file: Blob,
inline?: boolean,
flatRedaction?: boolean,
observe?: 'events',
reportProgress?: boolean
): Observable<HttpEvent<any>>;
public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public redactionForm(
file: Blob,
inline?: boolean,
flatRedaction?: boolean,
observe: any = 'body',
reportProgress: boolean = false
): Observable<any> {
public redactionForm(file: Blob, inline?: boolean, flatRedaction?: boolean, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
if (file === null || file === undefined) {
throw new Error(
'Required parameter file was null or undefined when calling redaction.'
);
throw new Error('Required parameter file was null or undefined when calling redaction.');
}
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
@ -388,18 +278,13 @@ export class DebugControllerService {
// authentication (RED-OAUTH) required
if (this.configuration.accessToken) {
const accessToken =
typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/octet-stream'];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(
httpHeaderAccepts
);
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}

View File

@ -65,7 +65,7 @@ export interface FileStatus {
/**
* Date and time when the file was last uploaded.
*/
lastUploaded: string;
lastUploaded?: string;
/**
* The number of times the file has been analyzed.
*/