using System.ComponentModel.DataAnnotations; namespace DorkNet.Server.Data.Entities; /// /// One cell of a sub-room's role-permission matrix, as written by /// PUT rooms/{roomId}/subrooms/{subRoomId}/permissions and served back /// in the Permissions list of GET photon_access_token. /// /// The 2023-03-21 client models a cell as BNLPBMJJOMM /// (formatter RecNet.Runtime/HDOJMEBCAGP.txt, keys /// Permission / Role / Override / Type / /// Value): Permission and Value are strings, Role is the room-role /// enum OMMBGJMJJPN (None 0, Host 10, Moderator 20, CoOwner 30, /// TemporaryCoOwner 31, Creator 255), Type is FEOJFGECKGH /// (Bool 0, Int 1, StringList 2) and Override is a bool. /// /// The editor sends only the cells it changed (the room-permissions runtime /// builds a one-element BNLPBMJJOMM[] per edit, /// OMJKHJLFOCO.AFHJLBBFAGP.<LocalRequestModifyRolePermission>g__ChangeAndRefresh), /// so the write is an upsert per (room, sub-room, role, permission) and never /// a replace of the whole matrix. /// public class RoomRolePermissionEntity { public long Id { get; set; } public long RoomId { get; set; } /// The wire sub-room id from the route (the same value the room /// details advertise as SubRooms[].SubRoomId). public long SubRoomId { get; set; } /// Wire room-role value (OMMBGJMJJPN), e.g. 30 = CoOwner, 255 = Creator. public int Role { get; set; } /// The permission id exactly as the client sent it. [MaxLength(128)] public string Permission { get; set; } = string.Empty; /// FEOJFGECKGH: 0 = Bool, 1 = Int, 2 = StringList. public int Type { get; set; } public bool Override { get; set; } /// The value exactly as the client sent it (a string on the wire). [MaxLength(4096)] public string Value { get; set; } = string.Empty; public long UpdatedByPlayerId { get; set; } public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; }