add users without a specified organization

pull/10616/head
Iris Scholten 2018-02-07 14:47:12 -08:00
parent 5acdd74211
commit b0159aa5eb
1 changed files with 7 additions and 6 deletions

View File

@ -11,7 +11,8 @@ const {
colActions, colActions,
} = ALL_USERS_TABLE } = ALL_USERS_TABLE
const undefinedOrganization = {id: undefined, name: 'None'} const nullOrganization = {id: undefined, name: 'None'}
const nullRole = {name: '*', organization: undefined}
class AllUsersTableRowNew extends Component { class AllUsersTableRowNew extends Component {
constructor(props) { constructor(props) {
@ -23,7 +24,7 @@ class AllUsersTableRowNew extends Component {
scheme: 'oauth2', scheme: 'oauth2',
roles: [ roles: [
{ {
...undefinedOrganization, ...nullRole,
}, },
], ],
} }
@ -41,7 +42,7 @@ class AllUsersTableRowNew extends Component {
provider, provider,
scheme, scheme,
superAdmin, superAdmin,
roles: roles[0].id === null ? [] : roles, roles: roles[0].organization === undefined ? [] : roles,
} }
onCreateUser(newUser) onCreateUser(newUser)
onBlur() onBlur()
@ -53,9 +54,9 @@ class AllUsersTableRowNew extends Component {
handleSelectOrganization = newOrganization => { handleSelectOrganization = newOrganization => {
const newRoles = [ const newRoles = [
newOrganization.id === null newOrganization.id === undefined
? { ? {
...undefinedOrganization, ...nullRole,
} }
: { : {
organization: newOrganization.id, organization: newOrganization.id,
@ -89,7 +90,7 @@ class AllUsersTableRowNew extends Component {
const {name, provider, scheme, roles} = this.state const {name, provider, scheme, roles} = this.state
const dropdownOrganizationsItems = [ const dropdownOrganizationsItems = [
{...undefinedOrganization}, {...nullOrganization},
...organizations, ...organizations,
].map(o => ({ ].map(o => ({
...o, ...o,