Documentation ¶
Index ¶
- Constants
- Variables
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, d chronograf.Source) error
- func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, d chronograf.Source) error
Constants ¶
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
const ContextKey = contextKey("role")
ContextKey is the key used to specify the role via context
Variables ¶
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 ¶
func (s *SourcesStore) Add(ctx context.Context, d chronograf.Source) (chronograf.Source, error)
Add creates a new Source in the SourcesStore with source.Role set to be the role from the source store.
func (*SourcesStore) All ¶
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error)
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.