/// <summary> /// Creates an ACL with with read permissions set to client or server, /// and write permissions to server, for all components that exist on the given entity. /// </summary> public static Acl GenerateServerAuthoritativeAcl(Worker.Entity entity) { var acl = Acl.Build().SetReadAccess(CommonRequirementSets.PhysicsOrVisual); foreach (var componentId in entity.GetComponentIds()) { acl.SetWriteAccess(componentId, CommonRequirementSets.PhysicsOnly); } return(acl); }
/// <summary> /// Creates an ACL with read permissions set to client or server, /// and write permissions to a client worker with the given worker ID, for all /// components that exist on the given entity. /// </summary> public static Acl GenerateClientAuthoritativeAcl(Worker.Entity entity, string workerId) { if (string.IsNullOrEmpty(workerId)) { throw new ArgumentNullException("workerId"); } var acl = Acl.Build().SetReadAccess(CommonRequirementSets.PhysicsOrVisual); var specificClient = CommonRequirementSets.SpecificClientOnly(workerId); foreach (var componentId in entity.GetComponentIds()) { acl.SetWriteAccess(componentId, specificClient); } return(acl); }