organizations

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 ContextKey = contextKey("organization")

ContextKey is the key used to specify the organization via context

Variables

This section is empty.

Functions

This section is empty.

Types

type DashboardsStore

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

DashboardsStore facade on a DashboardStore that filters dashboards by organization.

func NewDashboardsStore

func NewDashboardsStore(s chronograf.DashboardsStore, org string) *DashboardsStore

NewDashboardsStore creates a new DashboardsStore from an existing chronograf.DashboardStore and an organization string

func (*DashboardsStore) Add

Add creates a new Dashboard in the DashboardsStore with dashboard.Organization set to be the organization from the dashboard store.

func (*DashboardsStore) All

All retrieves all dashboards from the underlying DashboardStore and filters them by organization.

func (*DashboardsStore) Delete

Delete the dashboard from DashboardsStore

func (*DashboardsStore) Get

Get returns a Dashboard if the id exists and belongs to the organization that is set.

func (*DashboardsStore) Update

Update the dashboard in DashboardsStore.

type OrganizationConfigStore

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

OrganizationConfigStore facade on a OrganizationConfig that filters OrganizationConfigs by organization.

func NewOrganizationConfigStore

func NewOrganizationConfigStore(s chronograf.OrganizationConfigStore, orgID string) *OrganizationConfigStore

NewOrganizationConfigStore creates a new OrganizationConfigStore from an existing chronograf.OrganizationConfigStore and an organization string

func (*OrganizationConfigStore) FindOrCreate

FindOrCreate gets an organization's config or creates one if none exists

func (*OrganizationConfigStore) Put

Put the OrganizationConfig in OrganizationConfigStore.

type OrganizationsStore

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

OrganizationsStore facade on a OrganizationStore that filters organizations by organization.

func NewOrganizationsStore

func NewOrganizationsStore(s chronograf.OrganizationsStore, org string) *OrganizationsStore

NewOrganizationsStore creates a new OrganizationsStore from an existing chronograf.OrganizationStore and an organization string

func (*OrganizationsStore) Add

Add creates a new Organization in the OrganizationsStore with organization.Organization set to be the organization from the organization store.

func (*OrganizationsStore) All

All retrieves all organizations from the underlying OrganizationStore and filters them by organization.

func (*OrganizationsStore) CreateDefault

func (s *OrganizationsStore) CreateDefault(ctx context.Context) error

func (*OrganizationsStore) DefaultOrganization

func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*chronograf.Organization, error)

func (*OrganizationsStore) Delete

Delete the organization from OrganizationsStore

func (*OrganizationsStore) Get

Get returns a Organization if the id exists and belongs to the organization that is set.

func (*OrganizationsStore) Update

Update the organization in OrganizationsStore.

type ServersStore

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

ServersStore facade on a ServerStore that filters servers by organization.

func NewServersStore

func NewServersStore(s chronograf.ServersStore, org string) *ServersStore

NewServersStore creates a new ServersStore from an existing chronograf.ServerStore and an organization string

func (*ServersStore) Add

Add creates a new Server in the ServersStore with server.Organization set to be the organization from the server store.

func (*ServersStore) All

All retrieves all servers from the underlying ServerStore and filters them by organization.

func (*ServersStore) Delete

func (s *ServersStore) Delete(ctx context.Context, d chronograf.Server) error

Delete the server from ServersStore

func (*ServersStore) Get

func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error)

Get returns a Server if the id exists and belongs to the organization that is set.

func (*ServersStore) Update

func (s *ServersStore) Update(ctx context.Context, d chronograf.Server) error

Update the server in ServersStore.

type SourcesStore

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

SourcesStore facade on a SourceStore that filters sources by organization.

func NewSourcesStore

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

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

func (*SourcesStore) Add

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

func (*SourcesStore) All

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

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 organization that is set.

func (*SourcesStore) Update

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

Update the source in SourcesStore.

type UsersStore

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

UsersStore facade on a UserStore that filters a users roles by organization.

The high level idea here is to use the same underlying store for all users. In particular, this is done by having all the users Roles field be a set of all of the users roles in all organizations. Each CRUD method here takes care to ensure that the only roles that are modified are the roles for the organization that was provided on the UsersStore.

func NewUsersStore

func NewUsersStore(s chronograf.UsersStore, org string) *UsersStore

NewUsersStore creates a new UsersStore from an existing chronograf.UserStore and an organization string

func (*UsersStore) Add

Add creates a new User in the UsersStore. It validates that the user provided only has roles for the organization set on the UsersStore. If a user is not found in the underlying, it calls the underlying UsersStore Add method. If a user is found, it removes any existing roles a user has for an organization and appends the roles specified on the provided user and calls the uderlying UsersStore Update method.

func (*UsersStore) All

func (s *UsersStore) All(ctx context.Context) ([]chronograf.User, error)

All returns all users where roles have been filters to be exclusively for the organization provided on the UsersStore.

func (*UsersStore) Delete

func (s *UsersStore) Delete(ctx context.Context, usr *chronograf.User) error

Delete a user from the UsersStore. This is done by stripping a user of any roles it has in the organization speicified on the UsersStore.

func (*UsersStore) Get

Get searches the UsersStore for using the query. The roles returned on the user are filtered to only contain roles that are for the organization specified on the organization store.

func (*UsersStore) Num

func (s *UsersStore) Num(ctx context.Context) (int, error)

Num returns the number of users in the UsersStore This is unperformant, but should rarely be used.

func (*UsersStore) Update

func (s *UsersStore) Update(ctx context.Context, usr *chronograf.User) error

Update a user in the UsersStore.

Jump to

Keyboard shortcuts

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