myrtex-mf-competition 1.0.94-beta.2 → 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 -16
- 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) {
|
|
@@ -287,6 +289,16 @@ class LibCompetitionHeaderComponent extends UnSubscriber {
|
|
|
287
289
|
this.appendSubscription(this.store.pipe(select(selectCompetitionStatus)).subscribe(result => {
|
|
288
290
|
if (result) {
|
|
289
291
|
this.competition = result;
|
|
292
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_AGREEMENT_COMPETITION))
|
|
293
|
+
.subscribe(result => this._canAgreementVersionAccess = true); // TODO false => result
|
|
294
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_CREATE_COMPETITION_VERSION))
|
|
295
|
+
.subscribe(result => this._canCreateVersionAccess = true); // TODO false => result
|
|
296
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_PUBLIC_COMPETITION))
|
|
297
|
+
.subscribe(result => this._canPublicVersionAccess = true); // TODO false => result
|
|
298
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_COMPLETE_COMPETITION))
|
|
299
|
+
.subscribe(result => this._canCompleteEntityAccess = true); // TODO false => result
|
|
300
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_CANCEL_COMPETITION))
|
|
301
|
+
.subscribe(result => this._canCancelEntityAccess = true); // TODO false => result
|
|
290
302
|
}
|
|
291
303
|
}));
|
|
292
304
|
this.appendSubscription(this.store.pipe(select(selectCompetitionType)).subscribe(result => {
|
|
@@ -330,20 +342,6 @@ class LibCompetitionHeaderComponent extends UnSubscriber {
|
|
|
330
342
|
}, 10000);
|
|
331
343
|
}
|
|
332
344
|
}));
|
|
333
|
-
this.appendSubscription(this.store.pipe(select(selectUserInfo)).subscribe(result => {
|
|
334
|
-
if (result) {
|
|
335
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_AGREEMENT_COMPETITION))
|
|
336
|
-
.subscribe(result => this._canAgreementVersionAccess = true);
|
|
337
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_CREATE_COMPETITION_VERSION))
|
|
338
|
-
.subscribe(result => this._canCreateVersionAccess = true);
|
|
339
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_PUBLIC_COMPETITION))
|
|
340
|
-
.subscribe(result => this._canPublicVersionAccess = true);
|
|
341
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_COMPLETE_COMPETITION))
|
|
342
|
-
.subscribe(result => this._canCompleteEntityAccess = true);
|
|
343
|
-
this._accessService.checkPermission(this.getAccessControl(CAN_CANCEL_COMPETITION))
|
|
344
|
-
.subscribe(result => this._canCancelEntityAccess = true);
|
|
345
|
-
}
|
|
346
|
-
}));
|
|
347
345
|
this.settingsService.getSelelectionEditEbLinks().subscribe(res => {
|
|
348
346
|
this._ebLinksModel = res;
|
|
349
347
|
});
|
|
@@ -606,14 +604,20 @@ function competitionHeaderReducer(state, action) {
|
|
|
606
604
|
}
|
|
607
605
|
|
|
608
606
|
class CompetitionHeaderService extends EndpointBaseService {
|
|
609
|
-
constructor(http, injector) {
|
|
607
|
+
constructor(http, injector, _accessService) {
|
|
610
608
|
super(http, injector);
|
|
609
|
+
this._accessService = _accessService;
|
|
611
610
|
this.url = '/application' + this.restPath + '/competition';
|
|
612
611
|
}
|
|
613
612
|
getHeader(competitionId, versionId) {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
613
|
+
const subject = new Subject();
|
|
614
|
+
this.hasAnyVersionAccess(competitionId !== null && competitionId !== void 0 ? competitionId : '').subscribe(anyVersionAccess => {
|
|
615
|
+
const statusSuffix = anyVersionAccess ? '' : '/public';
|
|
616
|
+
const params = this.getHttpVersionParam(versionId !== null && versionId !== void 0 ? versionId : '', anyVersionAccess);
|
|
617
|
+
this.http.get(`${this.url}/${competitionId}/header${statusSuffix}`, { params: this.getHttpVersionParam(versionId !== null && versionId !== void 0 ? versionId : '', anyVersionAccess) })
|
|
618
|
+
.subscribe(header => subject.next(header));
|
|
619
|
+
});
|
|
620
|
+
return subject.asObservable();
|
|
617
621
|
}
|
|
618
622
|
createVersion(competitionId) {
|
|
619
623
|
return this.http.post(`${this.url}/${competitionId}/version`, {});
|
|
@@ -636,12 +640,38 @@ class CompetitionHeaderService extends EndpointBaseService {
|
|
|
636
640
|
cancel(competitionId) {
|
|
637
641
|
return this.http.post(`${this.url}/${competitionId}/cancel`, {});
|
|
638
642
|
}
|
|
643
|
+
getAccessControl(permission, entityId) {
|
|
644
|
+
return {
|
|
645
|
+
permission,
|
|
646
|
+
objectType: COMPETITION_ENTITY_NAME,
|
|
647
|
+
objectId: entityId
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
hasAnyVersionAccess(competitionId) {
|
|
651
|
+
const subject = new Subject();
|
|
652
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_VIEW_COMPETITION_SETTINGS_ANY_STATUS, competitionId))
|
|
653
|
+
.subscribe(result => {
|
|
654
|
+
if (true) { // TODO true => result
|
|
655
|
+
subject.next(true);
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
this._accessService.checkPermission(this.getAccessControl(CAN_VIEW_COMPETITION_SETTINGS_PUBLIC_STATUS, competitionId))
|
|
659
|
+
.subscribe(result => {
|
|
660
|
+
if (false) { // TODO false => result
|
|
661
|
+
subject.next(false);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
return subject.asObservable();
|
|
665
|
+
}
|
|
666
|
+
getHttpVersionParam(versionId, anyVersionAccess) {
|
|
667
|
+
return !!anyVersionAccess && !!versionId ? new HttpParams().set('versionId', versionId) : undefined;
|
|
668
|
+
}
|
|
639
669
|
}
|
|
640
|
-
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 });
|
|
670
|
+
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 });
|
|
641
671
|
CompetitionHeaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService });
|
|
642
672
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: CompetitionHeaderService, decorators: [{
|
|
643
673
|
type: Injectable
|
|
644
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i0.Injector }]; } });
|
|
674
|
+
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i0.Injector }, { type: i5.AccessService }]; } });
|
|
645
675
|
|
|
646
676
|
class CompetitionHeaderEffects {
|
|
647
677
|
constructor(competitionHeaderService, actions$, store, alertService) {
|