myrtex-mf-competition 1.0.94-beta.1 → 1.0.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -14
- package/esm2020/lib/modules/competition-header/components/competition-header.component.mjs +12 -16
- package/esm2020/lib/modules/competition-header/constants/competition-permission.constants.mjs +3 -1
- package/esm2020/lib/modules/competition-header/services/competition-header.service.mjs +42 -7
- package/fesm2015/myrtex-mf-competition.mjs +53 -23
- package/fesm2015/myrtex-mf-competition.mjs.map +1 -1
- package/fesm2020/myrtex-mf-competition.mjs +53 -23
- package/fesm2020/myrtex-mf-competition.mjs.map +1 -1
- package/lib/modules/competition-header/constants/competition-permission.constants.d.ts +2 -0
- package/lib/modules/competition-header/services/competition-header.service.d.ts +6 -1
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
|
|
7
7
|
import * as i2 from '@ngrx/store';
|
|
8
8
|
import { createAction, props, createFeatureSelector, createSelector, select, createReducer, on, StoreModule } from '@ngrx/store';
|
|
9
9
|
import * as i3 from 'myrtex-mf-ui-composite';
|
|
10
|
-
import { selectCompetitionIdAndVersionId, EndpointBaseService, UnSubscriber, CompetitionStatusEnum, CancelCompetitionTypeEnum, CompetitionVersionStatusEnum, CompetitionVersionStatusEnumLabel, CompetitionStatusEnumLabel, CompetitionModeEnum, selectCompetitionLabel, selectCompetitionConfig,
|
|
10
|
+
import { selectCompetitionIdAndVersionId, EndpointBaseService, UnSubscriber, CompetitionStatusEnum, CancelCompetitionTypeEnum, CompetitionVersionStatusEnum, CompetitionVersionStatusEnumLabel, CompetitionStatusEnumLabel, CompetitionModeEnum, selectCompetitionLabel, selectCompetitionConfig, CompetitionVersionStatusGrouppingLabel, DialogColor, DialogType, MessageSeverity, CompetitionTypeEnum, selectCompetitionId, selectVersionId, Utilities, TenantSettingsModule, MyrtexUiComponentsModule, MyrtexMfUiCompositeModule } from 'myrtex-mf-ui-composite';
|
|
11
11
|
import * as i1$1 from 'myrtex-mf-signer';
|
|
12
12
|
import { MyrtexSignerModule } from 'myrtex-mf-signer';
|
|
13
13
|
import * as i1 from '@angular/common/http';
|
|
@@ -20,7 +20,7 @@ import * as i7 from 'myrtex-mf-ui';
|
|
|
20
20
|
import { DropdownModule, CdkTooltipModule } from 'myrtex-mf-ui';
|
|
21
21
|
import * as i9 from '@angular/forms';
|
|
22
22
|
import { FormsModule } from '@angular/forms';
|
|
23
|
-
import { EMPTY } from 'rxjs';
|
|
23
|
+
import { Subject, EMPTY } from 'rxjs';
|
|
24
24
|
import { withLatestFrom, switchMap, map, catchError, tap } from 'rxjs/operators';
|
|
25
25
|
|
|
26
26
|
var ECompetitionHeaderActions;
|
|
@@ -91,7 +91,9 @@ const CAN_CREATE_COMPETITION_VERSION = 'can-create-competition-version';
|
|
|
91
91
|
const CAN_AGREEMENT_COMPETITION = 'can-agreement-competition';
|
|
92
92
|
const CAN_PUBLIC_COMPETITION = 'can-public-competition';
|
|
93
93
|
const CAN_CANCEL_COMPETITION = 'can-cancel-competition';
|
|
94
|
-
const CAN_COMPLETE_COMPETITION = 'can-complete-competition';
|
|
94
|
+
const CAN_COMPLETE_COMPETITION = 'can-complete-competition';
|
|
95
|
+
const CAN_VIEW_COMPETITION_SETTINGS_ANY_STATUS = 'can-view-competition-settings-any-status';
|
|
96
|
+
const CAN_VIEW_COMPETITION_SETTINGS_PUBLIC_STATUS = 'can-view-competition-settings-public-status';
|
|
95
97
|
|
|
96
98
|
class SettingsService extends EndpointBaseService {
|
|
97
99
|
constructor(http, injector) {
|
|
@@ -275,6 +277,16 @@ class LibCompetitionHeaderComponent extends UnSubscriber {
|
|
|
275
277
|
this.appendSubscription(this.store.pipe(select(selectCompetitionStatus)).subscribe(result => {
|
|
276
278
|
if (result) {
|
|
277
279
|
this.competition = result;
|
|
280
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_AGREEMENT_COMPETITION))
|
|
281
|
+
.subscribe(result => this._canAgreementVersionAccess = true); // TODO false => result
|
|
282
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_CREATE_COMPETITION_VERSION))
|
|
283
|
+
.subscribe(result => this._canCreateVersionAccess = true); // TODO false => result
|
|
284
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_PUBLIC_COMPETITION))
|
|
285
|
+
.subscribe(result => this._canPublicVersionAccess = true); // TODO false => result
|
|
286
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_COMPLETE_COMPETITION))
|
|
287
|
+
.subscribe(result => this._canCompleteEntityAccess = true); // TODO false => result
|
|
288
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_CANCEL_COMPETITION))
|
|
289
|
+
.subscribe(result => this._canCancelEntityAccess = true); // TODO false => result
|
|
278
290
|
}
|
|
279
291
|
}));
|
|
280
292
|
this.appendSubscription(this.store.pipe(select(selectCompetitionType)).subscribe(result => {
|
|
@@ -318,20 +330,6 @@ class LibCompetitionHeaderComponent extends UnSubscriber {
|
|
|
318
330
|
}, 10000);
|
|
319
331
|
}
|
|
320
332
|
}));
|
|
321
|
-
this.appendSubscription(this.store.pipe(select(selectUserInfo)).subscribe(result => {
|
|
322
|
-
if (result) {
|
|
323
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_AGREEMENT_COMPETITION))
|
|
324
|
-
.subscribe(result => this._canAgreementVersionAccess = true);
|
|
325
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_CREATE_COMPETITION_VERSION))
|
|
326
|
-
.subscribe(result => this._canCreateVersionAccess = true);
|
|
327
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_PUBLIC_COMPETITION))
|
|
328
|
-
.subscribe(result => this._canPublicVersionAccess = true);
|
|
329
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_COMPLETE_COMPETITION))
|
|
330
|
-
.subscribe(result => this._canCompleteEntityAccess = true);
|
|
331
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_CANCEL_COMPETITION))
|
|
332
|
-
.subscribe(result => this._canCancelEntityAccess = true);
|
|
333
|
-
}
|
|
334
|
-
}));
|
|
335
333
|
this.settingsService.getSelelectionEditEbLinks().subscribe(res => {
|
|
336
334
|
this._ebLinksModel = res;
|
|
337
335
|
});
|
|
@@ -598,14 +596,20 @@ function competitionHeaderReducer(state, action) {
|
|
|
598
596
|
}
|
|
599
597
|
|
|
600
598
|
class CompetitionHeaderService extends EndpointBaseService {
|
|
601
|
-
constructor(http, injector) {
|
|
599
|
+
constructor(http, injector, _accessService) {
|
|
602
600
|
super(http, injector);
|
|
601
|
+
this._accessService = _accessService;
|
|
603
602
|
this.url = '/application' + this.restPath + '/competition';
|
|
604
603
|
}
|
|
605
604
|
getHeader(competitionId, versionId) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
605
|
+
const subject = new Subject();
|
|
606
|
+
this.hasAnyVersionAccess(competitionId ?? '').subscribe(anyVersionAccess => {
|
|
607
|
+
const statusSuffix = anyVersionAccess ? '' : '/public';
|
|
608
|
+
const params = this.getHttpVersionParam(versionId ?? '', anyVersionAccess);
|
|
609
|
+
this.http.get(`${this.url}/${competitionId}/header${statusSuffix}`, { params: this.getHttpVersionParam(versionId ?? '', anyVersionAccess) })
|
|
610
|
+
.subscribe(header => subject.next(header));
|
|
611
|
+
});
|
|
612
|
+
return subject.asObservable();
|
|
609
613
|
}
|
|
610
614
|
createVersion(competitionId) {
|
|
611
615
|
return this.http.post(`${this.url}/${competitionId}/version`, {});
|
|
@@ -628,12 +632,38 @@ class CompetitionHeaderService extends EndpointBaseService {
|
|
|
628
632
|
cancel(competitionId) {
|
|
629
633
|
return this.http.post(`${this.url}/${competitionId}/cancel`, {});
|
|
630
634
|
}
|
|
635
|
+
getAccessControl(permission, entityId) {
|
|
636
|
+
return {
|
|
637
|
+
permission,
|
|
638
|
+
objectType: COMPETITION_ENTITY_NAME,
|
|
639
|
+
objectId: entityId
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
hasAnyVersionAccess(competitionId) {
|
|
643
|
+
const subject = new Subject();
|
|
644
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_VIEW_COMPETITION_SETTINGS_ANY_STATUS, competitionId))
|
|
645
|
+
.subscribe(result => {
|
|
646
|
+
if (true) { // TODO true => result
|
|
647
|
+
subject.next(true);
|
|
648
|
+
}
|
|
649
|
+
});
|
|
650
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_VIEW_COMPETITION_SETTINGS_PUBLIC_STATUS, competitionId))
|
|
651
|
+
.subscribe(result => {
|
|
652
|
+
if (false) { // TODO false => result
|
|
653
|
+
subject.next(false);
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
return subject.asObservable();
|
|
657
|
+
}
|
|
658
|
+
getHttpVersionParam(versionId, anyVersionAccess) {
|
|
659
|
+
return !!anyVersionAccess && !!versionId ? new HttpParams().set('versionId', versionId) : undefined;
|
|
660
|
+
}
|
|
631
661
|
}
|
|
632
|
-
CompetitionHeaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService, deps: [{ token: i1.HttpClient }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
662
|
+
CompetitionHeaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService, deps: [{ token: i1.HttpClient }, { token: i0.Injector }, { token: i5.AccessService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
633
663
|
CompetitionHeaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService });
|
|
634
664
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService, decorators: [{
|
|
635
665
|
type: Injectable
|
|
636
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i0.Injector }]; } });
|
|
666
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i0.Injector }, { type: i5.AccessService }]; } });
|
|
637
667
|
|
|
638
668
|
class CompetitionHeaderEffects {
|
|
639
669
|
constructor(competitionHeaderService, actions$, store, alertService) {
|