Replace Public functionality with Mappings feature
parent
5f44034584
commit
c17e124b27
|
@ -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"`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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}
|
||||
</div>
|
||||
|
|
|
@ -82,14 +82,14 @@ class ProvidersTableRow extends Component {
|
|||
wrapperClass="fancytable--td provider--provider"
|
||||
onUpdate={this.handleChangeProvider}
|
||||
disabled={isDefaultMapping}
|
||||
tabIndex={rowIndex + '1'}
|
||||
tabIndex={rowIndex}
|
||||
/>
|
||||
<InputClickToEdit
|
||||
value={providerOrganization}
|
||||
wrapperClass="fancytable--td provider--providerorg"
|
||||
onUpdate={this.handleChangeProviderOrg}
|
||||
disabled={isDefaultMapping}
|
||||
tabIndex={rowIndex + '2'}
|
||||
tabIndex={rowIndex}
|
||||
/>
|
||||
<div className="fancytable--td provider--arrow">
|
||||
<span />
|
||||
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -61,13 +61,13 @@ class ProvidersTableRowNew extends Component {
|
|||
value={provider}
|
||||
wrapperClass="fancytable--td provider--provider"
|
||||
onUpdate={this.handleChangeProvider}
|
||||
tabIndex={rowIndex + '1'}
|
||||
tabIndex={rowIndex}
|
||||
/>
|
||||
<InputClickToEdit
|
||||
value={providerOrganization}
|
||||
wrapperClass="fancytable--td provider--providerorg"
|
||||
onUpdate={this.handleChangeProviderOrg}
|
||||
tabIndex={rowIndex + '2'}
|
||||
tabIndex={rowIndex}
|
||||
/>
|
||||
<div className="fancytable--td provider--arrow">
|
||||
<span />
|
||||
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue