rbac

package
v1.0.855 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 23 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultModel string

Functions

func AddCustomFunctions added in v1.0.840

func AddCustomFunctions(enforcer addableEnforcer)

func AddRoleForUser

func AddRoleForUser(user string, role ...string) error

func Check

func Check(ctx context.Context, subject, object, action string) bool

func CheckContext added in v1.0.841

func CheckContext(ctx context.Context, object, action string) bool

func DeleteAllRolesForUser

func DeleteAllRolesForUser(user string) error

func DeleteRole

func DeleteRole(role string) (bool, error)

func DeleteRoleForUser

func DeleteRoleForUser(user string, role string) error

func Enforcer

func Enforcer() *casbin.SyncedCachedEnforcer

func GetActionFromHttpMethod

func GetActionFromHttpMethod(method string) string

func GetObjectByTable

func GetObjectByTable(resource string) string

func HasPermission added in v1.0.841

func HasPermission(ctx context.Context, subject string, attr *models.ABACAttribute, action string) bool

func Init

func Init(ctx context.Context, adminUserID string, adapters ...Adapter) error

func PermsForUser

func PermsForUser(user string) ([]policy.Permission, error)

func ReloadPolicy

func ReloadPolicy() error

func RolesForUser

func RolesForUser(user string) ([]string, error)

func Stop

func Stop()

Types

type Adapter added in v1.0.840

type Adapter func(db *gorm.DB, main *gormadapter.Adapter) persist.Adapter

type Selectors added in v1.0.840

type Selectors struct {
	Playbooks   []types.ResourceSelector `json:"playbooks,omitempty"`
	Connections []types.ResourceSelector `json:"connections,omitempty"`
	Configs     []types.ResourceSelector `json:"configs,omitempty"`
	Components  []types.ResourceSelector `json:"components,omitempty"`
}

func (Selectors) RequiredMatchCount added in v1.0.840

func (t Selectors) RequiredMatchCount() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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