mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-24 06:01:30 +00:00
Implement basic privacy settings (#392)
* Add ability for clients to submit and retrieve privacy settings data * Make slot pages and user pages respect user's privacy settings * Prevent webhook from publishing new levels if user's privacy settings disallow it * Hide levels/profiles from respective pages depending on privacy settings * Apply suggestions from review
This commit is contained in:
parent
5a3439e634
commit
2ab1e72037
12 changed files with 210 additions and 12 deletions
|
@ -28,6 +28,28 @@ public class UserPage : BaseLayout
|
|||
this.ProfileUser = await this.Database.Users.FirstOrDefaultAsync(u => u.UserId == userId);
|
||||
if (this.ProfileUser == null) return this.NotFound();
|
||||
|
||||
// Determine if user can view profile according to profileUser's privacy settings
|
||||
if (this.User == null || !this.User.IsAdmin)
|
||||
{
|
||||
switch (this.ProfileUser.ProfileVisibility)
|
||||
{
|
||||
case PrivacyType.PSN:
|
||||
{
|
||||
if (this.User != null) return this.NotFound();
|
||||
|
||||
break;
|
||||
}
|
||||
case PrivacyType.Game:
|
||||
{
|
||||
if (this.ProfileUser != this.User) return this.NotFound();
|
||||
|
||||
break;
|
||||
}
|
||||
case PrivacyType.All: break;
|
||||
default: throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
this.Photos = await this.Database.Photos.Include(p => p.Slot).OrderByDescending(p => p.Timestamp).Where(p => p.CreatorId == userId).Take(6).ToListAsync();
|
||||
if (this.CommentsEnabled)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue