membership

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package membership serves the grants of the tenants a caller administers, so RBAC can be managed without entering the workspace the grants live in.

Memberships live inside their tenant's workspace, which is closed to the tenant's own members — including its admins — precisely because it holds the records that decide their access. That makes it the one part of the model a tenant admin cannot administer directly, which is not a gap to leave open: someone has to be able to add a colleague.

So this is mediated the same way project creation is. The caller's own admin Membership, as the directory already reports it, is the authorization; the server's credential performs the write; and what is offered through it is only ever a Membership in a tenant the caller already administers. A caller cannot name a workspace or a cluster, and cannot reach a tenant they do not administer — not even to discover that it exists.

Listing here is deliberately wider than a self-review: it reports what OTHER people hold, which is the point of administering access, and is why every path checks for admin rather than for mere membership.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateFunc

type CreateFunc func(ctx context.Context, cluster string, m *tenancyv1alpha1.Membership) (created bool, err error)

CreateFunc upserts a Membership in one tenant's workspace. The server supplies it, because how the virtual workspace reaches that workspace is a detail of the deployment rather than of the API.

type DeleteFunc

type DeleteFunc func(ctx context.Context, cluster, name string) error

DeleteFunc removes a Membership from one tenant's workspace.

type Options

type Options struct {
	Create CreateFunc
	Delete DeleteFunc
}

Options carries the write side. Both funcs may be nil, in which case the resource stays readable and says plainly that changing grants is not configured rather than appearing to work.

type REST

type REST struct {
	// contains filtered or unexported fields
}

REST serves memberships for the tenants the caller administers.

func NewREST

func NewREST(d *directory.Directory, opts Options) *REST

NewREST returns the storage.

func (*REST) ConvertToTable

func (r *REST) ConvertToTable(ctx context.Context, object runtime.Object, tableOptions runtime.Object) (*metav1.Table, error)

func (*REST) Create

Create grants access in a tenant the caller administers.

The object's name is derived from what is being granted to whom, not taken from the request: two requests saying the same thing are the same grant, so re-granting changes the role in place instead of leaving two objects disagreeing about it.

func (*REST) Delete

Delete revokes a grant in a tenant the caller administers.

func (*REST) Destroy

func (r *REST) Destroy()

func (*REST) Get

func (r *REST) Get(ctx context.Context, name string, _ *metav1.GetOptions) (runtime.Object, error)

Get returns one grant, if it is in a tenant the caller administers.

func (*REST) GetSingularName

func (r *REST) GetSingularName() string

func (*REST) List

List returns every grant in every tenant the caller administers.

There is no scoping parameter: the answer is the caller's whole administrative surface, and a client that cares about one tenant filters on spec.tenant. That keeps the authorization rule here a single sentence, which is worth more than saving the client a loop.

func (*REST) NamespaceScoped

func (r *REST) NamespaceScoped() bool

func (*REST) New

func (r *REST) New() runtime.Object

func (*REST) NewList

func (r *REST) NewList() runtime.Object

Jump to

Keyboard shortcuts

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