configmapadapter

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 11 Imported by: ? 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

Overview

Package configmapadapter provides a Casbin adapter that uses a Kubernetes ConfigMap as the storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

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

Adapter is the ConfigMap adapter for Casbin. It can load policy from ConfigMap and save policy to ConfigMap.

func New

func New(
	l *zap.SugaredLogger,
	kubeClient k8s,
	namespacedName types.NamespacedName,
) *Adapter

New constructs a new adapter that manages a policy inside a ConfigMap.

func (*Adapter) AddPolicy

func (a *Adapter) AddPolicy(_ string, _ string, _ []string) error

AddPolicy adds a policy rule to the storage.

func (*Adapter) ConfigMap added in v1.2.0

func (a *Adapter) ConfigMap(ctx context.Context) (*corev1.ConfigMap, error)

ConfigMap returns the configmap used for RBAC.

func (*Adapter) LoadPolicy

func (a *Adapter) LoadPolicy(model model.Model) error

LoadPolicy loads all policy rules from the storage.

func (*Adapter) RemoveFilteredPolicy

func (a *Adapter) RemoveFilteredPolicy(_ string, _ string, _ int, _ ...string) error

RemoveFilteredPolicy removes policy rules that match the filter from the storage.

func (*Adapter) RemovePolicy

func (a *Adapter) RemovePolicy(_ string, _ string, _ []string) error

RemovePolicy removes a policy rule from the storage.

func (*Adapter) SavePolicy

func (a *Adapter) SavePolicy(_ model.Model) error

SavePolicy saves all policy rules to the storage.

Jump to

Keyboard shortcuts

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