rbac

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadOptions = struct {
	Default         LoadOptionFunc
	LoadRBACGlobal  LoadOptionFunc
	LoadRBACProject LoadOptionFunc
}{
	Default:         loadDefault,
	LoadRBACGlobal:  loadRBACGlobal,
	LoadRBACProject: loadRBACProject,
}

LoadOptions provides all options on rbac loads functions

View Source
var (
	LogFieldRole = log.Field("action_metadata_role")
)

Functions

func FillWithIDs

func FillWithIDs(ctx context.Context, db gorp.SqlExecutor, r *sdk.RBAC) error

func HasGlobalRole

func HasGlobalRole(ctx context.Context, db gorp.SqlExecutor, role string, userID string) (bool, error)

func HasRoleOnProjectAndUserID

func HasRoleOnProjectAndUserID(ctx context.Context, db gorp.SqlExecutor, role string, userID string, projectKey string) (bool, error)

func Insert

Insert a RBAC permission in database

func IsCurrentUser

func IsCurrentUser(_ context.Context, auth *sdk.AuthConsumer, _ cache.Store, _ gorp.SqlExecutor, vars map[string]string) error

func IsHookService

func IsHookService(_ context.Context, auth *sdk.AuthConsumer, _ cache.Store, _ gorp.SqlExecutor, _ map[string]string) error

func LoadProjectKeysByRoleAndUserID

func LoadProjectKeysByRoleAndUserID(ctx context.Context, db gorp.SqlExecutor, role string, userID string) ([]string, error)

func LoadRBACByName

func LoadRBACByName(ctx context.Context, db gorp.SqlExecutor, name string, opts ...LoadOptionFunc) (*sdk.RBAC, error)

func OrganizationManage

func OrganizationManage(ctx context.Context, auth *sdk.AuthConsumer, store cache.Store, db gorp.SqlExecutor, _ map[string]string) error

func PermissionManage

func PermissionManage(ctx context.Context, auth *sdk.AuthConsumer, store cache.Store, db gorp.SqlExecutor, _ map[string]string) error

PermissionManage return nil if the current AuthConsumer have the ProjectRoleManage on current project KEY

func ProjectManage

func ProjectManage(ctx context.Context, auth *sdk.AuthConsumer, store cache.Store, db gorp.SqlExecutor, vars map[string]string) error

ProjectManage return nil if the current AuthConsumer have the ProjectRoleManage on current project KEY

func ProjectRead

func ProjectRead(ctx context.Context, auth *sdk.AuthConsumer, store cache.Store, db gorp.SqlExecutor, vars map[string]string) error

ProjectRead return nil if the current AuthConsumer have the ProjectRoleRead on current project KEY

func RegionManage

func RegionManage(ctx context.Context, auth *sdk.AuthConsumer, store cache.Store, db gorp.SqlExecutor, _ map[string]string) error

func Update

Types

type LoadOptionFunc

type LoadOptionFunc func(context.Context, gorp.SqlExecutor, *rbac) error

LoadOptionFunc is used as options to loadProject functions

Jump to

Keyboard shortcuts

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