permissions

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Namespace permissionScope = "namespace" // == role
	Cluster   permissionScope = "cluster"   // == clusterRole
)

Variables

View Source
var (
	PermissionAdvisorNilError = errorAdvisorNil()
	SearchAccess              = duplicateHandler.New()
)

Functions

This section is empty.

Types

type PermissionAdvisor

type PermissionAdvisor interface {
	GetPermissionsForAdvisor(context.Context) error
}

type PermissionAdvisorStruct

type PermissionAdvisorStruct struct {

	// The catalog image reference pull location
	IndexReference string
	// The Operator package to inspect
	OperatorPackage string
	// The channel in the Operator package to inspect
	Channel string

	// Aggreagate is a flag to deteremine if we should get the permissions of
	// all bundles in a channel of just the head
	// When false, this means to just get the heads of channels permission info
	// when true, this means to aggregate permmissions across all bundles in the channel
	Aggregate bool
}

func (*PermissionAdvisorStruct) GetBundlesFromChannel added in v0.0.3

func (p *PermissionAdvisorStruct) GetBundlesFromChannel(channel *model.Channel) []model.Bundle

GetBundlesFromChannel will return an array of all bundles in the channel channel (*model.Channel): is the channel object request to get the bundles from returns ([]model.Bundle): an array of all bundles in the channel unless p.Aggregate is false,

then will only return the bundle at the head of the channel

func (*PermissionAdvisorStruct) GetChannelsForPackage added in v0.0.3

func (p *PermissionAdvisorStruct) GetChannelsForPackage(packages []model.Package) map[string]*model.Channel

GetChannelsForPackage will get all channels for a given pacakge in the listed package output packages ([]model.Package): is the list of all packages in the catalog index ref

this is filtered based on the p.OperatorPackage field

returns (map[string]*model.Channel): A map consisting of all channels by name for the filtered package

func (*PermissionAdvisorStruct) GetPermissionsForAdvisor

func (p *PermissionAdvisorStruct) GetPermissionsForAdvisor(ctx context.Context) ([]PermissionWrapper, error)

GetPermissionsForAdvisor will return a list of permissions and their scopes found for the inputs

func (*PermissionAdvisorStruct) HeadOfChannelOrAggregateFromPackage added in v0.0.3

func (p *PermissionAdvisorStruct) HeadOfChannelOrAggregateFromPackage(ctx context.Context) ([]model.Bundle, error)

HeadOfChannelOrAggregateFromPackage is used to interface with the catalog image and opm APIs to return the bundle information containing the permissions ctx (context.Context): is the context to pass into the list command, usually inherited from the calling command returns ([]model.Bundle): an array of all bundles matching the given query parameters we want to aggregate permissions over returns (error): can come from a call to opm APIs, or if the permission advisor is nil

type PermissionWrapper

type PermissionWrapper struct {

	// The scope of the permission rule [cluster, namespace]
	Scope permissionScope
	// The rule definition for the permission policy
	Rule rbacv1.PolicyRule
}

func (*PermissionWrapper) Hash

func (p *PermissionWrapper) Hash() string

Hash returns a sha256 representation of the wrapper for map access

Jump to

Keyboard shortcuts

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