[Trunk | Library]:
approved.component & connectSubscriber.guard & mailPrefs.component & isRouteEnabled.guardisRouteEnabled.guard & helper.componenthelper.component: Priority to get communityId from domain (if not exists, check url parameter) git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56330 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
065b82f9ce
commit
a0b9e62c00
|
@ -31,11 +31,10 @@ export class ApprovedByCommunityComponent {
|
||||||
|
|
||||||
this.route.queryParams.subscribe(
|
this.route.queryParams.subscribe(
|
||||||
communityId => {
|
communityId => {
|
||||||
this.communityId = communityId['communityId'];
|
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||||
|
if(!this.communityId) {
|
||||||
if(!this.communityId){
|
this.communityId = communityId['communityId'];
|
||||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(this.communityId && this.communityId != "openaire") {
|
if(this.communityId && this.communityId != "openaire") {
|
||||||
this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe (
|
this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe (
|
||||||
|
|
|
@ -23,8 +23,12 @@ export class ConnectSubscriberGuard implements CanActivate {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => {
|
const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => {
|
||||||
if(!community){
|
let communityDomain = null;
|
||||||
community = ConnectHelper.getCommunityFromDomain(properties.domain);
|
//if(!community){
|
||||||
|
communityDomain = ConnectHelper.getCommunityFromDomain(properties.domain);
|
||||||
|
//}
|
||||||
|
if(communityDomain) {
|
||||||
|
community = communityDomain;
|
||||||
}
|
}
|
||||||
return this.communityService.isSubscribedToCommunity( community, Session.getUserEmail(), properties["adminToolsAPIURL"])
|
return this.communityService.isSubscribedToCommunity( community, Session.getUserEmail(), properties["adminToolsAPIURL"])
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -53,10 +53,9 @@ export class MailPrefsComponent {
|
||||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||||
this.properties = data.envSpecific;
|
this.properties = data.envSpecific;
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
this.communityId = params['communityId'];
|
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||||
|
if(!this.communityId) {
|
||||||
if(!this.communityId){
|
this.communityId = params['communityId'];
|
||||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fetchId = Session.getUserEmail();
|
this.fetchId = Session.getUserEmail();
|
||||||
|
|
|
@ -29,9 +29,9 @@ export class IsRouteEnabled implements CanActivate {
|
||||||
const redirect = customRedirect ? customRedirect : '/error';
|
const redirect = customRedirect ? customRedirect : '/error';
|
||||||
const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => {
|
const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => {
|
||||||
let communityDomain = null;
|
let communityDomain = null;
|
||||||
if (!community) {
|
//if (!community) {
|
||||||
communityDomain = ConnectHelper.getCommunityFromDomain(res.domain);
|
communityDomain = ConnectHelper.getCommunityFromDomain(res.domain);
|
||||||
}
|
//}
|
||||||
if(communityDomain) {
|
if(communityDomain) {
|
||||||
community = communityDomain;
|
community = communityDomain;
|
||||||
} else if (!community && data['community']) { // for openaire or connect
|
} else if (!community && data['community']) { // for openaire or connect
|
||||||
|
|
|
@ -40,10 +40,11 @@ export class HelperComponent {
|
||||||
this.properties = data.envSpecific;
|
this.properties = data.envSpecific;
|
||||||
this.route.queryParams.subscribe(
|
this.route.queryParams.subscribe(
|
||||||
params => {
|
params => {
|
||||||
this.communityId = params['communityId'];
|
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
||||||
if(!this.communityId){
|
if(!this.communityId) {
|
||||||
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
|
this.communityId = params['communityId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.communityId){
|
if(!this.communityId){
|
||||||
this.communityId = this.properties.adminToolsCommunity;
|
this.communityId = this.properties.adminToolsCommunity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue