-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from GIP-SmartMercial/5-role-with-missing-right…
…-cannot-be-edited fixed problem opening role with a missing right #5
- Loading branch information
Showing
10 changed files
with
178 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
* Copyright 2022 GIP SmartMercial GmbH, Germany | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
*/ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Injectable } from '@angular/core'; | ||
import { ApiService, StartOrderOptionsBuilder, StartOrderResult } from '@zeta/api'; | ||
import { I18nService } from '@zeta/i18n'; | ||
import { XcDialogService } from '@zeta/xc'; | ||
import { catchError, EMPTY, filter, Observable } from 'rxjs'; | ||
import { extractError, RTC, XACM_WF } from './acm-consts'; | ||
import { XoACMLocale } from './xo/xo-locale.model'; | ||
import { XoRight } from './xo/xo-right.model'; | ||
|
||
|
||
@Injectable() | ||
export class ACMApiService extends ApiService { | ||
|
||
defaultStartOrderOptions1 = new StartOrderOptionsBuilder() | ||
.withErrorMessage(true) | ||
.options; | ||
|
||
private readonly currentXoLocale: XoACMLocale; | ||
|
||
|
||
constructor(http: HttpClient, readonly i18n: I18nService, private readonly dialogService: XcDialogService) { | ||
super(http); | ||
this.currentXoLocale = new XoACMLocale(); | ||
this.currentXoLocale.language = i18n.language; | ||
} | ||
|
||
|
||
createRight(right: XoRight): Observable<StartOrderResult> { | ||
return this.startOrder(RTC, XACM_WF.xmcp.xacm.rightsmanagement.CreateRight, [right, this.xoLocale], null, StartOrderOptionsBuilder.defaultOptionsWithErrorMessage).pipe( | ||
catchError(error => { | ||
this.dialogService.error(extractError(error)); | ||
return EMPTY; | ||
}), | ||
filter(response => { | ||
if (response?.errorMessage) { | ||
this.dialogService.error(response.errorMessage); | ||
} | ||
return response && !response.errorMessage; | ||
}) | ||
); | ||
} | ||
|
||
|
||
/** @todo Add functions for all other ACM API calls (move them from their management-components into this service) */ | ||
|
||
|
||
get xoLocale(): XoACMLocale { | ||
return this.currentXoLocale; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.