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} />
@@ -121,7 +121,7 @@ class ProvidersTableRow extends Component { } } -const {arrayOf, func, shape, string} = PropTypes +const {arrayOf, func, number, shape, string} = PropTypes ProvidersTableRow.propTypes = { mapping: shape({ @@ -142,7 +142,7 @@ ProvidersTableRow.propTypes = { text: string.isRequired, }) ), - rowIndex: string, + rowIndex: number, onDelete: func.isRequired, onUpdate: func.isRequired, } diff --git a/ui/src/admin/components/chronograf/ProvidersTableRowNew.js b/ui/src/admin/components/chronograf/ProvidersTableRowNew.js index 0cf12da80b..a8212248d6 100644 --- a/ui/src/admin/components/chronograf/ProvidersTableRowNew.js +++ b/ui/src/admin/components/chronograf/ProvidersTableRowNew.js @@ -61,13 +61,13 @@ class ProvidersTableRowNew extends Component { value={provider} wrapperClass="fancytable--td provider--provider" onUpdate={this.handleChangeProvider} - tabIndex={rowIndex + '1'} + tabIndex={rowIndex} />
@@ -89,7 +89,7 @@ class ProvidersTableRowNew extends Component { } } -const {arrayOf, func, shape, string} = PropTypes +const {arrayOf, func, number, shape, string} = PropTypes ProvidersTableRowNew.propTypes = { organizations: arrayOf( @@ -103,7 +103,7 @@ ProvidersTableRowNew.propTypes = { text: string.isRequired, }) ), - rowIndex: string, + rowIndex: number, onCreate: func.isRequired, onCancel: func.isRequired, } diff --git a/ui/src/shared/components/InputClickToEdit.js b/ui/src/shared/components/InputClickToEdit.js index 38afd6ab46..c260299160 100644 --- a/ui/src/shared/components/InputClickToEdit.js +++ b/ui/src/shared/components/InputClickToEdit.js @@ -80,14 +80,14 @@ class InputClickToEdit extends Component { } } -const {func, bool, string} = PropTypes +const {func, bool, number, string} = PropTypes InputClickToEdit.propTypes = { wrapperClass: string.isRequired, value: string, onUpdate: func.isRequired, disabled: bool, - tabIndex: string, + tabIndex: number, } export default InputClickToEdit