modelaccesspolicy

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

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

func NewHelper

func NewHelper(ctx context.Context, backend backend.Backend) (*Helper, error)

func (*Helper) GetUserAllowedModels

func (h *Helper) GetUserAllowedModels(user kuser.Info) (map[string]bool, bool, error)

getUserAllowedModels returns a set of model IDs that a user can access. If a user is an owner/admin or has been granted access to all models via a wildcard model selector, this method returns nil and true.

func (*Helper) UserHasAccessToModel

func (h *Helper) UserHasAccessToModel(user kuser.Info, modelID string) (bool, error)

UserHasAccessToModel returns true if the user has access to the model. Access is granted when: - The user is an admin or owner - A ModelAccessPolicy with wildcard subject selector (*) includes the model (or uses wildcard model selector) - A ModelAccessPolicy directly references the user and includes the model (or uses wildcard model selector) - A ModelAccessPolicy references a group the user belongs to and includes the model (or uses wildcard model selector)

Jump to

Keyboard shortcuts

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