rbac

package
v0.0.0-...-8ebdd08 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientWrapper

type ClientWrapper interface {
	Allowed(ctx context.Context, resource Resource, verb Verb) (bool, error)
}

func NewClientWrapperImpl

func NewClientWrapperImpl(baseUrl string, timeout time.Duration) ClientWrapper

type ClientWrapperImpl

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

func (*ClientWrapperImpl) Allowed

func (r *ClientWrapperImpl) Allowed(ctx context.Context, resource Resource, verb Verb) (bool, error)

Allowed fetches an access list from RBAC based on RBAC_URL and returns if the xrhid has the `content-sources:*:*` permission xrhid is the identity json structure coded in base64. resource is the content-sources resource which is being requested. verb is the action we are quering, in our case, read or write

type MockClientWrapper

type MockClientWrapper struct {
	mock.Mock
}

MockClientWrapper is an autogenerated mock type for the ClientWrapper type

func NewMockClientWrapper

func NewMockClientWrapper(t mockConstructorTestingTNewMockClientWrapper) *MockClientWrapper

NewMockClientWrapper creates a new instance of MockClientWrapper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockClientWrapper) Allowed

func (_m *MockClientWrapper) Allowed(ctx context.Context, resource Resource, verb Verb) (bool, error)

Allowed provides a mock function with given fields: ctx, resource, verb

type PermissionsMap

type PermissionsMap map[string]map[string]rbacEntry

PermissionsMap Map Method and Path to a RbacEntry

var ServicePermissions *PermissionsMap = NewPermissionsMap()

func NewPermissionsMap

func NewPermissionsMap() *PermissionsMap

func (*PermissionsMap) Add

func (pm *PermissionsMap) Add(method string, path string, res Resource, verb Verb) *PermissionsMap

func (*PermissionsMap) Permission

func (pm *PermissionsMap) Permission(method string, path string) (res Resource, verb Verb, err error)

type Resource

type Resource string
const (
	ResourceRepositories Resource = "repositories"
	ResourceAny          Resource = "*"
	ResourceUndefined    Resource = ""
)

type Verb

type Verb string

The following constants result from the schema below https://github.com/RedHatInsights/rbac-config/blob/master/schemas/permissions.schema

const (
	RbacVerbAny       Verb = "*"
	RbacVerbRead      Verb = "read"
	RbacVerbWrite     Verb = "write"
	RbacVerbUndefined Verb = ""
)

Jump to

Keyboard shortcuts

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