You've already forked AstralRinth
forked from didirus/AstralRinth
Fix lint failures
This commit is contained in:
@@ -440,14 +440,14 @@ pub async fn user_delete(
|
|||||||
let user = get_user_from_headers(req.headers(), &**pool).await?;
|
let user = get_user_from_headers(req.headers(), &**pool).await?;
|
||||||
let id = info.into_inner().0;
|
let id = info.into_inner().0;
|
||||||
|
|
||||||
if !user.role.is_mod() && user.id == user.id {
|
if !user.role.is_mod() && user.id != id {
|
||||||
return Err(ApiError::CustomAuthenticationError(
|
return Err(ApiError::CustomAuthenticationError(
|
||||||
"You do not have permission to delete this user!".to_string(),
|
"You do not have permission to delete this user!".to_string(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let result;
|
let result;
|
||||||
if removal_type.removal_type == "full".to_string() {
|
if &*removal_type.removal_type == "full" {
|
||||||
result = crate::database::models::User::remove_full(id.into(), &**pool)
|
result = crate::database::models::User::remove_full(id.into(), &**pool)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
.map_err(|e| ApiError::DatabaseError(e.into()))?;
|
||||||
|
|||||||
@@ -181,17 +181,14 @@ async fn version_create_inner(
|
|||||||
|
|
||||||
// Check that the user creating this version is a team member
|
// Check that the user creating this version is a team member
|
||||||
// of the mod the version is being added to.
|
// of the mod the version is being added to.
|
||||||
let team_member = models::TeamMember::get_from_user_id_mod(
|
let team_member =
|
||||||
mod_id.into(),
|
models::TeamMember::get_from_user_id_mod(mod_id, user.id.into(), &mut *transaction)
|
||||||
user.id.into(),
|
.await?
|
||||||
&mut *transaction,
|
.ok_or_else(|| {
|
||||||
)
|
CreateError::CustomAuthenticationError(
|
||||||
.await?
|
"You don't have permission to upload this version!".to_string(),
|
||||||
.ok_or_else(|| {
|
)
|
||||||
CreateError::CustomAuthenticationError(
|
})?;
|
||||||
"You don't have permission to upload this version!".to_string(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
if !team_member
|
if !team_member
|
||||||
.permissions
|
.permissions
|
||||||
@@ -399,17 +396,14 @@ async fn upload_file_to_version_inner(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let team_member = models::TeamMember::get_from_user_id_version(
|
let team_member =
|
||||||
version_id.into(),
|
models::TeamMember::get_from_user_id_version(version_id, user.id.into(), &mut *transaction)
|
||||||
user.id.into(),
|
.await?
|
||||||
&mut *transaction,
|
.ok_or_else(|| {
|
||||||
)
|
CreateError::CustomAuthenticationError(
|
||||||
.await?
|
"You don't have permission to upload files to this version!".to_string(),
|
||||||
.ok_or_else(|| {
|
)
|
||||||
CreateError::CustomAuthenticationError(
|
})?;
|
||||||
"You don't have permission to upload files to this version!".to_string(),
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
|
|
||||||
if team_member
|
if team_member
|
||||||
.permissions
|
.permissions
|
||||||
|
|||||||
Reference in New Issue
Block a user