sarpay-echonos
11/7/2019 - 6:38 AM

Permissions

.NET

using Abp.Authorization;
using Echonos.Authorization;

[AbpAuthorize(AppPermissions.Pages_ControlNumbers)]
public class ControlNumbersAppService : EchonosAppServiceBase, IControlNumbersAppService {

  public void CreateUser(CreateOrUpdateUserInput input)
  {
    if (!PermissionChecker.IsGranted("Administration.UserManagement.CreateUser"))
    {
      throw new AbpAuthorizationException("You are not authorized to create user!");
    }
    //A user can not reach this point if he is not granted for "Administration.UserManagement.CreateUser" permission.
    
    PermissionChecker.Authorize("Administration.UserManagement.CreateUser");
    //A user can not reach this point if he is not granted for "Administration.UserManagement.CreateUser" permission.
  }
}

JS

const isPartner = abp.auth.isGranted("Pages.Partner");

HTML

<div class="col-md-3" [hidden]="!isGrantedAny('Pages.Partner')">

<a href="javascript:;" *ngIf="permission.isGranted('Pages.ControlNumbers.Delete')"
  (click)="deleteControlNumber(record.controlNumber)">{{l('Delete')}}</a>
DiscriminatorIsGrantedNameTenantIdRoleIdUserId
RolePermissionSetting1Pages.Partner417
RolePermissionSetting1Pages417
RolePermissionSetting0Pages.Partner416
RolePermissionSetting0Pages.Provider416