Base solution for your next web application
Open Closed

How to identify users on Angular? #7757


User avatar
0
xitix created

Based on users on I want to hide some admin content to them on Front End[Angular].

Kindly provide code.

My project Type : Asp.Net core + Angular [lates v . 70 ]


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @xitix

    You can use https://aspnetboilerplate.com/Pages/Documents/Zero/Permission-Management for this. You can grant or revoke permissions to specific users and hide/show UI parts on Angular for any permission you want.

  • User Avatar
    0
    xitix created

    How to get User ID on angular?

  • User Avatar
    0
    ryancyq created
    Support Team

    In the angular component html, you can directly check for permission using Permission pipe

    <div *ngIf="'Pages.Editions.Create' | permission"></>
    

    otherwise, you can inject permission checker service and call isGranted(myPermissionName)

    import { PermissionCheckerService } from '@abp/auth/permission-checker.service';
    
    constructor(
            private _permissionCheckerService: PermissionCheckerService,
    ) {
    }
    
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.