File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
crates/handlers/src/admin/v1/personal_sessions Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ pub enum RouteError {
3232 #[ error( "User not found" ) ]
3333 UserNotFound ,
3434
35+ #[ error( "User is not active" ) ]
36+ UserDeactivated ,
37+
3538 #[ error( "Invalid scope" ) ]
3639 InvalidScope ,
3740}
@@ -46,6 +49,7 @@ impl IntoResponse for RouteError {
4649 let status = match self {
4750 Self :: Internal ( _) => StatusCode :: INTERNAL_SERVER_ERROR ,
4851 Self :: UserNotFound => StatusCode :: NOT_FOUND ,
52+ Self :: UserDeactivated => StatusCode :: GONE ,
4953 Self :: InvalidScope => StatusCode :: BAD_REQUEST ,
5054 } ;
5155 ( status, sentry_event_id, Json ( error) ) . into_response ( )
@@ -114,6 +118,10 @@ pub async fn handler(
114118 . await ?
115119 . ok_or ( RouteError :: UserNotFound ) ?;
116120
121+ if actor_user. deactivated_at . is_some ( ) {
122+ return Err ( RouteError :: UserDeactivated ) ;
123+ }
124+
117125 let scope: Scope = params. scope . parse ( ) . map_err ( |_| RouteError :: InvalidScope ) ?;
118126
119127 // Create the personal session
You can’t perform that action at this time.
0 commit comments