@@ -29,6 +29,11 @@ type SearchSort = {
2929 desc ?: boolean ;
3030} ;
3131
32+ type RolesList = {
33+ values : string [ ] ;
34+ and ?: boolean ;
35+ } ;
36+
3237type SearchRequest = {
3338 page ?: number ;
3439 limit ?: number ;
@@ -49,8 +54,8 @@ type SearchRequest = {
4954 toCreatedTime ?: number ; // Search users created before this time (epoch in milliseconds)
5055 fromModifiedTime ?: number ; // Search users modified after this time (epoch in milliseconds)
5156 toModifiedTime ?: number ; // Search users modified before this time (epoch in milliseconds)
52- tenantRoleIds ?: Record < string , string [ ] > ; // Search users based on tenants and role IDs
53- tenantRoleNames ?: Record < string , string [ ] > ; // Search users based on tenants and role names
57+ tenantRoleIds ?: Record < string , RolesList > ; // Search users based on tenants and role IDs
58+ tenantRoleNames ?: Record < string , RolesList > ; // Search users based on tenants and role names
5459} ;
5560
5661type SingleUserResponse = {
@@ -61,17 +66,6 @@ type MultipleUsersResponse = {
6166 users : UserResponse [ ] ;
6267} ;
6368
64- function mapToValuesObject (
65- input : Record < string , string [ ] > | undefined ,
66- ) : Record < string , { values : string [ ] } > | undefined {
67- if ( ! input || Object . keys ( input ) . length === 0 ) {
68- return undefined ;
69- }
70- return Object . fromEntries (
71- Object . entries ( input ) . map ( ( [ key , value ] ) => [ key , { values : value } ] ) ,
72- ) as Record < string , { values : string [ ] } > ;
73- }
74-
7569const withUser = ( sdk : CoreSdk , managementKey ?: string ) => {
7670 /* Create User */
7771 function create ( loginId : string , options ?: UserOptions ) : Promise < SdkResponse < UserResponse > > ;
@@ -609,8 +603,6 @@ const withUser = (sdk: CoreSdk, managementKey?: string) => {
609603 testUsersOnly : true ,
610604 roleNames : searchReq . roles ,
611605 roles : undefined ,
612- tenantRoleIds : mapToValuesObject ( searchReq . tenantRoleIds ) ,
613- tenantRoleNames : mapToValuesObject ( searchReq . tenantRoleNames ) ,
614606 } ,
615607 { token : managementKey } ,
616608 ) ,
@@ -624,8 +616,6 @@ const withUser = (sdk: CoreSdk, managementKey?: string) => {
624616 ...searchReq ,
625617 roleNames : searchReq . roles ,
626618 roles : undefined ,
627- tenantRoleIds : mapToValuesObject ( searchReq . tenantRoleIds ) ,
628- tenantRoleNames : mapToValuesObject ( searchReq . tenantRoleNames ) ,
629619 } ,
630620 { token : managementKey } ,
631621 ) ,
0 commit comments