@@ -1995,7 +1995,7 @@ async fn test_scim_user_admin_group_priv_conflict(
19951995}
19961996
19971997#[ nexus_test]
1998- async fn test_scim_list_users_with_groups ( cptestctx : & ControlPlaneTestContext ) {
1998+ async fn test_scim_list_users_and_groups ( cptestctx : & ControlPlaneTestContext ) {
19991999 let client = & cptestctx. external_client ;
20002000 let nexus = & cptestctx. server . server_context ( ) . nexus ;
20012001 let opctx = OpContext :: for_tests (
@@ -2101,7 +2101,7 @@ async fn test_scim_list_users_with_groups(cptestctx: &ControlPlaneTestContext) {
21012101 . execute_and_parse_unwrap ( )
21022102 . await ;
21032103
2104- let _group3 : scim2_rs:: Group = NexusRequest :: new (
2104+ let group3 : scim2_rs:: Group = NexusRequest :: new (
21052105 RequestBuilder :: new ( client, Method :: POST , "/scim/v2/Groups" )
21062106 . header ( http:: header:: CONTENT_TYPE , "application/scim+json" )
21072107 . header (
@@ -2184,136 +2184,6 @@ async fn test_scim_list_users_with_groups(cptestctx: &ControlPlaneTestContext) {
21842184 // user5 should have no groups
21852185 let user5 = find_user ( & users[ 4 ] . id ) ;
21862186 assert ! ( user5. groups. is_none( ) ) ;
2187- }
2188-
2189- #[ nexus_test]
2190- async fn test_scim_list_groups_with_members (
2191- cptestctx : & ControlPlaneTestContext ,
2192- ) {
2193- let client = & cptestctx. external_client ;
2194- let nexus = & cptestctx. server . server_context ( ) . nexus ;
2195- let opctx = OpContext :: for_tests (
2196- cptestctx. logctx . log . new ( o ! ( ) ) ,
2197- nexus. datastore ( ) . clone ( ) ,
2198- ) ;
2199-
2200- const SILO_NAME : & str = "saml-scim-silo" ;
2201- create_silo ( & client, SILO_NAME , true , shared:: SiloIdentityMode :: SamlScim )
2202- . await ;
2203-
2204- grant_iam (
2205- client,
2206- & format ! ( "/v1/system/silos/{SILO_NAME}" ) ,
2207- shared:: SiloRole :: Admin ,
2208- opctx. authn . actor ( ) . unwrap ( ) . silo_user_id ( ) . unwrap ( ) ,
2209- AuthnMode :: PrivilegedUser ,
2210- )
2211- . await ;
2212-
2213- let created_token: views:: ScimClientBearerTokenValue =
2214- object_create_no_body (
2215- client,
2216- & format ! ( "/v1/system/scim/tokens?silo={}" , SILO_NAME ) ,
2217- )
2218- . await ;
2219-
2220- // Create 5 users
2221- let mut users = Vec :: new ( ) ;
2222- for i in 1 ..=5 {
2223- let user: scim2_rs:: User = NexusRequest :: new (
2224- RequestBuilder :: new ( client, Method :: POST , "/scim/v2/Users" )
2225- . header ( http:: header:: CONTENT_TYPE , "application/scim+json" )
2226- . header (
2227- http:: header:: AUTHORIZATION ,
2228- format ! ( "Bearer oxide-scim-{}" , created_token. bearer_token) ,
2229- )
2230- . allow_non_dropshot_errors ( )
2231- . raw_body ( Some (
2232- serde_json:: to_string ( & serde_json:: json!( {
2233- "userName" : format!( "user{}" , i) ,
2234- "externalId" : format!( "user{}@example.com" , i) ,
2235- } ) )
2236- . unwrap ( ) ,
2237- ) )
2238- . expect_status ( Some ( StatusCode :: CREATED ) ) ,
2239- )
2240- . execute_and_parse_unwrap ( )
2241- . await ;
2242- users. push ( user) ;
2243- }
2244-
2245- // Create 3 groups with various membership patterns:
2246- // - group1: user1, user2, user3
2247- // - group2: user1, user4
2248- // - group3: no members
2249- let group1: scim2_rs:: Group = NexusRequest :: new (
2250- RequestBuilder :: new ( client, Method :: POST , "/scim/v2/Groups" )
2251- . header ( http:: header:: CONTENT_TYPE , "application/scim+json" )
2252- . header (
2253- http:: header:: AUTHORIZATION ,
2254- format ! ( "Bearer oxide-scim-{}" , created_token. bearer_token) ,
2255- )
2256- . allow_non_dropshot_errors ( )
2257- . raw_body ( Some (
2258- serde_json:: to_string ( & serde_json:: json!( {
2259- "displayName" : "group1" ,
2260- "externalId" : "group1@example.com" ,
2261- "members" : [
2262- { "value" : users[ 0 ] . id} ,
2263- { "value" : users[ 1 ] . id} ,
2264- { "value" : users[ 2 ] . id} ,
2265- ] ,
2266- } ) )
2267- . unwrap ( ) ,
2268- ) )
2269- . expect_status ( Some ( StatusCode :: CREATED ) ) ,
2270- )
2271- . execute_and_parse_unwrap ( )
2272- . await ;
2273-
2274- let group2: scim2_rs:: Group = NexusRequest :: new (
2275- RequestBuilder :: new ( client, Method :: POST , "/scim/v2/Groups" )
2276- . header ( http:: header:: CONTENT_TYPE , "application/scim+json" )
2277- . header (
2278- http:: header:: AUTHORIZATION ,
2279- format ! ( "Bearer oxide-scim-{}" , created_token. bearer_token) ,
2280- )
2281- . allow_non_dropshot_errors ( )
2282- . raw_body ( Some (
2283- serde_json:: to_string ( & serde_json:: json!( {
2284- "displayName" : "group2" ,
2285- "externalId" : "group2@example.com" ,
2286- "members" : [
2287- { "value" : users[ 0 ] . id} ,
2288- { "value" : users[ 3 ] . id} ,
2289- ] ,
2290- } ) )
2291- . unwrap ( ) ,
2292- ) )
2293- . expect_status ( Some ( StatusCode :: CREATED ) ) ,
2294- )
2295- . execute_and_parse_unwrap ( )
2296- . await ;
2297-
2298- let group3: scim2_rs:: Group = NexusRequest :: new (
2299- RequestBuilder :: new ( client, Method :: POST , "/scim/v2/Groups" )
2300- . header ( http:: header:: CONTENT_TYPE , "application/scim+json" )
2301- . header (
2302- http:: header:: AUTHORIZATION ,
2303- format ! ( "Bearer oxide-scim-{}" , created_token. bearer_token) ,
2304- )
2305- . allow_non_dropshot_errors ( )
2306- . raw_body ( Some (
2307- serde_json:: to_string ( & serde_json:: json!( {
2308- "displayName" : "group3" ,
2309- "externalId" : "group3@example.com" ,
2310- } ) )
2311- . unwrap ( ) ,
2312- ) )
2313- . expect_status ( Some ( StatusCode :: CREATED ) ) ,
2314- )
2315- . execute_and_parse_unwrap ( )
2316- . await ;
23172187
23182188 // List all groups and verify members
23192189 let response: scim2_rs:: ListResponse = NexusRequest :: new (
0 commit comments