Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More backend admin panel functionality #148

Merged
merged 17 commits into from
Jan 30, 2023
Merged

More backend admin panel functionality #148

merged 17 commits into from
Jan 30, 2023

Conversation

timiimit
Copy link
Owner

@timiimit timiimit commented Jan 26, 2023

  • Separate validation methods into ValidationHelper
  • Add admin ability to change another user's password
  • Add admin ability to add/edit cloudstorage system files which configure some in-game things for all logged in users
  • Add admin ability to delete account with less permissions (and delete potentially broken db entries from partially deleted accounts)


var account = await accountService.GetAccountAsync(EpicID.FromString(id));
if (account is null)
return NotFound(new ErrorResponse() { ErrorMessage = $"Failed to find account {id}" });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces.

return NotFound(new ErrorResponse() { ErrorMessage = $"Failed to find account {id}" });

if (account.Flags.HasFlag(AccountFlags.Moderator) || account.Flags.HasFlag(AccountFlags.Admin))
throw new UnauthorizedAccessException("Cannot change password of other admins or moderators");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces.

}

[HttpDelete("account/{id}")]
public async Task<IActionResult> DeleteAccountInfo(string id, [FromBody] bool? forceCheckBroken)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same security consideration as in ChangePassword.

}
else
{
if (admin.Account.Flags.HasFlag(AccountFlags.Admin) && account.Flags.HasFlag(AccountFlags.Admin))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces.


if (admin.Account.Flags.HasFlag(AccountFlags.Moderator) &&
(account.Flags.HasFlag(AccountFlags.Admin) || account.Flags.HasFlag(AccountFlags.Moderator)))
throw new UnauthorizedAccessException("Cannot delete account of other admin or moderator");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces.

"nigger", "hitler", "nazi"
};
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove one empty line.

@@ -23,15 +23,29 @@ public CloudStorageService(DatabaseContext dbContext)
cloudStorageCollection = dbContext.Database.GetCollection<CloudFile>("cloudstorage");
}

public async Task UpdateSystemfiles()
public async Task EnsureSystemfilesExistAsync()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SystemFiles

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i remember from ut's source that epic calls files in cloud storage Userfiles and Systemfiles with lowercase letters for file. that is why i had across whole codebase originally these with lowercase. i guess i can make them upper... Should also change all other instances of this too. as well as our code filenames.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't brake functionality of the game client, then it is better to change it everywhere because it was clearly non-conventional naming.

@Saibamen
Copy link
Collaborator

Related: #135

@timiimit timiimit merged commit 81a427c into master Jan 30, 2023
@timiimit timiimit deleted the more-admin-panel branch January 30, 2023 09:41
timiimit added a commit that referenced this pull request Jan 30, 2023
Fix runtime exception introduced by #148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants