Documentation ¶
Index ¶
- Constants
- type DashboardsStore
- func (s *DashboardsStore) Add(ctx context.Context, d cmp.Dashboard) (cmp.Dashboard, error)
- func (s *DashboardsStore) All(ctx context.Context) ([]cmp.Dashboard, error)
- func (s *DashboardsStore) Delete(ctx context.Context, d cmp.Dashboard) error
- func (s *DashboardsStore) Get(ctx context.Context, id cmp.DashboardID) (cmp.Dashboard, error)
- func (s *DashboardsStore) Update(ctx context.Context, d cmp.Dashboard) error
- type OrganizationConfigStore
- type OrganizationsStore
- func (s *OrganizationsStore) Add(ctx context.Context, o *cmp.Organization) (*cmp.Organization, error)
- func (s *OrganizationsStore) All(ctx context.Context) ([]cmp.Organization, error)
- func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
- func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*cmp.Organization, error)
- func (s *OrganizationsStore) Delete(ctx context.Context, o *cmp.Organization) error
- func (s *OrganizationsStore) Get(ctx context.Context, q cmp.OrganizationQuery) (*cmp.Organization, error)
- func (s *OrganizationsStore) Update(ctx context.Context, o *cmp.Organization) error
- type ServersStore
- func (s *ServersStore) Add(ctx context.Context, src cmp.Server) (cmp.Server, error)
- func (s *ServersStore) All(ctx context.Context) ([]cmp.Server, error)
- func (s *ServersStore) Delete(ctx context.Context, d cmp.Server) error
- func (s *ServersStore) Get(ctx context.Context, id int) (cmp.Server, error)
- func (s *ServersStore) Update(ctx context.Context, src cmp.Server) error
- type SourcesStore
- func (s *SourcesStore) Add(ctx context.Context, d cmp.Source) (cmp.Source, error)
- func (s *SourcesStore) All(ctx context.Context) ([]cmp.Source, error)
- func (s *SourcesStore) Delete(ctx context.Context, d cmp.Source) error
- func (s *SourcesStore) Get(ctx context.Context, id int) (cmp.Source, error)
- func (s *SourcesStore) Update(ctx context.Context, d cmp.Source) error
- type UsersStore
- func (s *UsersStore) Add(ctx context.Context, u *cmp.User) (*cmp.User, error)
- func (s *UsersStore) All(ctx context.Context) ([]cmp.User, error)
- func (s *UsersStore) Delete(ctx context.Context, usr *cmp.User) error
- func (s *UsersStore) Get(ctx context.Context, q cmp.UserQuery) (*cmp.User, error)
- func (s *UsersStore) Num(ctx context.Context) (int, error)
- func (s *UsersStore) Update(ctx context.Context, usr *cmp.User) error
Constants ¶
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 cmp.DashboardsStore, org string) *DashboardsStore
NewDashboardsStore creates a new DashboardsStore from an existing cmp.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) Get ¶
func (s *DashboardsStore) Get(ctx context.Context, id cmp.DashboardID) (cmp.Dashboard, error)
Get returns a Dashboard if the id exists and belongs to the organization that is set.
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 cmp.OrganizationConfigStore, orgID string) *OrganizationConfigStore
NewOrganizationConfigStore creates a new OrganizationConfigStore from an existing cmp.OrganizationConfigStore and an organization string
func (*OrganizationConfigStore) FindOrCreate ¶
func (s *OrganizationConfigStore) FindOrCreate(ctx context.Context, orgID string) (*cmp.OrganizationConfig, error)
FindOrCreate gets an organization's config or creates one if none exists
func (*OrganizationConfigStore) Put ¶
func (s *OrganizationConfigStore) Put(ctx context.Context, c *cmp.OrganizationConfig) error
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 cmp.OrganizationsStore, org string) *OrganizationsStore
NewOrganizationsStore creates a new OrganizationsStore from an existing cmp.OrganizationStore and an organization string
func (*OrganizationsStore) Add ¶
func (s *OrganizationsStore) Add(ctx context.Context, o *cmp.Organization) (*cmp.Organization, error)
Add creates a new Organization in the OrganizationsStore with organization.Organization set to be the organization from the organization store.
func (*OrganizationsStore) All ¶
func (s *OrganizationsStore) All(ctx context.Context) ([]cmp.Organization, error)
All retrieves all organizations from the underlying OrganizationStore and filters them by organization.
func (*OrganizationsStore) CreateDefault ¶
func (s *OrganizationsStore) CreateDefault(ctx context.Context) error
CreateDefault ...
func (*OrganizationsStore) DefaultOrganization ¶
func (s *OrganizationsStore) DefaultOrganization(ctx context.Context) (*cmp.Organization, error)
DefaultOrganization ...
func (*OrganizationsStore) Delete ¶
func (s *OrganizationsStore) Delete(ctx context.Context, o *cmp.Organization) error
Delete the organization from OrganizationsStore
func (*OrganizationsStore) Get ¶
func (s *OrganizationsStore) Get(ctx context.Context, q cmp.OrganizationQuery) (*cmp.Organization, error)
Get returns a Organization if the id exists and belongs to the organization that is set.
func (*OrganizationsStore) Update ¶
func (s *OrganizationsStore) Update(ctx context.Context, o *cmp.Organization) error
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 cmp.ServersStore, org string) *ServersStore
NewServersStore creates a new ServersStore from an existing cmp.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.
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 cmp.SourcesStore, org string) *SourcesStore
NewSourcesStore creates a new SourcesStore from an existing cmp.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.
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 cmp.UsersStore, org string) *UsersStore
NewUsersStore creates a new UsersStore from an existing cmp.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 ¶
All returns all users where roles have been filters to be exclusively for the organization provided on the UsersStore.
func (*UsersStore) Delete ¶
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.