Versions in this module Expand all Collapse all v2 v2.2.0 Sep 17, 2026 Changes in this version + const QuickIDParam + var ErrAccessDenied = errors.New("access denied") + var ErrNotFound = errors.New("not found") + var ErrSystemFlagNotAllowed = errors.New("system flag is not allowed on custom policies") + var ErrSystemPolicyImmutable = errors.New("cannot modify system policy") + var ErrTokenExpired = errors.New("service account expired") + var ErrTokenNotFound = errors.New("service account not found") + var ErrUserDisabled = errors.New("user is disabled") + var ErrUserNotFound = errors.New("user not found") + func BuiltInPolicies() []policyTY.Policy + func BusinessName(kind string, item interface{}) string + func FormatResource(kind, name string) string + func IsBuiltInPolicyID(id string) bool + func ItemAllowedForList(kind string, patterns []string, item interface{}) bool + func MatchAction(pattern, action string) bool + func MatchResource(pattern, resource string) bool + func MatchResourceAllowCascade(pattern, resource string) bool + func MatchResourceDenyCascade(pattern, resource string) bool + func ResourceFromQuickID(quickID string) (string, error) + type API struct + func New(ctx context.Context, logger *zap.Logger, storage storageTY.Plugin) *API + func (a *API) Allowed(subject Subject, action, resource string) error + func (a *API) AllowedKindWide(subject Subject, action, kind string) error + func (a *API) AllowedMetricPath(subject Subject, fieldPath string) error + func (a *API) AssignAdminToUsersWithoutPolicies() error + func (a *API) AuthorizeActionRequest(subject Subject, r *http.Request) error + func (a *API) AuthorizeBodyTargets(subject Subject, r *http.Request, access *RequestAccess) error + func (a *API) AuthorizeMetricRequest(subject Subject, r *http.Request) error + func (a *API) AuthorizeQuickIDRequest(subject Subject, r *http.Request) error + func (a *API) AuthorizeSleepingQueueRequest(subject Subject, r *http.Request) error + func (a *API) Cache() *Cache + func (a *API) Delete(IDs []string) (int64, error) + func (a *API) EnsureBuiltInPolicies() error + func (a *API) EnsureServiceAccountActive(userID, tokenID string) error + func (a *API) EnsureUserActive(userID string) (*userTY.User, error) + func (a *API) GetByID(id string) (policyTY.Policy, error) + func (a *API) GetEntityInterface() interface{} + func (a *API) Import(data interface{}) error + func (a *API) List(filters []storageTY.Filter, pagination *storageTY.Pagination) (*storageTY.Result, error) + func (a *API) NotifyTokenDeleted(entityID, tokenID string) + func (a *API) NotifyTokenUpdated(token *svcAccountTY.ServiceAccount) + func (a *API) NotifyUserDeleted(id string) + func (a *API) NotifyUserUpdated(user *userTY.User) + func (a *API) ReportUsersWithoutPolicies() error + func (a *API) ResolveBusinessName(kind, storageID string) (string, error) + func (a *API) ResolveResource(access *RequestAccess) + func (a *API) ResourceNamesForList(subject Subject, kind string) (unrestricted bool, patterns []string, err error) + func (a *API) Save(policy *policyTY.Policy) error + func (a *API) StorageFiltersForList(subject Subject, kind string) (unrestricted bool, filters []storageTY.Filter, err error) + func (a *API) ValidatePoliciesExist(ids []string) error + type Cache struct + func (c *Cache) GetPolicy(id string) (*policyTY.Policy, error) + func (c *Cache) GetToken(tokenID string) (*svcAccountTY.ServiceAccount, error) + func (c *Cache) GetUser(id string) (*userTY.User, error) + func (c *Cache) InvalidatePolicy(id string) + func (c *Cache) InvalidateToken(tokenID string) + func (c *Cache) InvalidateTokenByEntityID(entityID string) + func (c *Cache) InvalidateUser(id string) + func (c *Cache) PutPolicy(p *policyTY.Policy) + func (c *Cache) PutToken(t *svcAccountTY.ServiceAccount) + func (c *Cache) PutUser(u *userTY.User) + func (c *Cache) WarmPolicies() error + type RequestAccess struct + Action string + Kind string + Name string + Resource string + Skip bool + func MapRequest(r *http.Request) RequestAccess + type Subject struct + ServiceAccountID string + UserID string