configmapadapter

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

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 *kubernetes.Kubernetes,
	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