GetResourcePermissions

Retrieves the list of permissions for a specified resource, permission, and subject.

Parameters

  • resourceType - The type of the resource.
  • permission - The name of the permission.
  • subject - The subject for which permissions are being checked.
  • zedToken (optional) - An optional ZedToken for specifying a version of the data to consider.
  • cacheFreshness (optional) - Specifies the acceptable freshness of the data to be considered from the cache.

Returns

  • A task representing the asynchronous operation, with a list of string indicating the permissions for the specified resource.

Example Code

var client = new SpiceDbClient("your_token", "your_schema_prefix");
var subject = new ResourceReference("user", "bob");

// Retrieves the permissions associated with a specific resource and subject.
var permissions = await client.GetResourcePermissionsAsync("document", "reader", subject);
foreach (var perm in permissions)
{
    Console.WriteLine($"Permission: {perm}");
}