Commit f7733648 authored by Labros Papadopoulos's avatar Labros Papadopoulos
Browse files

redirection logic

parent 56022ce9
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -214,7 +214,6 @@ export class EditIndividualsComponent implements OnInit {
        }
      )
    }
    // this.updateGeographicSite();
  }

  refreshIndividual(updatedIndividual: Individual) {
@@ -223,7 +222,6 @@ export class EditIndividualsComponent implements OnInit {
    if(this.testbedProvider) {
      this.retrieveGeographicSite()
      }
    console.log("TODO-Retrieve Geographic Site info as well")//TODO
  }

  retrieveGeographicSite(){
+1 −23
Original line number Diff line number Diff line
@@ -17,46 +17,24 @@ export class RedirectComponent implements OnInit {
  ) { }

  ngOnInit() {
    // this.authService.fetchIndividualInfo();
    let isTestbedProvider = false;
    if(this.authService != null && this.authService.portalUserJWT !=null) {
    for(var val of this.authService.portalUserJWT.realm_access.roles){
      if (val ==='TESTBED_PROVIDER') {
        isTestbedProvider=true
        }
    }}
    //TODO insert redirection logic

    const activePortal = localStorage.getItem('active_portal')

    if (activePortal === 'services') {
        if (isTestbedProvider){
        this.router.navigate(['services', 'individual_update'])
        }
        else {
      // this.router.navigate(['services', 'services_marketplace'])
      this.router.navigate(['services', 'individual_update'])

    }
    }
    else if (activePortal === 'resources') {
      this.router.navigate(['resources', 'resource_catalogs'])
    }
    else if (activePortal === 'testing') {

    if (isTestbedProvider){
      this.router.navigate(['testing', 'individual_update'])
      } else {
      this.router.navigate(['testing', 'service_test_specs'])
      }
    }

    else if (activePortal === 'products') {

    if (isTestbedProvider){
          this.router.navigate(['products', 'individual_update'])
          } else {
          this.router.navigate(['products', 'marketplace'])
          }
    }

    else {
+11 −23
Original line number Diff line number Diff line
@@ -126,18 +126,6 @@ export class AuthService {
    )
  }

  public fetchIndividualInfo() {
    // this.portalUserJWT = decode(this.getAccessToken())
    this.individualService.retrieveIndividual({id:'myuser'}).subscribe(
      data => { this.portalUser = data },
      error => {
        console.error(error)
        // this.toast.error('An error occurred fetching user information')
        // this.logout()
      }
    )
  }

  public login() {
    this.oauthService.initCodeFlow()
  }