authz

package
v0.19.1303 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIForRoles added in v0.19.1273

func APIForRoles(roles []app.Role) (permissions.API, bool, error)

func APIFromRole added in v0.19.1273

func APIFromRole(role *app.Role) (permissions.API, bool, error)

func CanCreate

func CanCreate(ctx *gin.Context, objectID string) error

func CanDelete

func CanDelete(ctx *gin.Context, objectID string) error

func CanRead

func CanRead(ctx *gin.Context, objectID string) error

func CanUpdate

func CanUpdate(ctx *gin.Context, objectID string) error

func DeleteManagedServiceAccountRoles added in v0.19.1290

func DeleteManagedServiceAccountRoles(tx *gorm.DB, accountIDs []string) error

func DeletePrivateRoles added in v0.19.1289

func DeletePrivateRoles(tx *gorm.DB, accountIDs []string) error

func PrivateRoleBlockedAccounts added in v0.19.1290

func PrivateRoleBlockedAccounts(tx *gorm.DB, accountIDs []string) (map[string]struct{}, error)

func ReconcileOrgRoles added in v0.19.1115

func ReconcileOrgRoles(ctx context.Context, db *gorm.DB, org app.Org) error

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 RequireUserManaged(tx *gorm.DB, accountID string) error

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 New

func New(params Params) *Client

func (*Client) AddAccountOrgRole

func (h *Client) AddAccountOrgRole(ctx context.Context, roleType app.RoleType, orgID, accountID string) error

func (*Client) AddAccountRoleByID

func (h *Client) AddAccountRoleByID(ctx context.Context, roleID, accountID string) error

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 (c *Client) CreateOrgRoles(ctx context.Context, orgID string) error

func (*Client) EnsureLogStreamRole added in v0.19.1289

func (h *Client) EnsureLogStreamRole(ctx context.Context, orgID, logStreamID, accountID string) error

func (*Client) EnsureManagedServiceAccountRole added in v0.19.1239

func (h *Client) EnsureManagedServiceAccountRole(ctx context.Context, accountID string, want *app.Role) error

func (*Client) EnsurePhoneHomeRole added in v0.19.1299

func (h *Client) EnsurePhoneHomeRole(ctx context.Context, orgID, versionID, accountID string) error

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 (h *Client) EnsureRunnerRole(ctx context.Context, orgID, installID, accountID string) error

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) EnsureTelemetryCollectorRole added in v0.19.1299

func (h *Client) EnsureTelemetryCollectorRole(ctx context.Context, orgID, installID, accountID string) error

func (*Client) LoadAccountPermissions added in v0.19.1289

func (c *Client) LoadAccountPermissions(ctx context.Context, account *app.Account) (*permissions.AccountPermissions, error)

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 (h *Client) RemoveAccountOrgRoles(ctx context.Context, orgID, accountID string) error

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.

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
}

type Params

type Params struct {
	fx.In

	Cfg             *internal.Config
	DB              *gorm.DB `name:"psql"`
	V               *validator.Validate
	AnalyticsClient analytics.Writer
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL