Project

General

Profile

« Previous | Next » 

Revision 60220

[Connect|Trunk]
- connect subscriber: fix previous commit - revert reading community from domain

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/connect/communityGuard/connectSubscriber.guard.ts
5 5
import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
6 6
import {SubscribeService} from "../../utils/subscribe/subscribe.service";
7 7
import {properties} from "../../../../environments/environment";
8
import {ConnectHelper} from "../connectHelper";
8 9

  
9 10
@Injectable()
10 11
export class ConnectSubscriberGuard implements CanActivate {
......
14 15

  
15 16
  check(community: string, path: string): Observable<boolean> {
16 17
    let errorCode = LoginErrorCodes.NOT_SUBSCRIBER;
18
    let communityDomain = ConnectHelper.getCommunityFromDomain(properties.domain);
19
    if (communityDomain) {
20
      community = communityDomain;
21
    }
17 22
    return this.subscribeService.isSubscribedToCommunity(properties, community).pipe(take(1), tap(subscribed =>{
18 23
      if(!subscribed){
19 24
        this.router.navigate(['/user-info'], {
modules/uoa-services-library/trunk/ng-openaire-library/src/app/connect/connectHelper.ts
4 4
export class ConnectHelper {
5 5

  
6 6
  public static  getCommunityFromDomain(domain: string): string{
7
    domain = "beta.covid-19.openaire.eu"; //for testing
7
    // domain = "beta.covid-19.openaire.eu"; //for testing
8 8
    domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
9 9
    if (domain.indexOf('openaire.eu') === -1) {
10 10
      return null;

Also available in: Unified diff