Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add authoritative resource to manage grants for an object #173

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,20 @@ func (c *Client) DeleteRbacStatement(ctx context.Context, id string) error {
return c.Meta.DeleteRbacStatement(ctx, id)
}

// MutateRbacStatements
func (c *Client) MutateRbacStatements(ctx context.Context, toCreate []meta.RbacStatementInput, toUpdate []meta.UpdateRbacStatementInput, toDelete []string) (*meta.MutateRbacStatementsResponse, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.MutateRbacStatements(ctx, toCreate, toUpdate, toDelete)
}

// GetRbacResourceStatements gets all statements for the given objects
func (c *Client) GetRbacResourceStatements(ctx context.Context, ids []string) ([]meta.RbacStatement, error) {
return c.Meta.GetRbacResourceStatements(ctx, ids)
}

// GetRbacStatement by ID
func (c *Client) GetRbacStatement(ctx context.Context, id string) (*meta.RbacStatement, error) {
return c.Meta.GetRbacStatement(ctx, id)
Expand Down
24 changes: 24 additions & 0 deletions client/internal/meta/operation/rbac_statement.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ fragment RbacStatement on RbacStatement {
version
}

fragment MutateRbacStatementsResponse on MutateRbacStatementsResponse {
createdStatements {
...RbacStatement
}
updatedStatements {
...RbacStatement
}
deletedStatements
}

mutation createRbacStatement($config: RbacStatementInput!) {
# @genqlient(flatten: true)
rbacStatement: createRbacStatement(input: $config) {
Expand Down Expand Up @@ -46,3 +56,17 @@ mutation deleteRbacStatement($id: ORN!) {
...ResultStatus
}
}

mutation mutateRbacStatements($toCreate: [RbacStatementInput!], $toUpdate:[UpdateRbacStatementInput!], $toDelete: [ORN!]) {
# @genqlient(flatten: true)
mutateRbacStatements: mutateRbacStatements(toCreate: $toCreate, toUpdate: $toUpdate, toDelete: $toDelete) {
...MutateRbacStatementsResponse
}
}

query getRbacResourceStatements($ids: [ObjectId!]!) {
# @genqlient(flatten: true)
rbacResourceStatements: rbacResourceStatements(ids: $ids) {
...RbacStatement
}
}
Loading
Loading