diff --git a/src/app/permission/app-detail/app-detail.component.ts b/src/app/permission/app-detail/app-detail.component.ts index 1cc4bdb..a4b7901 100644 --- a/src/app/permission/app-detail/app-detail.component.ts +++ b/src/app/permission/app-detail/app-detail.component.ts @@ -686,7 +686,7 @@ export class AppDetailComponent implements OnInit, OnDestroy { const pList = this.prepareProductList() if (pList.length === 0) return // products are required this.assApi - .grantAssignment({ + .grantAssignments({ createProductAssignmentsRequest: { roleId: role.id, productNames: pList, diff --git a/src/app/permission/permission-detail/permission-detail.component.ts b/src/app/permission/permission-detail/permission-detail.component.ts index 40c3ce1..50ae256 100644 --- a/src/app/permission/permission-detail/permission-detail.component.ts +++ b/src/app/permission/permission-detail/permission-detail.component.ts @@ -4,7 +4,12 @@ import { TranslateService } from '@ngx-translate/core' import { PortalMessageService, UserService } from '@onecx/portal-integration-angular' -import { /* CreateRoleRequest, UpdateRoleRequest, */ PermissionAPIService, Permission } from 'src/app/shared/generated' +import { + CreatePermissionRequest, + UpdatePermissionRequest, + PermissionAPIService, + Permission +} from 'src/app/shared/generated' import { App, ChangeMode, PermissionViewRow } from 'src/app/permission/app-detail/app-detail.component' @Component({ @@ -52,6 +57,10 @@ export class PermissionDetailComponent implements OnChanges { if (this.userService.hasPermission('PERMISSION#EDIT') || this.userService.hasPermission('PERMISSION#CREATE')) this.formGroup.enable() else this.formGroup.disable() + if (this.changeMode === 'EDIT') { + this.formGroup.controls['appId'].disable() + this.formGroup.controls['productName'].disable() + } } public onClose(): void { @@ -83,59 +92,52 @@ export class PermissionDetailComponent implements OnChanges { return } } - console.info('form valid ' + this.formGroup.valid) if (this.changeMode === 'CREATE') { - /* const permission = { + const permission = { appId: this.formGroup.controls['appId'].value, productName: this.formGroup.controls['productName'].value, resource: this.formGroup.controls['resource'].value, action: this.formGroup.controls['action'].value, description: this.formGroup.controls['description'].value - } as CreateRoleRequest + } as CreatePermissionRequest - this.permApi.createPermission({ - createRolesRequest: { permissions: [permission] } - }) - .subscribe({ - next: () => { - this.msgService.success({ summaryKey: 'ACTIONS.' + this.changeMode + '.MESSAGE.PERMISSION_OK' }) - this.dataChanged.emit(true) - }, - error: (err) => { - this.msgService.error({ summaryKey: 'ACTIONS.' + this.changeMode + '.MESSAGE.PERMISSION_NOK' }) - console.error(err) - } - }) - */ + this.permApi.createPermission({ createPermissionRequest: permission }).subscribe({ + next: () => { + this.msgService.success({ summaryKey: 'ACTIONS.' + this.changeMode + '.MESSAGE.PERMISSION_OK' }) + this.dataChanged.emit(true) + }, + error: (err) => { + this.msgService.error({ summaryKey: 'ACTIONS.' + this.changeMode + '.MESSAGE.PERMISSION_NOK' }) + console.error(err) + } + }) } else { console.info('form valid ' + this.formGroup.valid) //const roleNameChanged = this.formGroup.controls['name'].value !== this.permission?.name - /* const permission = { + const permission = { modificationCount: this.permission?.modificationCount, appId: this.formGroup.controls['appId'].value, productName: this.formGroup.controls['productName'].value, resource: this.formGroup.controls['resource'].value, action: this.formGroup.controls['action'].value, description: this.formGroup.controls['description'].value - } as UpdateRoleRequest - */ - /* this.permApi.updatePermission({ id: this.permission?.id ?? '', updateRoleRequest: permission }).subscribe({ + } as UpdatePermissionRequest + + this.permApi.updatePermission({ id: this.permission?.id ?? '', updatePermissionRequest: permission }).subscribe({ next: () => { this.msgService.success({ summaryKey: 'ACTIONS.EDIT.MESSAGE.PERMISSION_OK' }) - this.dataChanged.emit(roleNameChanged) + this.dataChanged.emit(true) }, error: (err) => { this.msgService.error({ summaryKey: 'ACTIONS.EDIT.MESSAGE.PERMISSION_NOK' }) console.error(err) } }) - */ } } public onDeleteConfirmation() { - console.info('form valid ' + this.formGroup.valid) - /* this.permApi.deletePermission({ id: this.permission?.id ?? '' }).subscribe({ + this.permApi.deletePermission({ id: this.permission?.id ?? '' }).subscribe({ next: () => { this.msgService.success({ summaryKey: 'ACTIONS.DELETE.MESSAGE.PERMISSION_OK' }) this.dataChanged.emit(true) @@ -145,6 +147,5 @@ export class PermissionDetailComponent implements OnChanges { console.error(err.error) } }) - */ } } diff --git a/src/app/shared/generated/.openapi-generator/FILES b/src/app/shared/generated/.openapi-generator/FILES index 1c03901..2e7bde2 100644 --- a/src/app/shared/generated/.openapi-generator/FILES +++ b/src/app/shared/generated/.openapi-generator/FILES @@ -19,6 +19,7 @@ model/assignment.ts model/assignmentPageResult.ts model/assignmentSearchCriteria.ts model/createAssignmentRequest.ts +model/createPermissionRequest.ts model/createProductAssignmentsRequest.ts model/createRoleRequest.ts model/createRolesRequest.ts @@ -40,6 +41,7 @@ model/revokeAssignmentRequest.ts model/role.ts model/rolePageResult.ts model/roleSearchCriteria.ts +model/updatePermissionRequest.ts model/updateRoleRequest.ts model/workspaceAbstract.ts model/workspaceDetails.ts diff --git a/src/app/shared/generated/api/assignment.service.ts b/src/app/shared/generated/api/assignment.service.ts index def2b49..1cb19e6 100644 --- a/src/app/shared/generated/api/assignment.service.ts +++ b/src/app/shared/generated/api/assignment.service.ts @@ -50,7 +50,7 @@ export interface GetAssignmentRequestParams { id: string; } -export interface GrantAssignmentRequestParams { +export interface GrantAssignmentsRequestParams { createProductAssignmentsRequest: CreateProductAssignmentsRequest; } @@ -314,18 +314,18 @@ export class AssignmentAPIService { } /** - * Create new assignments for products + * Create new assignments by criteria * @param requestParameters * @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 grantAssignment(requestParameters: GrantAssignmentRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; - public grantAssignment(requestParameters: GrantAssignmentRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public grantAssignment(requestParameters: GrantAssignmentRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; - public grantAssignment(requestParameters: GrantAssignmentRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { + public grantAssignments(requestParameters: GrantAssignmentsRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; + public grantAssignments(requestParameters: GrantAssignmentsRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public grantAssignments(requestParameters: GrantAssignmentsRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public grantAssignments(requestParameters: GrantAssignmentsRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { const createProductAssignmentsRequest = requestParameters.createProductAssignmentsRequest; if (createProductAssignmentsRequest === null || createProductAssignmentsRequest === undefined) { - throw new Error('Required parameter createProductAssignmentsRequest was null or undefined when calling grantAssignment.'); + throw new Error('Required parameter createProductAssignmentsRequest was null or undefined when calling grantAssignments.'); } let localVarHeaders = this.defaultHeaders; diff --git a/src/app/shared/generated/api/permission.service.ts b/src/app/shared/generated/api/permission.service.ts index a783106..4bd83fe 100644 --- a/src/app/shared/generated/api/permission.service.ts +++ b/src/app/shared/generated/api/permission.service.ts @@ -18,22 +18,45 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +// @ts-ignore +import { CreatePermissionRequest } from '../model/createPermissionRequest'; +// @ts-ignore +import { Permission } from '../model/permission'; // @ts-ignore import { PermissionPageResult } from '../model/permissionPageResult'; // @ts-ignore import { PermissionSearchCriteria } from '../model/permissionSearchCriteria'; // @ts-ignore import { ProblemDetailResponse } from '../model/problemDetailResponse'; +// @ts-ignore +import { UpdatePermissionRequest } from '../model/updatePermissionRequest'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; +export interface CreatePermissionRequestParams { + createPermissionRequest: CreatePermissionRequest; +} + +export interface DeletePermissionRequestParams { + id: string; +} + +export interface GetPermissionRequestParams { + id: string; +} + export interface SearchPermissionsRequestParams { permissionSearchCriteria: PermissionSearchCriteria; } +export interface UpdatePermissionRequestParams { + id: string; + updatePermissionRequest: UpdatePermissionRequest; +} + @Injectable({ providedIn: 'any' @@ -99,6 +122,192 @@ export class PermissionAPIService { return httpParams; } + /** + * Create permission + * @param requestParameters + * @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 createPermission(requestParameters: CreatePermissionRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; + public createPermission(requestParameters: CreatePermissionRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public createPermission(requestParameters: CreatePermissionRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public createPermission(requestParameters: CreatePermissionRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { + const createPermissionRequest = requestParameters.createPermissionRequest; + if (createPermissionRequest === null || createPermissionRequest === undefined) { + throw new Error('Required parameter createPermissionRequest was null or undefined when calling createPermission.'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/permissions`; + return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: createPermissionRequest, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Delete permission + * @param requestParameters + * @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 deletePermission(requestParameters: DeletePermissionRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable; + public deletePermission(requestParameters: DeletePermissionRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public deletePermission(requestParameters: DeletePermissionRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable>; + public deletePermission(requestParameters: DeletePermissionRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: undefined, context?: HttpContext}): Observable { + const id = requestParameters.id; + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling deletePermission.'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/permissions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + return this.httpClient.request('delete', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Get permission + * @param requestParameters + * @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 getPermission(requestParameters: GetPermissionRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; + public getPermission(requestParameters: GetPermissionRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public getPermission(requestParameters: GetPermissionRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public getPermission(requestParameters: GetPermissionRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { + const id = requestParameters.id; + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPermission.'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/permissions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Search for permissions * @param requestParameters @@ -168,4 +377,77 @@ export class PermissionAPIService { ); } + /** + * Update permission by ID + * @param requestParameters + * @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 updatePermission(requestParameters: UpdatePermissionRequestParams, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable; + public updatePermission(requestParameters: UpdatePermissionRequestParams, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public updatePermission(requestParameters: UpdatePermissionRequestParams, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable>; + public updatePermission(requestParameters: UpdatePermissionRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext}): Observable { + const id = requestParameters.id; + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling updatePermission.'); + } + const updatePermissionRequest = requestParameters.updatePermissionRequest; + if (updatePermissionRequest === null || updatePermissionRequest === undefined) { + throw new Error('Required parameter updatePermissionRequest was null or undefined when calling updatePermission.'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/permissions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + return this.httpClient.request('put', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: updatePermissionRequest, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + } diff --git a/src/app/shared/generated/model/createPermissionRequest.ts b/src/app/shared/generated/model/createPermissionRequest.ts new file mode 100644 index 0000000..dbeeecd --- /dev/null +++ b/src/app/shared/generated/model/createPermissionRequest.ts @@ -0,0 +1,21 @@ +/** + * onecx-permission-bff + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CreatePermissionRequest { + appId?: string; + productName?: string; + resource?: string; + action?: string; + description?: string; +} + diff --git a/src/app/shared/generated/model/models.ts b/src/app/shared/generated/model/models.ts index a27cf5d..d3cacf3 100644 --- a/src/app/shared/generated/model/models.ts +++ b/src/app/shared/generated/model/models.ts @@ -5,6 +5,7 @@ export * from './assignment'; export * from './assignmentPageResult'; export * from './assignmentSearchCriteria'; export * from './createAssignmentRequest'; +export * from './createPermissionRequest'; export * from './createProductAssignmentsRequest'; export * from './createRoleRequest'; export * from './createRolesRequest'; @@ -25,6 +26,7 @@ export * from './revokeAssignmentRequest'; export * from './role'; export * from './rolePageResult'; export * from './roleSearchCriteria'; +export * from './updatePermissionRequest'; export * from './updateRoleRequest'; export * from './workspaceAbstract'; export * from './workspaceDetails'; diff --git a/src/app/shared/generated/model/updatePermissionRequest.ts b/src/app/shared/generated/model/updatePermissionRequest.ts new file mode 100644 index 0000000..d0e7a0e --- /dev/null +++ b/src/app/shared/generated/model/updatePermissionRequest.ts @@ -0,0 +1,22 @@ +/** + * onecx-permission-bff + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface UpdatePermissionRequest { + modificationCount: number; + appId?: string; + productName?: string; + resource?: string; + action?: string; + description?: string; +} + diff --git a/src/assets/api/openapi-bff.yaml b/src/assets/api/openapi-bff.yaml index 16f2d37..7305b78 100644 --- a/src/assets/api/openapi-bff.yaml +++ b/src/assets/api/openapi-bff.yaml @@ -179,6 +179,120 @@ paths: application/json: schema: $ref: '#/components/schemas/ProblemDetailResponse' + /permissions: + post: + x-onecx: + permissions: + permission: + - write + tags: + - permission + description: Create permission + operationId: createPermission + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/CreatePermissionRequest' + responses: + 201: + description: New permission created + headers: + Location: + required: true + schema: + type: string + format: url + content: + application/json: + schema: + $ref: '#/components/schemas/Permission' + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetailResponse' + /permissions/{id}: + get: + x-onecx: + permissions: + permission: + - read + tags: + - permission + description: Get permission + operationId: getPermission + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 200: + description: Get permission + content: + application/json: + schema: + $ref: '#/components/schemas/Permission' + 404: + description: Permission not found + delete: + x-onecx: + permissions: + permission: + - delete + tags: + - permission + description: Delete permission + operationId: deletePermission + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + 204: + description: Permission deleted + put: + x-onecx: + permissions: + permission: + - write + tags: + - permission + description: Update permission by ID + operationId: updatePermission + parameters: + - name: id + in: path + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/UpdatePermissionRequest' + responses: + 200: + description: Permission updated + content: + application/json: + schema: + $ref: '#/components/schemas/Permission' + 400: + description: Bad request + content: + application/json: + schema: + $ref: '#/components/schemas/ProblemDetailResponse' + 404: + description: Permission not found /permissions/search: post: x-onecx: @@ -282,8 +396,8 @@ paths: - write tags: - assignment - description: Create new assignments for products - operationId: grantAssignment + description: Create new assignments by criteria + operationId: grantAssignments requestBody: required: true content: @@ -292,7 +406,7 @@ paths: $ref: '#/components/schemas/CreateProductAssignmentsRequest' responses: 201: - description: New assignment created + description: New assignments created 400: description: Bad request content: @@ -661,6 +775,36 @@ components: type: string description: type: string + CreatePermissionRequest: + type: object + properties: + appId: + type: string + productName: + type: string + resource: + type: string + action: + type: string + description: + type: string + UpdatePermissionRequest: + required: + - modificationCount + properties: + modificationCount: + format: int32 + type: integer + appId: + type: string + productName: + type: string + resource: + type: string + action: + type: string + description: + type: string AssignmentSearchCriteria: type: object properties: