Skip to main content
POST
/
v1
/
tenants
/
{tenant_id}
/
permissions
/
subject-permission
go
cr, err := client.Permission.SubjectPermission(context.Background(), &v1.PermissionSubjectPermissionRequest{
    TenantId: "t1",
    Metadata: &v1.PermissionSubjectPermissionRequestMetadata{
        SnapToken: "",
        SchemaVersion: "",
        OnlyPermission: false,
        Depth: 20,
    },
    Entity: &v1.Entity{
        Type: "repository",
        Id: "1",
    },
    Subject: &v1.Subject{
        Type: "user",
        Id: "1",
    },
})
client.permission.subjectPermission({
tenantId: "t1",
metadata: {
snapToken: "",
schemaVersion: "",
onlyPermission: true,
depth: 20
},
entity: {
type: "repository",
id: "1"
},
subject: {
type: "user",
id: "1"
}
}).then((response) => {
console.log(response);
})
curl --location --request POST 'localhost:3476/v1/tenants/{tenant_id}/permissions/subject-permission' \
--header 'Content-Type: application/json' \
--data-raw '{
"metadata":{
"snap_token": "",
"schema_version": "",
"only_permission": true,
"depth": 20
},
"entity": {
"type": "repository",
"id": "1"
},
"subject": {
"type": "user",
"id": "1",
"relation": ""
}
}'
{
  "results": {}
}
{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}
The Subject Permission List endpoint allows you to inquire in the form of “Which permissions user:x can perform on entity:y?”. In response, you’ll receive a list of permissions specific to the user for the given entity, returned in the format of a map. In this endpoint, you’ll receive a map of permissions and their statuses directly. The structure is map[string]CheckResult, such as “sample-permission” -> “ALLOWED”. This represents the permissions and their associated states in a key-value pair format.

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 t1 for this field. Required, and must match the pattern \“[a-zA-Z0-9-,]+\“, max 64 bytes.

Body

application/json

PermissionSubjectPermissionRequest is the request message for the SubjectPermission method in the Permission service.

metadata
object

PermissionSubjectPermissionRequestMetadata metadata for the PermissionSubjectPermissionRequest.

entity
object

Entity represents an entity with a type and an identifier.

subject
object

Subject represents an entity subject with a type, an identifier, and a relation.

context
object

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

Response

A successful response.

PermissionSubjectPermissionResponse is the response message for the SubjectPermission method in the Permission service.

results
object

Map of results for each permission check.