Class Claim

Hierarchy

  • Claim

Constructors

Properties

_resourceParts: null | string[] = null
resource: null | string
verb: "admin" | "read" | "delete" | "create" | "update" | "manage"

Accessors

Methods

  • returns true if this claim includes the given query

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns boolean

  • given a query, if this claim is a direct child of that query, it will return the immediate child part. Otherwise it returns null

    e.g.

    const claim = buildClaim("read:what.some.stuff");
    claim.directChild("admin:*") // => null
    claim.directChild("read:*") // => null
    claim.directChild("read:what") // => null
    claim.directChild("read:what.some") // => "stuff"
    claim.directChild("read:what.some.stuff") // => null
    claim.directChild("read:what.some.stuff.blah") // => null

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns null | string

  • given a query, if this claim is a direct descendant of that query, it will return the immediate child part. Otherwise it returns null

    e.g.

    claim.directDescendant("admin:*") // => null
    claim.directDescendant("read:*") // => "what"
    claim.directDescendant("read:what") // => "some"
    claim.directDescendant("read:what.some") // => "stuff"
    claim.directDescendant("read:what.some.stuff") // => null
    claim.directDescendant("read:what.some.stuff.blah") // => null

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns null | string

  • true if the given verb is the same as the claim's

    Parameters

    • verb: string

    Returns boolean

  • return true if directChild() does not return null

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns boolean

    See

    directChild

  • return true if isDirectDescendant() does not return null

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns boolean

    See

    isDirectDescendant

  • returns true if this claim represents exactly the same as the given query

    Parameters

    • query: string | IClaimData

      can be a string ("verb:resource" or "verb:*") or an object with verb and resource

    Returns boolean

  • true if the claim has no resource (global verb). This means that it represents all resources for this verb

    Returns boolean

  • Parameters

    • verb: string
    • resource: null | string

    Returns null | string

  • Parameters

    • verb: string
    • resource: null | string

    Returns null | string

  • returns verb:resource (if global, it will return verb:*)

    Returns string

Generated using TypeDoc