List user role assignments
List user role assignments
client.Zones.Users.Roles.List(ctx, userID, params) (*ZoneUserRoleListResponse, error)
GET/zones/{zoneId}/users/{userId}/roles
Returns the roles assigned to the specified user within the zone. The full result set is currently returned in a single page; the after/before/limit cursor parameters are reserved and not yet enforced, and pagination cursors are always null.
Parameters
userID string
Returns
List user role assignments
package main
import (
"context"
"fmt"
"github.com/keycardai/keycard-go"
"github.com/keycardai/keycard-go/option"
)
func main() {
client := keycard.NewClient(
option.WithAPIKey("My API Key"),
)
roles, err := client.Zones.Users.Roles.List(
context.TODO(),
"userId",
keycard.ZoneUserRoleListParams{
ZoneID: "zoneId",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", roles.Items)
}
{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}Returns Examples
{
"items": [
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"principal_id": "principal_id",
"principal_type": "principal_type",
"role_id": "role_id",
"role_identifier": "role_identifier",
"role_owner_type": "platform",
"updated_at": "2019-12-27T18:11:19.117Z",
"zone_id": "zone_id",
"scope_id": "scope_id",
"scope_type": "scope_type"
}
],
"pagination": {
"after_cursor": "x",
"before_cursor": "x",
"total_count": 0
}
}