Replace Public functionality with Mappings feature
parent
5f44034584
commit
c17e124b27
|
@ -399,7 +399,7 @@ type User struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Passwd string `json:"password,omitempty"`
|
Passwd string `json:"password,omitempty"`
|
||||||
Permissions Permissions `json:"permissions,omitempty"`
|
Permissions Permissions `json:"permissions,omitempty"`
|
||||||
Roles []Role `json:"roles,omitempty"`
|
Roles []Role `json:"roles"`
|
||||||
Provider string `json:"provider,omitempty"`
|
Provider string `json:"provider,omitempty"`
|
||||||
Scheme string `json:"scheme,omitempty"`
|
Scheme string `json:"scheme,omitempty"`
|
||||||
SuperAdmin bool `json:"superAdmin,omitempty"`
|
SuperAdmin bool `json:"superAdmin,omitempty"`
|
||||||
|
|
|
@ -20,7 +20,7 @@ type meLinks struct {
|
||||||
type meResponse struct {
|
type meResponse struct {
|
||||||
*chronograf.User
|
*chronograf.User
|
||||||
Links meLinks `json:"links"`
|
Links meLinks `json:"links"`
|
||||||
Organizations []chronograf.Organization `json:"organizations,omitempty"`
|
Organizations []chronograf.Organization `json:"organizations"`
|
||||||
CurrentOrganization *chronograf.Organization `json:"currentOrganization,omitempty"`
|
CurrentOrganization *chronograf.Organization `json:"currentOrganization,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,12 +249,6 @@ func (s *Service) Me(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
// user exists
|
// user exists
|
||||||
if usr != nil {
|
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})
|
currentOrg, err := s.Store.Organizations(serverCtx).Get(serverCtx, chronograf.OrganizationQuery{ID: &p.Organization})
|
||||||
if err == chronograf.ErrOrganizationNotFound {
|
if err == chronograf.ErrOrganizationNotFound {
|
||||||
// The intent is to force a the user to go through another auth flow
|
// 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)
|
unknownErrorWithMessage(w, err, s.Logger)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
res := newMeResponse(usr)
|
res := newMeResponse(usr)
|
||||||
res.Organizations = orgs
|
res.Organizations = orgs
|
||||||
res.CurrentOrganization = currentOrg
|
res.CurrentOrganization = currentOrg
|
||||||
|
|
|
@ -81,6 +81,14 @@ class CheckSources extends Component {
|
||||||
return router.push('/')
|
return router.push('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!organizations.length) {
|
||||||
|
notify(
|
||||||
|
'error',
|
||||||
|
'You have been removed from all organizations. Please contact your administrator.'
|
||||||
|
)
|
||||||
|
return router.push('/purgatory')
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
me.superAdmin &&
|
me.superAdmin &&
|
||||||
!organizations.find(o => o.id === currentOrganization.id)
|
!organizations.find(o => o.id === currentOrganization.id)
|
||||||
|
|
|
@ -95,7 +95,7 @@ class ProvidersTable extends Component {
|
||||||
schemes={SCHEMES}
|
schemes={SCHEMES}
|
||||||
onDelete={onDeleteMap}
|
onDelete={onDeleteMap}
|
||||||
onUpdate={onUpdateMap}
|
onUpdate={onUpdateMap}
|
||||||
rowIndex={i.toString()}
|
rowIndex={i + 1}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{isCreatingMap
|
{isCreatingMap
|
||||||
|
@ -104,7 +104,7 @@ class ProvidersTable extends Component {
|
||||||
schemes={SCHEMES}
|
schemes={SCHEMES}
|
||||||
onCreate={this.handleCreateMap}
|
onCreate={this.handleCreateMap}
|
||||||
onCancel={this.handleCancelCreateMap}
|
onCancel={this.handleCancelCreateMap}
|
||||||
rowIndex={mappings.length.toString()}
|
rowIndex={mappings.length + 1}
|
||||||
/>
|
/>
|
||||||
: null}
|
: null}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -82,14 +82,14 @@ class ProvidersTableRow extends Component {
|
||||||
wrapperClass="fancytable--td provider--provider"
|
wrapperClass="fancytable--td provider--provider"
|
||||||
onUpdate={this.handleChangeProvider}
|
onUpdate={this.handleChangeProvider}
|
||||||
disabled={isDefaultMapping}
|
disabled={isDefaultMapping}
|
||||||
tabIndex={rowIndex + '1'}
|
tabIndex={rowIndex}
|
||||||
/>
|
/>
|
||||||
<InputClickToEdit
|
<InputClickToEdit
|
||||||
value={providerOrganization}
|
value={providerOrganization}
|
||||||
wrapperClass="fancytable--td provider--providerorg"
|
wrapperClass="fancytable--td provider--providerorg"
|
||||||
onUpdate={this.handleChangeProviderOrg}
|
onUpdate={this.handleChangeProviderOrg}
|
||||||
disabled={isDefaultMapping}
|
disabled={isDefaultMapping}
|
||||||
tabIndex={rowIndex + '2'}
|
tabIndex={rowIndex}
|
||||||
/>
|
/>
|
||||||
<div className="fancytable--td provider--arrow">
|
<div className="fancytable--td provider--arrow">
|
||||||
<span />
|
<span />
|
||||||
|
@ -121,7 +121,7 @@ class ProvidersTableRow extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const {arrayOf, func, shape, string} = PropTypes
|
const {arrayOf, func, number, shape, string} = PropTypes
|
||||||
|
|
||||||
ProvidersTableRow.propTypes = {
|
ProvidersTableRow.propTypes = {
|
||||||
mapping: shape({
|
mapping: shape({
|
||||||
|
@ -142,7 +142,7 @@ ProvidersTableRow.propTypes = {
|
||||||
text: string.isRequired,
|
text: string.isRequired,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
rowIndex: string,
|
rowIndex: number,
|
||||||
onDelete: func.isRequired,
|
onDelete: func.isRequired,
|
||||||
onUpdate: func.isRequired,
|
onUpdate: func.isRequired,
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,13 +61,13 @@ class ProvidersTableRowNew extends Component {
|
||||||
value={provider}
|
value={provider}
|
||||||
wrapperClass="fancytable--td provider--provider"
|
wrapperClass="fancytable--td provider--provider"
|
||||||
onUpdate={this.handleChangeProvider}
|
onUpdate={this.handleChangeProvider}
|
||||||
tabIndex={rowIndex + '1'}
|
tabIndex={rowIndex}
|
||||||
/>
|
/>
|
||||||
<InputClickToEdit
|
<InputClickToEdit
|
||||||
value={providerOrganization}
|
value={providerOrganization}
|
||||||
wrapperClass="fancytable--td provider--providerorg"
|
wrapperClass="fancytable--td provider--providerorg"
|
||||||
onUpdate={this.handleChangeProviderOrg}
|
onUpdate={this.handleChangeProviderOrg}
|
||||||
tabIndex={rowIndex + '2'}
|
tabIndex={rowIndex}
|
||||||
/>
|
/>
|
||||||
<div className="fancytable--td provider--arrow">
|
<div className="fancytable--td provider--arrow">
|
||||||
<span />
|
<span />
|
||||||
|
@ -89,7 +89,7 @@ class ProvidersTableRowNew extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const {arrayOf, func, shape, string} = PropTypes
|
const {arrayOf, func, number, shape, string} = PropTypes
|
||||||
|
|
||||||
ProvidersTableRowNew.propTypes = {
|
ProvidersTableRowNew.propTypes = {
|
||||||
organizations: arrayOf(
|
organizations: arrayOf(
|
||||||
|
@ -103,7 +103,7 @@ ProvidersTableRowNew.propTypes = {
|
||||||
text: string.isRequired,
|
text: string.isRequired,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
rowIndex: string,
|
rowIndex: number,
|
||||||
onCreate: func.isRequired,
|
onCreate: func.isRequired,
|
||||||
onCancel: 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 = {
|
InputClickToEdit.propTypes = {
|
||||||
wrapperClass: string.isRequired,
|
wrapperClass: string.isRequired,
|
||||||
value: string,
|
value: string,
|
||||||
onUpdate: func.isRequired,
|
onUpdate: func.isRequired,
|
||||||
disabled: bool,
|
disabled: bool,
|
||||||
tabIndex: string,
|
tabIndex: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default InputClickToEdit
|
export default InputClickToEdit
|
||||||
|
|
Loading…
Reference in New Issue