mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 18:18:39 +00:00
Prevent users from uploading over the amount of entitled slots
This commit is contained in:
parent
67fbd5ed5b
commit
f83bd15bc1
1 changed files with 5 additions and 0 deletions
|
@ -9,6 +9,7 @@ using LBPUnion.ProjectLighthouse.Serialization;
|
||||||
using LBPUnion.ProjectLighthouse.Types;
|
using LBPUnion.ProjectLighthouse.Types;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
using LBPUnion.ProjectLighthouse.Types.Profiles;
|
||||||
|
using LBPUnion.ProjectLighthouse.Types.Settings;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
@ -35,6 +36,8 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
User? user = await this.database.UserFromGameRequest(this.Request);
|
User? user = await this.database.UserFromGameRequest(this.Request);
|
||||||
if (user == null) return this.StatusCode(403, "");
|
if (user == null) return this.StatusCode(403, "");
|
||||||
|
|
||||||
|
if (user.UsedSlots >= ServerSettings.Instance.EntitledSlots) return this.BadRequest();
|
||||||
|
|
||||||
Slot? slot = await this.GetSlotFromBody();
|
Slot? slot = await this.GetSlotFromBody();
|
||||||
if (slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
|
if (slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
|
||||||
|
|
||||||
|
@ -74,6 +77,8 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
||||||
User user = userAndToken.Value.Item1;
|
User user = userAndToken.Value.Item1;
|
||||||
GameToken gameToken = userAndToken.Value.Item2;
|
GameToken gameToken = userAndToken.Value.Item2;
|
||||||
|
|
||||||
|
if (user.UsedSlots >= ServerSettings.Instance.EntitledSlots) return this.BadRequest();
|
||||||
|
|
||||||
Slot? slot = await this.GetSlotFromBody();
|
Slot? slot = await this.GetSlotFromBody();
|
||||||
if (slot?.Location == null) return this.BadRequest();
|
if (slot?.Location == null) return this.BadRequest();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue