import { Injectable , Inject } from '@nestjs/common' ; import { AUTHZ_ENFORCER } from '../authz.constants' ; import * as casbin from 'casbin' ; /**
 * A wrapper of casbin management API
 */ @ Injectable ( ) export class AuthZManagementService { constructor ( @ Inject ( AUTHZ_ENFORCER ) private readonly enforcer ) { } return getAllSubjects ( ) { return this . enforcer . getAllSubjects ( ) ; } param ptype return getAllNamedSubjects ( ptype ) { return this . enforcer . getAllNamedSubjects ( ptype ) ; } return getAllObjects ( ) { return this . enforcer . getAllObjects ( ) ; } param ptype return getAllNamedObjects ( ptype ) { return this . enforcer . getAllNamedObjects ( ptype ) ; } return getAllActions ( ) { return this . enforcer . getAllActions ( ) ; } param ptype return getAllNamedActions ( ptype ) { return this . enforcer . getAllNamedActions ( ptype ) ; } return getAllRoles ( ) { return this . enforcer . getAllRoles ( ) ; } param ptype return getAllNamedRoles ( ptype ) { return this . enforcer . getAllNamedRoles ( ptype ) ; } return getPolicy ( ) { return this . enforcer . getPolicy ( ) ; } param fieldIndex param fieldValues return getFilteredPolicy ( fieldIndex , ... fieldValues ) { return this . enforcer . getFilteredPolicy ( fieldIndex , ... fieldValues ) ; } param ptype return getNamedPolicy ( ptype ) { return this . enforcer . getNamedPolicy ( ptype ) ; } param ptype param fieldIndex param fieldValues return getFilteredNamedPolicy ( ptype , fieldIndex , ... fieldValues ) { return this . enforcer . getFilteredNamedPolicy ( ptype , fieldIndex , ... fieldValues ) ; } return getGroupingPolicy ( ) { return this . enforcer . getGroupingPolicy ( ) ; } param fieldIndex param fieldValues return getFilteredGroupingPolicy ( fieldIndex , ... fieldValues ) { return this . enforcer . getFilteredGroupingPolicy ( fieldIndex , ... fieldValues ) ; } param ptype return getNamedGroupingPolicy ( ptype ) { return this . enforcer . getNamedGroupingPolicy ( ptype ) ; } param ptype param fieldIndex param fieldValues return getFilteredNamedGroupingPolicy ( ptype , fieldIndex , ... fieldValues ) { return this . enforcer . getFilteredNamedGroupingPolicy ( ptype , fieldIndex , ... fieldValues ) ; } param params return hasPolicy ( ... params ) { return this . enforcer . hasPolicy ( ... params ) ; } param ptype param params return hasNamedPolicy ( ptype , ... params ) { return this . enforcer . hasNamedPolicy ( ptype , ... params ) ; } param params return addPolicy ( ... params ) { return this . enforcer . addPolicy ( ... params ) ; } param rules return addPolicies ( rules ) { return this . enforcer . addPolicies ( rules ) ; } param ptype param params return addNamedPolicy ( ptype , ... params ) { return this . enforcer . addNamedPolicy ( ptype , ... params ) ; } param ptype param rules return addNamedPolicies ( ptype , rules ) { return this . enforcer . addNamedPolicies ( ptype , rules ) ; } return param oldRule param newRule updatePolicy ( oldRule , newRule ) { return this . enforcer . updatePolicy ( oldRule , newRule ) ; } param ptype param oldRule param newRule return updateNamedPolicy ( ptype , oldRule , newRule ) { return this . enforcer . updateNamedPolicy ( ptype , oldRule , newRule ) ; } param params return removePolicy ( ... params ) { return this . enforcer . removePolicy ( ... params ) ; } param rules return removePolicies ( rules ) { return this . enforcer . removePolicies ( rules ) ; } param fieldIndex param fieldValues return removeFilteredPolicy ( fieldIndex , ... fieldValues ) { return this . enforcer . removeFilteredPolicy ( fieldIndex , ... fieldValues ) ; } param ptype param params return removeNamedPolicy ( ptype , ... params ) { return this . enforcer . removeNamedPolicy ( ptype , ... params ) ; } param ptype param rules return removeNamedPolicies ( ptype , rules ) { return this . enforcer . removeNamedPolicies ( ptype , rules ) ; } param ptype param fieldIndex param fieldValues return removeFilteredNamedPolicy ( ptype , fieldIndex , ... fieldValues ) { return this . enforcer . removeFilteredNamedPolicy ( ptype , fieldIndex , ... fieldValues ) ; } param params return hasGroupingPolicy ( ... params ) { return this . enforcer . hasGroupingPolicy ( ... params ) ; } param ptype param params return hasNamedGroupingPolicy ( ptype , ... params ) { return this . enforcer . hasNamedGroupingPolicy ( ptype , ... params ) ; } param params return addGroupingPolicy ( ... params ) { return this . enforcer . addGroupingPolicy ( ... params ) ; } param rules return addGroupingPolicies ( rules ) { return this . enforcer . addGroupingPolicies ( rules ) ; } param ptype param params return addNamedGroupingPolicy ( ptype , ... params ) { return this . enforcer . addNamedGroupingPolicy ( ptype , ... params ) ; } param ptype param rules return addNamedGroupingPolicies ( ptype , rules ) { return this . enforcer . addNamedGroupingPolicies ( ptype , rules ) ; } param params return removeGroupingPolicy ( ... params ) { return this . enforcer . removeGroupingPolicy ( ... params ) ; } param rules return removeGroupingPolicies ( rules ) { return this . enforcer . removeGroupingPolicies ( rules ) ; } param fieldIndex param fieldValues return removeFilteredGroupingPolicy ( fieldIndex , ... fieldValues ) { return this . enforcer . removeFilteredGroupingPolicy ( fieldIndex , ... fieldValues ) ; } param ptype param params return removeNamedGroupingPolicy ( ptype , ... params ) { return this . enforcer . removeNamedGroupingPolicy ( ptype , ... params ) ; } param ptype param rules return removeNamedGroupingPolicies ( ptype , rules ) { return this . enforcer . removeNamedGroupingPolicies ( ptype , rules ) ; } param ptype param fieldIndex param fieldValues return removeFilteredNamedGroupingPolicy ( ptype , fieldIndex , ... fieldValues ) { return this . enforcer . removeFilteredNamedGroupingPolicy ( ptype , fieldIndex , ... fieldValues ) ; } param name param func addFunction ( name , func ) { return this . enforcer . addFunction ( name , func ) ; } /**
     * loadPolicy reloads the policy from file/database.
     */ loadPolicy ( ) { return this . enforcer . loadPolicy ( ) ; } }