Skip to content

Commit 4a434aa

Browse files
committed
core: Extend list method to handle all types
1 parent fae0f6c commit 4a434aa

File tree

5 files changed

+182
-187
lines changed

5 files changed

+182
-187
lines changed

src/api/v3/user/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,7 @@ impl From<UserListParameters> for identity_types::UserListParameters {
353353
domain_id: value.domain_id,
354354
name: value.name,
355355
unique_id: value.unique_id,
356-
user_type: None,
357-
// limit: value.limit,
356+
..Default::default() // limit: value.limit,
358357
}
359358
}
360359
}

src/identity/backends/sql.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,13 @@ impl IdentityBackend for SqlBackend {
6464
state: &ServiceState,
6565
params: &UserListParameters,
6666
) -> Result<Vec<UserResponse>, IdentityProviderError> {
67-
// Determine user type to call appropriate listing function
68-
if let Some(val) = &params.user_type {
69-
match val {
70-
UserType::Local => {
71-
return Ok(local_user::list(&self.config, &state.db, params).await?);
72-
}
73-
UserType::NonLocal => {
74-
// return Ok(nonlocal_user::list(&self.config, &state.db, params).await?);
75-
}
76-
UserType::Federated => {
77-
// return Ok(federated_user::list(&self.config, &state.db, params).await?);
78-
}
79-
UserType::All => { /* continue to general listing */ }
80-
}
67+
// Create a modified copy if user_type is None
68+
let mut modified_params = params.clone();
69+
if modified_params.user_type.is_none() {
70+
modified_params.user_type = Some(UserType::All);
8171
}
82-
Ok(user::list(&self.config, &state.db, params).await?)
72+
73+
Ok(user::list(&self.config, &state.db, &modified_params).await?)
8374
}
8475

8576
/// Get single user by ID

src/identity/backends/sql/local_user.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ use crate::identity::types::*;
1717

1818
mod create;
1919
mod get;
20-
mod list;
2120
mod load;
2221
mod set;
2322

24-
pub use list::list;
2523
pub use load::load_local_user_with_passwords;
2624
pub use load::load_local_users_passwords;
2725
pub use set::reset_failed_auth;

src/identity/backends/sql/local_user/list.rs

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)