Open Closed

Back to default tenant from other tenant #3610


User avatar
0
abpfintranet-1 created

When I as admin click on "Login with this tenant" and enter to a new tenant environment, I want to put a button in my custom template, like the return button which ABP shows in entered tenant to return to default tenant. I want Angular codes to put in my button click to return to default tenant and the condition which I show this button in other tenant which admin entered to it from default tenant.

ABP Commercial version is 5.3.3 Angular version 14.0.3

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    muhammedaltug created

    Hello

    You can use the following example

    import { ConfigStateService } from '@abp/ng.core';
    import { Component } from '@angular/core';
    import { map } from 'rxjs/operators';
    
    @Component({
      selector: 'app-your-component',
      template: '<div *ngIf="isImpersonatorLogin$ | async"></div>',
    })
    export class YourComponent {
        isImpersonatorLogin$ = this.configState.getDeep$('currentUser.impersonatorUserId').pipe(map(Boolean))
    
      constructor(
        private configState: ConfigStateService
      ) {}
    
    }
    
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    muhammedaltug created

    Also, you can use ImpersonationService for impersonation actions.

    import { ConfigStateService } from '@abp/ng.core';
    import { Component } from '@angular/core';
    import { map } from 'rxjs/operators';
    import { ImpersonationService } from '@volo/abp.commercial.ng.ui/config';
    
    @Component({
      selector: 'app-your-component',
      template: '<div *ngIf="isImpersonatorLogin$ | async" (click)="backToImpersonator()"></div>',
    })
    export class YourComponent {
        isImpersonatorLogin$ = this.configState.getDeep$('currentUser.impersonatorUserId').pipe(map(Boolean))
    
      constructor(
        private configState: ConfigStateService,
        private impersonationService: ImpersonationService,
      ) {}
      
      backToImpersonator() {
        this.impersonationService.impersonate({}).subscribe();
      }
    
    }
    
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.