Documentation
¶
Index ¶
- Variables
- func AddOrganizationAndProjectIDQuery(ctx context.Context, selector labels.Selector, organizationQuery []string, ...) (labels.Selector, error)
- func AddOrganizationIDQuery(ctx context.Context, selector labels.Selector, query []string) (labels.Selector, error)
- func AddQuery(selector labels.Selector, label string, vals []string) (labels.Selector, error)
- func AllowGlobalScope(ctx context.Context, endpoint string, operation openapi.AclOperation) error
- func AllowOrganizationScope(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowProjectScope(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowProjectScopeCreate(ctx context.Context, client openapi.ClientWithResponsesInterface, ...) error
- func AllowRole(ctx context.Context, role *unikornv1.Role, organizationID string) error
- func FromContext(ctx context.Context) *openapi.Acl
- func HasNoMatches(err error) bool
- func NewContext(ctx context.Context, acl *openapi.Acl) context.Context
- func OrganizationIDs(ctx context.Context) []string
- type Options
- type RBAC
Constants ¶
This section is empty.
Variables ¶
var ( ErrResourceReference = goerrors.New("resource reference error") ErrNoAuthz = goerrors.New("no authorization data in userinfo") ErrWrongOrganizationCount = goerrors.New("expected exactly one organization ID") ErrNotInOrganization = goerrors.New("subject not a member of organization") ErrInvalidPrincipalType = goerrors.New("invalid impersonated principal type") )
var (
ErrNoMatches = goerrors.New("selector would select nothing")
)
Functions ¶
func AddOrganizationAndProjectIDQuery ¶ added in v1.11.0
func AddOrganizationAndProjectIDQuery(ctx context.Context, selector labels.Selector, organizationQuery []string, projectQuery []string) (labels.Selector, error)
AddOrganizationAndProjectIDQuery gets all organizationIDs the user can access (or has requested explicit and has access to).
func AddOrganizationIDQuery ¶ added in v1.11.0
func AddOrganizationIDQuery(ctx context.Context, selector labels.Selector, query []string) (labels.Selector, error)
AddOrganizationIDQuery adds an organizational query selector that limits resources to be listed to those available in the ACL and optionally constrained to those in the request query using a boolean intersection.
func AllowGlobalScope ¶ added in v0.2.20
AllowGlobalScope tries to allow the requested operation at the global scope.
func AllowOrganizationScope ¶ added in v0.2.20
func AllowOrganizationScope(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID string) error
AllowOrganizationScope tries to allow the requested operation at the global scope, then the organization scope.
func AllowProjectScope ¶ added in v0.2.20
func AllowProjectScope(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID, projectID string) error
AllowProjectScope tries to allow the requested operation at the global scope, then the organization scope, and finally at the project scope.
func AllowProjectScopeCreate ¶ added in v1.16.0
func AllowProjectScopeCreate(ctx context.Context, client openapi.ClientWithResponsesInterface, endpoint string, operation openapi.AclOperation, organizationID, projectID string) error
AllowProjectScopeCreate is like AllowProjectScope but intended for v2 create operations where the project ID is supplied in the request body rather than the URL path. When access is granted via an organization-scoped ACL the project ID is untrusted user input, so this function additionally verifies the project exists via the identity API before returning nil. Global-scope callers (platform administrators) are exempt from this check and their supplied project ID is trusted directly.
func AllowRole ¶ added in v0.2.21
AllowRole determines whether your ACL contains the same or higher privileges than the role, which is then used to determine role visibility and limit privilege escalation.
func HasNoMatches ¶ added in v1.12.0
HasNoMatches is a short cut when nothing would be matched e.g. the user has no matching organization ID for the provided selector, and a list handler can just return an empty array directly.
func NewContext ¶ added in v0.2.20
func OrganizationIDs ¶ added in v1.11.0
OrganizationIDs returns a list of all organization IDs from the ACL for the purposes of limiting list type API operations.
Types ¶
type Options ¶ added in v0.2.54
type RBAC ¶
type RBAC struct {
// contains filtered or unexported fields
}
RBAC contains all the scoping rules for services across the platform.