Remove obsolete Default org Create User logic
parent
172672c44e
commit
07ca811ab3
|
@ -5,15 +5,11 @@ import {bindActionCreators} from 'redux'
|
||||||
import * as adminChronografActionCreators from 'src/admin/actions/chronograf'
|
import * as adminChronografActionCreators from 'src/admin/actions/chronograf'
|
||||||
import {publishAutoDismissingNotification} from 'shared/dispatchers'
|
import {publishAutoDismissingNotification} from 'shared/dispatchers'
|
||||||
|
|
||||||
import {MEMBER_ROLE} from 'src/auth/Authorized'
|
|
||||||
|
|
||||||
import PageHeader from 'src/admin/components/chronograf/PageHeader'
|
import PageHeader from 'src/admin/components/chronograf/PageHeader'
|
||||||
import UsersTable from 'src/admin/components/chronograf/UsersTable'
|
import UsersTable from 'src/admin/components/chronograf/UsersTable'
|
||||||
|
|
||||||
import FancyScrollbar from 'shared/components/FancyScrollbar'
|
import FancyScrollbar from 'shared/components/FancyScrollbar'
|
||||||
|
|
||||||
import {DEFAULT_ORG_ID} from 'src/admin/constants/dummyUsers'
|
|
||||||
|
|
||||||
class AdminChronografPage extends Component {
|
class AdminChronografPage extends Component {
|
||||||
// TODO: revisit this, possibly don't call setState if both are deep equal
|
// TODO: revisit this, possibly don't call setState if both are deep equal
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -40,21 +36,8 @@ class AdminChronografPage extends Component {
|
||||||
// SINGLE USER ACTIONS
|
// SINGLE USER ACTIONS
|
||||||
handleCreateUser = user => {
|
handleCreateUser = user => {
|
||||||
const {links, actions: {createUserAsync}} = this.props
|
const {links, actions: {createUserAsync}} = this.props
|
||||||
let newUser = user
|
|
||||||
|
|
||||||
if (
|
createUserAsync(links.users, user)
|
||||||
user.roles.length === 1 &&
|
|
||||||
user.roles[0].organization !== DEFAULT_ORG_ID
|
|
||||||
) {
|
|
||||||
newUser = {
|
|
||||||
...newUser,
|
|
||||||
roles: [
|
|
||||||
...newUser.roles,
|
|
||||||
{organization: DEFAULT_ORG_ID, name: MEMBER_ROLE},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
createUserAsync(links.users, newUser)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUpdateUserRole = () => (user, currentRole, {name}) => {
|
handleUpdateUserRole = () => (user, currentRole, {name}) => {
|
||||||
|
|
Loading…
Reference in New Issue