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 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(
|
||||
"You do not have permission to delete this user!".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
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)
|
||||
.await
|
||||
.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
|
||||
// of the mod the version is being added to.
|
||||
let team_member = models::TeamMember::get_from_user_id_mod(
|
||||
mod_id.into(),
|
||||
user.id.into(),
|
||||
&mut *transaction,
|
||||
)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
CreateError::CustomAuthenticationError(
|
||||
"You don't have permission to upload this version!".to_string(),
|
||||
)
|
||||
})?;
|
||||
let team_member =
|
||||
models::TeamMember::get_from_user_id_mod(mod_id, user.id.into(), &mut *transaction)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
CreateError::CustomAuthenticationError(
|
||||
"You don't have permission to upload this version!".to_string(),
|
||||
)
|
||||
})?;
|
||||
|
||||
if !team_member
|
||||
.permissions
|
||||
@@ -399,17 +396,14 @@ async fn upload_file_to_version_inner(
|
||||
}
|
||||
};
|
||||
|
||||
let team_member = models::TeamMember::get_from_user_id_version(
|
||||
version_id.into(),
|
||||
user.id.into(),
|
||||
&mut *transaction,
|
||||
)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
CreateError::CustomAuthenticationError(
|
||||
"You don't have permission to upload files to this version!".to_string(),
|
||||
)
|
||||
})?;
|
||||
let team_member =
|
||||
models::TeamMember::get_from_user_id_version(version_id, user.id.into(), &mut *transaction)
|
||||
.await?
|
||||
.ok_or_else(|| {
|
||||
CreateError::CustomAuthenticationError(
|
||||
"You don't have permission to upload files to this version!".to_string(),
|
||||
)
|
||||
})?;
|
||||
|
||||
if team_member
|
||||
.permissions
|
||||
|
||||
Reference in New Issue
Block a user