Documentation
¶
Index ¶
- Variables
- func APIForRoles(roles []app.Role) (permissions.API, bool, error)
- func APIFromRole(role *app.Role) (permissions.API, bool, error)
- func CanCreate(ctx *gin.Context, objectID string) error
- func CanDelete(ctx *gin.Context, objectID string) error
- func CanRead(ctx *gin.Context, objectID string) error
- func CanUpdate(ctx *gin.Context, objectID string) error
- func DeleteManagedServiceAccountRoles(tx *gorm.DB, accountIDs []string) error
- func DeletePrivateRoles(tx *gorm.DB, accountIDs []string) error
- func PrivateRoleBlockedAccounts(tx *gorm.DB, accountIDs []string) (map[string]struct{}, error)
- func ReconcileOrgRoles(ctx context.Context, db *gorm.DB, org app.Org) error
- func RequireUserManaged(tx *gorm.DB, accountID string) error
- func ScopedRolePolicy(role *app.Role) (permissions.Policy, error)
- type Client
- func (h *Client) AddAccountOrgRole(ctx context.Context, roleType app.RoleType, orgID, accountID string) error
- func (h *Client) AddAccountRoleByID(ctx context.Context, roleID, accountID string) error
- func (c *Client) AssignableRoles(ctx context.Context, orgID, roleContext string) ([]app.Role, error)
- func (c *Client) CreateOrgRoles(ctx context.Context, orgID string) error
- func (h *Client) EnsureLogStreamRole(ctx context.Context, orgID, logStreamID, accountID string) error
- func (h *Client) EnsureManagedServiceAccountRole(ctx context.Context, accountID string, want *app.Role) error
- func (h *Client) EnsurePhoneHomeRole(ctx context.Context, orgID, versionID, accountID string) error
- func (h *Client) EnsureRunnerJobRole(ctx context.Context, orgID, jobID, installID, accountID string) error
- func (h *Client) EnsureRunnerRole(ctx context.Context, orgID, installID, accountID string) error
- func (h *Client) EnsureStackInstallRole(ctx context.Context, orgID, installID, accountID string) error
- func (c *Client) EnsureStandardRoles(ctx context.Context, orgID string) error
- func (h *Client) EnsureTelemetryCollectorRole(ctx context.Context, orgID, installID, accountID string) error
- func (c *Client) LoadAccountPermissions(ctx context.Context, account *app.Account) (*permissions.AccountPermissions, error)
- func (c *Client) LoadBindingGrants(ctx context.Context, orgID, accountID string) ([]*permissions.CompiledGrant, error)
- func (h *Client) RemoveAccountOrgRoleByType(ctx context.Context, roleType app.RoleType, orgID, accountID string) error
- func (h *Client) RemoveAccountOrgRoles(ctx context.Context, orgID, accountID string) error
- func (c *Client) ResolveAssignableRole(ctx context.Context, orgID string, roleType app.RoleType, roleContext string) (*app.Role, error)
- func (h *Client) SetAccountOrgRole(ctx context.Context, orgID, accountID string, roleType app.RoleType) error
- func (c *Client) StandardRole(ctx context.Context, orgID string, key roles.Key) (*app.RoleDefinition, error)
- func (c *Client) ValidateBindingScope(ctx context.Context, binding app.RoleBinding) error
- type OrgRoleClassification
- type OrgRoleSnapshot
- type Params
Constants ¶
This section is empty.
Variables ¶
var ErrStandardRoleDrift = errors.New("standard role requires an explicit data migration")
ErrStandardRoleDrift reports a stored standard definition that no longer matches its code template.
Functions ¶
func APIForRoles ¶ added in v0.19.1273
func APIFromRole ¶ added in v0.19.1273
func DeleteManagedServiceAccountRoles ¶ added in v0.19.1290
func DeletePrivateRoles ¶ added in v0.19.1289
func PrivateRoleBlockedAccounts ¶ added in v0.19.1290
func ReconcileOrgRoles ¶ added in v0.19.1115
ReconcileOrgRoles brings an org's managed roles in line with standardOrgRoles: missing roles are created (with their policies), and existing roles have their metadata (title, description, contexts, managed) updated to match the definition. Existing rows' policies are deliberately never modified.
func RequireUserManaged ¶ added in v0.19.1239
func ScopedRolePolicy ¶ added in v0.19.1293
func ScopedRolePolicy(role *app.Role) (permissions.Policy, error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddAccountOrgRole ¶
func (*Client) AddAccountRoleByID ¶
func (*Client) AssignableRoles ¶ added in v0.19.1115
func (c *Client) AssignableRoles(ctx context.Context, orgID, roleContext string) ([]app.Role, error)
AssignableRoles returns the org's roles offerable on the given assignment surface (see app.RoleContext*), ordered by role type.
func (*Client) CreateOrgRoles ¶
func (*Client) EnsureLogStreamRole ¶ added in v0.19.1289
func (*Client) EnsureManagedServiceAccountRole ¶ added in v0.19.1239
func (*Client) EnsurePhoneHomeRole ¶ added in v0.19.1299
func (*Client) EnsureRunnerJobRole ¶ added in v0.19.1299
func (h *Client) EnsureRunnerJobRole(ctx context.Context, orgID, jobID, installID, accountID string) error
EnsureRunnerJobRole grants one job, and the install its runner serves when installID is set, in a single private role.
func (*Client) EnsureRunnerRole ¶ added in v0.19.1299
func (*Client) EnsureStackInstallRole ¶ added in v0.19.1149
func (h *Client) EnsureStackInstallRole(ctx context.Context, orgID, installID, accountID string) error
EnsureStackInstallRole converges a stack account's install-scoped role: one role, one policy, on this install's stack object. Looked up through the account's own binding, since the account is already per-install.
func (*Client) EnsureStandardRoles ¶
EnsureStandardRoles seeds an org's standard role definitions from code templates. Drifted definitions are left untouched and reported after missing definitions are seeded. Changing or restoring them requires an explicit data migration.
func (*Client) EnsureTelemetryCollectorRole ¶ added in v0.19.1299
func (*Client) LoadAccountPermissions ¶ added in v0.19.1289
func (c *Client) LoadAccountPermissions(ctx context.Context, account *app.Account) (*permissions.AccountPermissions, error)
func (*Client) LoadBindingGrants ¶
func (c *Client) LoadBindingGrants(ctx context.Context, orgID, accountID string) ([]*permissions.CompiledGrant, error)
LoadBindingGrants compiles live assignments from a consistent database snapshot. Invalid or stale bindings contribute no authority but remain stored for inspection and restoration. Database errors fail the whole load instead of returning partial grants.
func (*Client) RemoveAccountOrgRoleByType ¶ added in v0.19.1149
func (h *Client) RemoveAccountOrgRoleByType(ctx context.Context, roleType app.RoleType, orgID, accountID string) error
RemoveAccountOrgRoleByType drops one role binding, unlike RemoveAccountOrgRoles, which clears every binding in an org.
func (*Client) RemoveAccountOrgRoles ¶
func (*Client) ResolveAssignableRole ¶ added in v0.19.1115
func (c *Client) ResolveAssignableRole(ctx context.Context, orgID string, roleType app.RoleType, roleContext string) (*app.Role, error)
ResolveAssignableRole validates that roleType is offerable on the given surface in the org and returns its role row. The error lists the roles that are assignable there.
func (*Client) SetAccountOrgRole ¶ added in v0.19.1075
func (h *Client) SetAccountOrgRole(ctx context.Context, orgID, accountID string, roleType app.RoleType) error
SetAccountOrgRole replaces an account's role(s) in an org with a single role of the given type. Unlike RemoveAccountOrgRoles it does not touch the account's OrgInvite records, so it is safe for in-place role changes.
func (*Client) StandardRole ¶
func (*Client) ValidateBindingScope ¶
type OrgRoleClassification ¶ added in v0.19.1295
type OrgRoleClassification struct {
Status string
Reason string
Permissions permissions.PermissionSet
LegacyAPI *permissions.API
Policy *permissions.Policy
}
func ClassifyOrgRole ¶ added in v0.19.1295
func ClassifyOrgRole(source OrgRoleSnapshot) (OrgRoleClassification, error)
type OrgRoleSnapshot ¶ added in v0.19.1295
type OrgRoleSnapshot struct {
Role app.Role
Bindings []app.AccountRole
}
Source Files
¶
- account_permissions.go
- add_account_role.go
- assignable_roles.go
- bindings.go
- client.go
- context.go
- create_org_roles.go
- ensure_runner_role.go
- ensure_stack_install_role.go
- managed_account.go
- managed_service_account_role.go
- org_role_classification.go
- reconcile_org_roles.go
- remove_account_role_by_type.go
- remove_account_roles.go
- role_api.go
- role_definitions.go
- scoped_role_policy.go
- set_account_role.go
- workload_roles.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package require applies existing RBAC permissions to HTTP routes and non-HTTP callers.
|
Package require applies existing RBAC permissions to HTTP routes and non-HTTP callers. |