Skip to main content
Version: v4.6

Look up permissions by IRN pattern

By IRN and by IRN pattern comparison#

When you look up Permissions for a resource or resources, you can do so in the two following ways:

  1. By IRN: Gets the permissions with IRN patterns that cover the IRN you pass.
  2. By IRN pattern: Get permissions that have IRNs that match a pattern you pass.

For example, the following IRNs exist in a database:

Database recordIRNActions
irn1itemsvc:nameduseritem:*READ, EDIT
irn2itemsvc:nameduseritem:<id>*
irn3*:*:*READ, SHARE

Based on which lookup option you use, the queries return the different results depending on the lookup option:

IRN queryBy IRN resultsBy pattern results
itemsvc:nameduseritem:*irn1,irn3irn1,irn2
itemsvc:nameduseritem:<id>irn1,irn2,irn3irn2
*:*:*irn3irn1,irn2,irn3

Looking up permissions by IRN pattern#

Add patternmatch=true to your query to get permissions with IRNs that match a pattern you pass.

This option looks up IRNs in the database that match the IRN pattern you pass. It treats the IRN you pass as a pattern and looks up database IRNs as text to match.

For more information, explore the following examples with reference these example database records:

Database recordIRNActions
irn1itemsvc:nameduseritem:*READ, EDIT
irn2itemsvc:nameduseritem:<id>*
irn3*:*:*READ, SHARE

Case 1#

If the pattern you pass is itemsvc:nameduseritem:<id>, IRNs that match your pattern return in the results, in this case itemsvc:nameduseritem:<id>.

Case 2#

If the pattern you pass is *:*:*, any IRNs that match your pattern return in the results, in this case *:*:* , itemsvc:nameduseritem:*, and itemsvc:nameduseritem:<id>.

Permission lookup example#

The following example fetches permissions that match the passed IRN pattern:

/passportsvc/api/v1/permissions?_namespace=NS1&_resourceDesc._irn=itemsvc:nameduseritems:*&patternmatch=true

Pattern match and union return#

When you add patternmatch=true to your query string, it returns the queried permissions as well as the IRNs that match the IRN pattern you pass.

The following example returns a union of the permissions for the current user for the stated namespaces as well as the IRNs that match the IRN pattern:

_namespace=NS1&_namespace=NS2&_resourceDesc._irn=passportsvc:workspace:<workspace_id>&patternmatch=true

Similarly, the following example returns a union of the permissions for a specific user for the stated namespaces as well as the IRNs that match the IRN pattern:

_namespace=NS1&_namespace=NS2&_resourceDesc._irn=passportsvc:workspace:<workspace_id>&_user._id=<user_id>&_user._type=user&patternmatch=true