POST
/
v1
/
tenants
/
{tenant_id}
/
permissions
/
lookup-subject
cr, err: = client.Permission.LookupSubject(context.Background(), &v1.PermissionLookupSubjectRequest {
    TenantId: "t1",
    Metadata: &v1.PermissionLookupSubjectRequestMetadata{
        SnapToken: "",
        SchemaVersion: "",
        Depth: 20,
    },
    Entity: &v1.Entity{
        Type: "document",
        Id: "1",
    },
    Permission: "edit",
    SubjectReference: &v1.RelationReference{
        Type: "user",
        Relation: "",
    }
})
{
  "subject_ids": [
    "<string>"
  ]
}

Lookup Subject endpoint lets you ask questions in form of “Which subjects can do action Y on entity:X?”. As a response of this you’ll get a subject results in a format of string array.

In this endpoint you’ll get directly the IDs’ of the subjects that are authorized in an array.

Path Parameters

tenant_id
string
required

Identifier of the tenant, if you are not using multi-tenancy (have only one tenant) use pre-inserted tenant <code>t1</code> for this field. Required, and must match the pattern \“[a-zA-Z0-9-,]+\“, max 64 bytes.

Body

application/json
metadata
object

PermissionLookupSubjectRequestMetadata metadata for the PermissionLookupSubjectRequest.

entity
object

Entity represents an entity with a type and an identifier.

permission
string

Permission to be checked, can be a permission or relation. Required, and must match the pattern "^([a-zA-Z][a-zA-Z0-9_]{1,62}[a-zA-Z0-9])$", max 64 bytes.

subject_reference
object

The RelationReference message provides a reference to a specific relation.

context
object

Context encapsulates the information related to a single operation, including the tuples involved and the associated attributes.

Response

200 - application/json
subject_ids
string[]

List of identifiers for subjects that match the lookup.