mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 23:48:45 -07:00
feat: Update room properties to support cloning for RRO/AG base rooms; adjust moderation logic for cloning permissions
This commit is contained in:
@@ -158,9 +158,12 @@ public sealed class RoomSave2023Tests : IClassFixture<DorkNetServerFactory>
|
|||||||
CreatorPlayerId = owner.PlayerId,
|
CreatorPlayerId = owner.PlayerId,
|
||||||
ImageName = RoomService.DefaultRoomImageName,
|
ImageName = RoomService.DefaultRoomImageName,
|
||||||
Accessibility = 1,
|
Accessibility = 1,
|
||||||
IsAGRoom = false,
|
// An RRO/AG base room (RecCenter-like): CloningAllowed is
|
||||||
|
// false and it's owned by the system, yet the base-room
|
||||||
|
// picker must still be able to clone it.
|
||||||
|
IsAGRoom = true,
|
||||||
IsDormRoom = false,
|
IsDormRoom = false,
|
||||||
CloningAllowed = true,
|
CloningAllowed = false,
|
||||||
CurrentDataBlobName = $"room_{roomId}_v1.dat",
|
CurrentDataBlobName = $"room_{roomId}_v1.dat",
|
||||||
});
|
});
|
||||||
db.RoomScenes.Add(new RoomSceneEntity
|
db.RoomScenes.Add(new RoomSceneEntity
|
||||||
|
|||||||
@@ -972,7 +972,11 @@ public class RoomsModerationController(DorkNetDbContext db) : ControllerBase
|
|||||||
var newName = await ReadCloneNameAsync();
|
var newName = await ReadCloneNameAsync();
|
||||||
var source = await db.Rooms.FirstOrDefaultAsync(r => r.Id == roomId);
|
var source = await db.Rooms.FirstOrDefaultAsync(r => r.Id == roomId);
|
||||||
if (source is null) return NotFound();
|
if (source is null) return NotFound();
|
||||||
if (!source.CloningAllowed && source.CreatorPlayerId != Me)
|
// RRO/AG rooms are first-party templates meant to be cloned — the
|
||||||
|
// room-creation "base room" picker starts a new build by cloning one
|
||||||
|
// (RecCenter, MakerRoom, …). Their seed rows have CloningAllowed=false,
|
||||||
|
// so without the IsAGRoom exception every base-room create 403s.
|
||||||
|
if (!source.CloningAllowed && !source.IsAGRoom && source.CreatorPlayerId != Me)
|
||||||
return Forbid();
|
return Forbid();
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(newName))
|
if (string.IsNullOrWhiteSpace(newName))
|
||||||
|
|||||||
Reference in New Issue
Block a user