private static bool AnyPermissions(this RegionRoleEntity regionRole, Func <RegionPermission, bool> pred) => new RegionPermission[] { regionRole.Permissions, regionRole.ChildPermissions, regionRole.ParentPermissions } .Any(pred);
public static bool IsWriter(this RegionRoleEntity regionRole) => regionRole.AnyPermissions(p => (p & RegionPermission.Writer) != 0);
public static bool HasPermission(this RegionRoleEntity regionRole, RegionPermission permission) => regionRole.AnyPermissions(p => p.HasFlag(permission));