[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:
konstantina.galouni 2019-07-03 10:14:24 +00:00
parent 065b82f9ce
commit a0b9e62c00
5 changed files with 19 additions and 16 deletions

View File

@ -31,11 +31,10 @@ export class ApprovedByCommunityComponent {
this.route.queryParams.subscribe(
communityId => {
this.communityId = communityId['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
}
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = communityId['communityId'];
}
if(this.communityId && this.communityId != "openaire") {
this._searchDataprovidersService.searchDataproviders(this.properties, this.communityId).subscribe (

View File

@ -23,8 +23,12 @@ export class ConnectSubscriberGuard implements CanActivate {
return false;
} else {
const obs = this.propertiesService.subscribeEnvironment().pipe(mergeMap(properties => {
if(!community){
community = ConnectHelper.getCommunityFromDomain(properties.domain);
let communityDomain = null;
//if(!community){
communityDomain = ConnectHelper.getCommunityFromDomain(properties.domain);
//}
if(communityDomain) {
community = communityDomain;
}
return this.communityService.isSubscribedToCommunity( community, Session.getUserEmail(), properties["adminToolsAPIURL"])
}));

View File

@ -53,10 +53,9 @@ export class MailPrefsComponent {
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.sub = this.route.queryParams.subscribe(params => {
this.communityId = params['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = params['communityId'];
}
this.fetchId = Session.getUserEmail();

View File

@ -29,9 +29,9 @@ export class IsRouteEnabled implements CanActivate {
const redirect = customRedirect ? customRedirect : '/error';
const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => {
let communityDomain = null;
if (!community) {
//if (!community) {
communityDomain = ConnectHelper.getCommunityFromDomain(res.domain);
}
//}
if(communityDomain) {
community = communityDomain;
} else if (!community && data['community']) { // for openaire or connect

View File

@ -40,10 +40,11 @@ export class HelperComponent {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(
params => {
this.communityId = params['communityId'];
if(!this.communityId){
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
this.communityId = ConnectHelper.getCommunityFromDomain(this.properties.domain);
if(!this.communityId) {
this.communityId = params['communityId'];
}
if(!this.communityId){
this.communityId = this.properties.adminToolsCommunity;
}