roles

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MemberRoleName   = "member"
	ViewerRoleName   = "viewer"
	EditorRoleName   = "editor"
	AdminRoleName    = "admin"
	SuperAdminStatus = "superadmin"

	// Indicatior that the server should retrieve the default role for the organization.
	WildcardRoleName = "*"
)

Chronograf User Roles

View Source
const ContextKey = contextKey("role")

ContextKey is the key used to specify the role via context

Variables

View Source
var (
	// MemberRole is the role for a user who can only perform No operations.
	MemberRole = chronograf.Role{
		Name: MemberRoleName,
	}

	// ViewerRole is the role for a user who can only perform READ operations on Dashboards, Rules, Sources, and Servers,
	ViewerRole = chronograf.Role{
		Name: ViewerRoleName,
	}

	// EditorRole is the role for a user who can perform READ and WRITE operations on Dashboards, Rules, Sources, and Servers.
	EditorRole = chronograf.Role{
		Name: EditorRoleName,
	}

	// AdminRole is the role for a user who can perform READ and WRITE operations on Dashboards, Rules, Sources, Servers, and Users
	AdminRole = chronograf.Role{
		Name: AdminRoleName,
	}
)

Functions

This section is empty.

Types

type SourcesStore

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

SourcesStore facade on a SourceStore that filters sources by minimum role required to access the source.

The role is passed around on the context and set when the SourcesStore is instantiated.

func NewSourcesStore

func NewSourcesStore(s chronograf.SourcesStore, role string) *SourcesStore

NewSourcesStore creates a new SourcesStore from an existing chronograf.SourceStore and an role string

func (*SourcesStore) Add

Add creates a new Source in the SourcesStore with source.Role set to be the role from the source store.

func (*SourcesStore) All

All retrieves all sources from the underlying SourceStore and filters them by role.

func (*SourcesStore) Delete

func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error

Delete the source from SourcesStore

func (*SourcesStore) Get

func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error)

Get returns a Source if the id exists and belongs to the role that is set.

func (*SourcesStore) Update

func (s *SourcesStore) Update(ctx context.Context, d chronograf.Source) error

Update the source in SourcesStore.

Jump to

Keyboard shortcuts

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