diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-27 16:38:29 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-27 16:38:29 +0000 |
| commit | 842edd5a75a091a58ea04b6f4d2ef7cf0b0285ea (patch) | |
| tree | 8f892842b4cc5aff3c4c7b1879548a5235579725 /src | |
| parent | 7e4b709b70003901735ac673ec8c0823e70494eb (diff) | |
Fix undefined `user`
Diffstat (limited to 'src')
| -rw-r--r-- | src/routes/model.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/routes/model.rs b/src/routes/model.rs index 7a98c56..9242c31 100644 --- a/src/routes/model.rs +++ b/src/routes/model.rs @@ -138,6 +138,8 @@ async fn upload_model_file( } }; + let user = User::find_by_id(claims.user_id).await?; + if !(model.author_id() == user.id || user.is_staff.unwrap()) { return Err(AppError::Unauthorized); } |
