mirror of
https://github.com/DorkSquadRR/DorkNet.git
synced 2026-10-26 07:28:45 -07:00
fix: 2023 room instances, publish, role permissions and co-owner invites
- Room roles: list the creator as Creator (255), not CoOwner (30). The
client takes the local role from the Roles list and only lets a player
edit roles below their own (Creator excepted), so the creator could not
edit Co-Owner and Creator permissions. Enforce the role ladder on the
server (RoomRoleRules), let invitees accept (PUT roles/{me} role=30) and
reject (PUT roles/{me}/invite role=0), send message Types 62/60/61, and
push RoomUpdate after every role change.
- Permissions: persist PUT subrooms/{sub}/permissions cells in a new
RoomRolePermissions table, serve them from photon_access_token (plus a
roomserver/ twin) and push PhotonAccessToken to the sub-room.
- Publish: player-owned rooms are never IsRRO on the wire; the client
hides Publish and every room setting for an RRO.
- Sub-rooms: wire SubRoomId = OrderIndex + 1 (the client will not load a
sub-room with id 0), new rooms always get a named Home sub-room, and a
startup pass repairs rooms without one.
- Instance browser: per-room Redis presence index, live players only,
private instances for the people allowed in, real IsFull.
- Room/sub-room settings: creator or accepted co-owner everywhere.
This commit is contained in:
@@ -164,6 +164,11 @@ public static class DatabaseBootstrap
|
||||
await roomService.ApplyCanonicalOverridesAsync(http, imagesDir);
|
||||
}
|
||||
|
||||
// Every non-dorm room needs a real, named entry sub-room (see
|
||||
// RoomService.RepairRoomScenesAsync). Runs after the seed and the
|
||||
// canonical overrides so it only fills what they left missing.
|
||||
await roomService.RepairRoomScenesAsync();
|
||||
|
||||
// Seed default curated playlists, club category tags, store catalog.
|
||||
// Must run after SeedAsync so they can reference RR-Originals.
|
||||
var playlistService = scope.ServiceProvider.GetRequiredService<PlaylistService>();
|
||||
@@ -899,6 +904,23 @@ public static class DatabaseBootstrap
|
||||
);
|
||||
""",
|
||||
@"CREATE UNIQUE INDEX IF NOT EXISTS ""IX_ClubAdditionalImages_ClubId_Slot"" ON ""ClubAdditionalImages"" (""ClubId"", ""Slot"");",
|
||||
// 2023 sub-room role-permission matrix
|
||||
// (PUT rooms/{id}/subrooms/{sub}/permissions → photon_access_token).
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS "RoomRolePermissions" (
|
||||
"Id" bigint GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
"RoomId" bigint NOT NULL,
|
||||
"SubRoomId" bigint NOT NULL,
|
||||
"Role" integer NOT NULL,
|
||||
"Permission" character varying(128) NOT NULL DEFAULT '',
|
||||
"Type" integer NOT NULL DEFAULT 0,
|
||||
"Override" boolean NOT NULL DEFAULT false,
|
||||
"Value" character varying(4096) NOT NULL DEFAULT '',
|
||||
"UpdatedByPlayerId" bigint NOT NULL DEFAULT 0,
|
||||
"UpdatedAt" timestamp with time zone NOT NULL DEFAULT now()
|
||||
);
|
||||
""",
|
||||
@"CREATE UNIQUE INDEX IF NOT EXISTS ""IX_RoomRolePermissions_RoomId_SubRoomId_Role_Permission"" ON ""RoomRolePermissions"" (""RoomId"", ""SubRoomId"", ""Role"", ""Permission"");",
|
||||
};
|
||||
foreach (var sql in statements)
|
||||
await db.Database.ExecuteSqlRawAsync(sql);
|
||||
@@ -976,6 +998,21 @@ public static class DatabaseBootstrap
|
||||
);
|
||||
""",
|
||||
@"CREATE UNIQUE INDEX IF NOT EXISTS ""IX_ClubAdditionalImages_ClubId_Slot"" ON ""ClubAdditionalImages"" (""ClubId"", ""Slot"");",
|
||||
"""
|
||||
CREATE TABLE IF NOT EXISTS "RoomRolePermissions" (
|
||||
"Id" INTEGER NOT NULL CONSTRAINT "PK_RoomRolePermissions" PRIMARY KEY AUTOINCREMENT,
|
||||
"RoomId" INTEGER NOT NULL,
|
||||
"SubRoomId" INTEGER NOT NULL,
|
||||
"Role" INTEGER NOT NULL,
|
||||
"Permission" TEXT NOT NULL DEFAULT '',
|
||||
"Type" INTEGER NOT NULL DEFAULT 0,
|
||||
"Override" INTEGER NOT NULL DEFAULT 0,
|
||||
"Value" TEXT NOT NULL DEFAULT '',
|
||||
"UpdatedByPlayerId" INTEGER NOT NULL DEFAULT 0,
|
||||
"UpdatedAt" TEXT NOT NULL DEFAULT ''
|
||||
);
|
||||
""",
|
||||
@"CREATE UNIQUE INDEX IF NOT EXISTS ""IX_RoomRolePermissions_RoomId_SubRoomId_Role_Permission"" ON ""RoomRolePermissions"" (""RoomId"", ""SubRoomId"", ""Role"", ""Permission"");",
|
||||
};
|
||||
// CREATE ... IF NOT EXISTS is already idempotent; a failure here is a
|
||||
// real problem and must fail startup.
|
||||
|
||||
Reference in New Issue
Block a user