Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3495215
D12515.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12515.diff
View Options
diff --git a/services/identity/src/database.rs b/services/identity/src/database.rs
--- a/services/identity/src/database.rs
+++ b/services/identity/src/database.rs
@@ -739,6 +739,19 @@
Ok(Some((username, password_file)))
}
+ /// Returns an error if `user_id` does not exist in users table
+ pub async fn user_is_password_authenticated(
+ &self,
+ user_id: &str,
+ ) -> Result<bool, Error> {
+ let Some(user_item) = self.get_item_from_users_table(user_id).await?.item
+ else {
+ error!(errorType = error_types::GENERIC_DB_LOG, "user not found");
+ return Err(Error::MissingItem);
+ };
+ Ok(user_item.contains_key(USERS_TABLE_REGISTRATION_ATTRIBUTE))
+ }
+
async fn get_item_from_users_table(
&self,
user_id: &str,
diff --git a/services/identity/src/grpc_services/authenticated.rs b/services/identity/src/grpc_services/authenticated.rs
--- a/services/identity/src/grpc_services/authenticated.rs
+++ b/services/identity/src/grpc_services/authenticated.rs
@@ -459,13 +459,13 @@
debug!("Attempting to delete wallet user: {}", user_id);
- let maybe_username_and_password_file = self
+ let user_is_password_authenticated = self
.db_client
- .get_username_and_password_file(&user_id)
+ .user_is_password_authenticated(&user_id)
.await
.map_err(handle_db_error)?;
- if maybe_username_and_password_file.is_some() {
+ if user_is_password_authenticated {
return Err(tonic::Status::permission_denied(
tonic_status_messages::PASSWORD_USER,
));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 7:44 AM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2681093
Default Alt Text
D12515.diff (1 KB)
Attached To
Mode
D12515: [identity] fix wallet account deletion bug
Attached
Detach File
Event Timeline
Log In to Comment