feat: Update room properties to support cloning for RRO/AG base rooms; adjust moderation logic for cloning permissions

This commit is contained in:
Alexa
2026-07-13 01:04:10 +03:00
parent 1152d9ba48
commit a2ffb5ef4b
2 changed files with 10 additions and 3 deletions
+5 -2
View File
@@ -158,9 +158,12 @@ public sealed class RoomSave2023Tests : IClassFixture<DorkNetServerFactory>
CreatorPlayerId = owner.PlayerId,
ImageName = RoomService.DefaultRoomImageName,
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,
CloningAllowed = true,
CloningAllowed = false,
CurrentDataBlobName = $"room_{roomId}_v1.dat",
});
db.RoomScenes.Add(new RoomSceneEntity
@@ -972,7 +972,11 @@ public class RoomsModerationController(DorkNetDbContext db) : ControllerBase
var newName = await ReadCloneNameAsync();
var source = await db.Rooms.FirstOrDefaultAsync(r => r.Id == roomId);
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();
if (string.IsNullOrWhiteSpace(newName))