From 09050b9c8eddb29e5fbfd8bb8e8f73ea13c99cdf Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Thu, 12 Oct 2017 19:04:03 -0400 Subject: [PATCH] Remove unused concept of RolesStore Signed-off-by: Michael de Sa --- bolt/client.go | 2 -- bolt/roles.go | 59 -------------------------------------------------- chronograf.go | 1 - 3 files changed, 62 deletions(-) delete mode 100644 bolt/roles.go diff --git a/bolt/client.go b/bolt/client.go index 2395e92a58..577541ab92 100644 --- a/bolt/client.go +++ b/bolt/client.go @@ -20,7 +20,6 @@ type Client struct { ServersStore *ServersStore LayoutStore *LayoutStore UsersStore *UsersStore - RolesStore *RolesStore DashboardsStore *DashboardsStore } @@ -30,7 +29,6 @@ func NewClient() *Client { c.SourcesStore = &SourcesStore{client: c} c.ServersStore = &ServersStore{client: c} c.UsersStore = &UsersStore{client: c} - c.RolesStore = newRolesStore(c.UsersStore) c.LayoutStore = &LayoutStore{ client: c, IDs: &uuid.V4{}, diff --git a/bolt/roles.go b/bolt/roles.go deleted file mode 100644 index a44fcfec1b..0000000000 --- a/bolt/roles.go +++ /dev/null @@ -1,59 +0,0 @@ -package bolt - -import ( - "context" - "fmt" - "sync" - - "github.com/influxdata/chronograf" -) - -// Ensure RolesStore implements chronograf.RolesStore. -var _ chronograf.RolesStore = &RolesStore{} - -// RolesStore uses bolt to store and retrieve roles -type RolesStore struct { - mu sync.RWMutex - roles map[string]chronograf.Role - usersStore *UsersStore -} - -// NewRolesStore returns a *RolesStore populated with the -// default Chonograf User Roles -func newRolesStore(u *UsersStore) *RolesStore { - s := &RolesStore{ - usersStore: u, - roles: map[string]chronograf.Role{}, - } - - for name, role := range chronograf.DefaultUserRoles { - s.roles[name] = role - } - - return s -} - -// All returns all roles and all users associated with each role. -func (s *RolesStore) All(context.Context) ([]chronograf.Role, error) { - panic("not implemented") -} - -// Add returns an error and a nil users. It is not intended to be used currently. -func (s *RolesStore) Add(context.Context, *chronograf.Role) (*chronograf.Role, error) { - return nil, fmt.Errorf("Add not supported for boltdb roles store") -} - -// Delete returns an error. It is not intended to be used currently. -func (s *RolesStore) Delete(context.Context, *chronograf.Role) error { - return fmt.Errorf("Delete not supported for boltdb roles store") -} - -// Get retrieves a role and all users associated with it. -func (s *RolesStore) Get(ctx context.Context, name string) (*chronograf.Role, error) { - panic("not implemented") -} - -// Update returns an error. It is not intended to be used currently. -func (s *RolesStore) Update(context.Context, *chronograf.Role) error { - return fmt.Errorf("Update not supported for boltdb roles store") -} diff --git a/chronograf.go b/chronograf.go index 94444793e4..fef0ad8849 100644 --- a/chronograf.go +++ b/chronograf.go @@ -116,7 +116,6 @@ const ( ErrLayoutNotFound = Error("layout not found") ErrDashboardNotFound = Error("dashboard not found") ErrUserNotFound = Error("user not found") - ErrRoleNotFound = Error("role not found") ErrLayoutInvalid = Error("layout is invalid") ErrAlertNotFound = Error("alert not found") ErrAuthentication = Error("user not authenticated")