diff --git a/chronograf.go b/chronograf.go
index 9050cb4be3..82139533aa 100644
--- a/chronograf.go
+++ b/chronograf.go
@@ -399,7 +399,7 @@ type User struct {
Name string `json:"name"`
Passwd string `json:"password,omitempty"`
Permissions Permissions `json:"permissions,omitempty"`
- Roles []Role `json:"roles,omitempty"`
+ Roles []Role `json:"roles"`
Provider string `json:"provider,omitempty"`
Scheme string `json:"scheme,omitempty"`
SuperAdmin bool `json:"superAdmin,omitempty"`
diff --git a/server/me.go b/server/me.go
index af1789c3b9..2ff3fd5c72 100644
--- a/server/me.go
+++ b/server/me.go
@@ -20,7 +20,7 @@ type meLinks struct {
type meResponse struct {
*chronograf.User
Links meLinks `json:"links"`
- Organizations []chronograf.Organization `json:"organizations,omitempty"`
+ Organizations []chronograf.Organization `json:"organizations"`
CurrentOrganization *chronograf.Organization `json:"currentOrganization,omitempty"`
}
@@ -249,12 +249,6 @@ func (s *Service) Me(w http.ResponseWriter, r *http.Request) {
// user exists
if usr != nil {
- // user has no roles
- if len(usr.Roles) == 0 {
- Error(w, http.StatusForbidden, "This organization is private. To gain access, you must be explicitly added by an administrator.", s.Logger)
- return
- }
-
currentOrg, err := s.Store.Organizations(serverCtx).Get(serverCtx, chronograf.OrganizationQuery{ID: &p.Organization})
if err == chronograf.ErrOrganizationNotFound {
// The intent is to force a the user to go through another auth flow
@@ -271,6 +265,7 @@ func (s *Service) Me(w http.ResponseWriter, r *http.Request) {
unknownErrorWithMessage(w, err, s.Logger)
return
}
+
res := newMeResponse(usr)
res.Organizations = orgs
res.CurrentOrganization = currentOrg
diff --git a/ui/src/CheckSources.js b/ui/src/CheckSources.js
index d7aea0e607..308f77c55e 100644
--- a/ui/src/CheckSources.js
+++ b/ui/src/CheckSources.js
@@ -81,6 +81,14 @@ class CheckSources extends Component {
return router.push('/')
}
+ if (!organizations.length) {
+ notify(
+ 'error',
+ 'You have been removed from all organizations. Please contact your administrator.'
+ )
+ return router.push('/purgatory')
+ }
+
if (
me.superAdmin &&
!organizations.find(o => o.id === currentOrganization.id)
diff --git a/ui/src/admin/components/chronograf/ProvidersTable.js b/ui/src/admin/components/chronograf/ProvidersTable.js
index c69e25f012..49fe076527 100644
--- a/ui/src/admin/components/chronograf/ProvidersTable.js
+++ b/ui/src/admin/components/chronograf/ProvidersTable.js
@@ -95,7 +95,7 @@ class ProvidersTable extends Component {
schemes={SCHEMES}
onDelete={onDeleteMap}
onUpdate={onUpdateMap}
- rowIndex={i.toString()}
+ rowIndex={i + 1}
/>
)}
{isCreatingMap
@@ -104,7 +104,7 @@ class ProvidersTable extends Component {
schemes={SCHEMES}
onCreate={this.handleCreateMap}
onCancel={this.handleCancelCreateMap}
- rowIndex={mappings.length.toString()}
+ rowIndex={mappings.length + 1}
/>
: null}
diff --git a/ui/src/admin/components/chronograf/ProvidersTableRow.js b/ui/src/admin/components/chronograf/ProvidersTableRow.js
index 68d40de15d..ba42f9a2b4 100644
--- a/ui/src/admin/components/chronograf/ProvidersTableRow.js
+++ b/ui/src/admin/components/chronograf/ProvidersTableRow.js
@@ -82,14 +82,14 @@ class ProvidersTableRow extends Component {
wrapperClass="fancytable--td provider--provider"
onUpdate={this.handleChangeProvider}
disabled={isDefaultMapping}
- tabIndex={rowIndex + '1'}
+ tabIndex={rowIndex}
/>