@@ -14,6 +14,7 @@ import {
14
14
} from 'src/components/forms'
15
15
import countryList from 'src/data/countryList'
16
16
import { useListUserQuery , useListUsersQuery } from 'src/store/api/users'
17
+ import { useListGroupsQuery } from 'src/store/api/groups'
17
18
import { useListDomainsQuery } from 'src/store/api/domains'
18
19
import { useListLicensesQuery } from 'src/store/api/licenses'
19
20
import { CippCodeBlock , ModalService } from 'src/components/utilities'
@@ -45,6 +46,12 @@ const EditUser = () => {
45
46
error : usersError ,
46
47
} = useListUsersQuery ( { tenantDomain } )
47
48
49
+ const {
50
+ data : groups = [ ] ,
51
+ isFetching : groupsIsFetching ,
52
+ error : groupsError ,
53
+ } = useListGroupsQuery ( { tenantDomain } )
54
+
48
55
const {
49
56
data : domains = [ ] ,
50
57
isFetching : domainsIsFetching ,
@@ -70,8 +77,11 @@ const EditUser = () => {
70
77
} , [ userId , tenantDomain , dispatch ] )
71
78
const [ genericPostRequest , postResults ] = useLazyGenericPostRequestQuery ( )
72
79
const onSubmit = ( values ) => {
80
+ console . log ( values . AddToGroups )
73
81
const shippedValues = {
74
82
AddedAliases : values . addedAliases ,
83
+ AddToGroups : Array . isArray ( values . AddToGroups ) ? values . AddToGroups : [ ] ,
84
+ RemoveFromGroups : Array . isArray ( values . RemoveFromGroups ) ? values . RemoveFromGroups : [ ] ,
75
85
BusinessPhone : values . businessPhones ,
76
86
RemoveAllLicenses : values . RemoveAllLicenses ,
77
87
City : values . city ,
@@ -80,6 +90,7 @@ const EditUser = () => {
80
90
Country : values . country ,
81
91
Department : values . department ,
82
92
DisplayName : values . displayName ,
93
+ userPrincipalName : values . userPrincipalName ,
83
94
Domain : values . primDomain ,
84
95
firstName : values . givenName ,
85
96
Jobtitle : values . jobTitle ,
@@ -97,7 +108,7 @@ const EditUser = () => {
97
108
addedAttributes : values . addedAttributes ,
98
109
...( values . licenses ? values . license : '' ) ,
99
110
}
100
- //window.alert(JSON.stringify(shippedValues))
111
+ // window.alert(JSON.stringify(shippedValues))
101
112
genericPostRequest ( { path : '/api/EditUser' , values : shippedValues } )
102
113
}
103
114
const usageLocation = useSelector ( ( state ) => state . app . usageLocation )
@@ -414,6 +425,42 @@ const EditUser = () => {
414
425
</ CCol >
415
426
</ CRow >
416
427
< CRow className = "mb-3" >
428
+ < CCol md = { 12 } >
429
+ < RFFSelectSearch
430
+ multi = { true }
431
+ label = "Add user to group"
432
+ disabled = { formDisabled }
433
+ values = { groups ?. map ( ( group ) => ( {
434
+ value : {
435
+ groupid : group . id ,
436
+ groupType : group . calculatedGroupType ,
437
+ groupName : group . displayName ,
438
+ } ,
439
+ name : `${ group . displayName } - ${ group . calculatedGroupType } ` ,
440
+ } ) ) }
441
+ placeholder = { ! groupsIsFetching ? 'Select groups' : 'Loading...' }
442
+ name = "AddToGroups"
443
+ />
444
+ { groupsError && < span > Failed to load list of groups</ span > }
445
+ </ CCol >
446
+ < CCol md = { 12 } >
447
+ < RFFSelectSearch
448
+ multi = { true }
449
+ label = "Remove user from group"
450
+ disabled = { formDisabled }
451
+ values = { groups ?. map ( ( group ) => ( {
452
+ value : {
453
+ groupid : group . id ,
454
+ groupType : group . calculatedGroupType ,
455
+ groupName : group . displayName ,
456
+ } ,
457
+ name : `${ group . displayName } - ${ group . calculatedGroupType } ` ,
458
+ } ) ) }
459
+ placeholder = { ! groupsIsFetching ? 'Select groups' : 'Loading...' }
460
+ name = "RemoveFromGroups"
461
+ />
462
+ { groupsError && < span > Failed to load list of groups</ span > }
463
+ </ CCol >
417
464
< CCol md = { 12 } >
418
465
< RFFSelectSearch
419
466
label = "Copy group membership from other user"
0 commit comments