Example #1
0
        //private readonly Dictionary<String, Object> _UserDefined;

        ///// <summary>
        ///// A lookup for user-defined properties.
        ///// </summary>
        //public Dictionary<String, Object> UserDefined
        //{
        //    get
        //    {
        //        return _UserDefined;
        //    }
        //}

        #endregion

        #endregion

        #region Constructor(s)

        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="Source">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="Target">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public MiniEdge(TSource Source,
                        TEdge EdgeLabel,
                        TTarget Target,
                        PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                        DateTime?Created          = null)
        {
            #region Initial checks

            if (System.Collections.Generic.EqualityComparer <TSource> .Default.Equals(Source, default))
            {
                throw new ArgumentNullException(nameof(Source), "The given source must not be null!");
            }

            if (System.Collections.Generic.EqualityComparer <TTarget> .Default.Equals(Target, default))
            {
                throw new ArgumentNullException(nameof(Target), "The given target must not be null!");
            }

            #endregion

            this.Source       = Source;
            this.Target       = Target;
            this.EdgeLabel    = EdgeLabel;
            this.PrivacyLevel = PrivacyLevel;
            this.Created      = Created ?? Timestamp.Now;
            //   this._UserDefined   = new Dictionary<String, Object>();
        }
Example #2
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        /// <param name="Embedded">Whether this data is embedded into another data structure.</param>
        /// <param name="IncludeCryptoHash">Include the crypto hash value of this object.</param>
        public JObject ToJSON(Boolean Embedded          = false,
                              InfoStatus ExpandTags     = InfoStatus.ShowIdOnly,
                              Boolean IncludeCryptoHash = false)

        => JSONObject.Create(

            new JProperty("@id", Id.ToString()),

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            Text.IsNeitherNullNorEmpty()
                       ? new JProperty("text", Text.ToJSON())
                       : null,

            new JProperty("publicationDate", PublicationDate.ToIso8601()),

            GeoLocation.HasValue
                       ? new JProperty("geoLocation", GeoLocation.ToJSON())
                       : null,

            Tags.Any()
                       ? new JProperty("tags", Tags.SafeSelect(tag => tag.ToJSON(ExpandTags)))
                       : null,

            PrivacyLevel.ToJSON(),

            Signatures.Any()
                       ? new JProperty("signatures", new JArray(Signatures.SafeSelect(signature => signature.ToJSON(Embedded: true))))
                       : null

            );
 public PrivacySettings(PrivacyLevel level, bool onlyLoggedIn, bool publicize)
 {
     Level = level;
     OnlyLoggedIn = onlyLoggedIn;
     Publicized = publicize;
     this.Id = Guid.NewGuid();
 }
Example #4
0
 public static Context CheckSystemPrivacy(this Context ctx, SystemId target, PrivacyLevel level)
 {
     if (level.CanAccess(ctx.DirectLookupContextFor(target)))
     {
         return(ctx);
     }
     throw Errors.LookupNotAllowed;
 }
Example #5
0
 public static GroupPatch WithAllPrivacy(this GroupPatch member, PrivacyLevel level)
 {
     foreach (var subject in Enum.GetValues(typeof(GroupPrivacySubject)))
     {
         member.WithPrivacy((GroupPrivacySubject)subject, level);
     }
     return(member);
 }
Example #6
0
 public static SystemPatch WithAllPrivacy(this SystemPatch system, PrivacyLevel level)
 {
     foreach (var subject in Enum.GetValues(typeof(SystemPrivacySubject)))
     {
         WithPrivacy(system, (SystemPrivacySubject)subject, level);
     }
     return(system);
 }
Example #7
0
 public Context CheckSystemPrivacy(PKSystem target, PrivacyLevel level)
 {
     if (level.CanAccess(LookupContextFor(target)))
     {
         return(this);
     }
     throw new PKError("You do not have permission to access this information.");
 }
Example #8
0
        public static Task <IGuildEvent> CreateEventAsync(this IGuild guild,
                                                          string name, DateTimeOffset startsAt, GuildEventTargetType targetType,
                                                          PrivacyLevel privacyLevel   = PrivacyLevel.GuildOnly, Action <CreateGuildEventActionProperties> action = null,
                                                          IRestRequestOptions options = null, CancellationToken cancellationToken = default)
        {
            var client = guild.GetRestClient();

            return(client.CreateGuildEventAsync(guild.Id, name, startsAt, targetType, privacyLevel, action, options, cancellationToken));
        }
Example #9
0
 public RoomProperties(AccountId accountCreatingRoom, string roomName, RoomId roomId, RoomType roomType, PrivacyLevel privacyLevel, XmlNode roomItemsXml)
 {
     mAccountCreatingRoom = accountCreatingRoom;
     mRoomName            = roomName;
     mRoomId       = roomId;
     mRoomType     = roomType;
     mPrivacyLevel = privacyLevel;
     mRoomItemsXml = roomItemsXml;
 }
        private PrivacyLevel BuildPrivacyLevel()
        {
            var privacyLevel = new PrivacyLevel();

            privacyLevel.Id          = 1;
            privacyLevel.Description = "test description";
            privacyLevel.Notes       = "notes for doctype";

            return(privacyLevel);
        }
Example #11
0
        public static void SetPrivacy(PartyId partyId, PrivacyLevel privacyLevel)
        {
            if (!BnetParty.IsInParty(partyId))
            {
                return;
            }
            EntityId partyId2 = partyId.ToEntityId();

            BattleNet.SetPartyPrivacy(partyId2, (int)privacyLevel);
        }
Example #12
0
        public void Awake()
        {
            Logger.LogInfo("Starting Discord Rich Presence...");
            UnityNamedPipe pipe = new UnityNamedPipe();

            //Get your own clientid!
            client = new DiscordRpcClient("597759084187484160", -1, null, true, pipe);
            client.RegisterUriScheme("632360");
            client.Initialize();

            currentPrivacyLevel = PrivacyLevel.Join;

            //Subscribe to join events
            client.Subscribe(DiscordRPC.EventType.Join);
            client.Subscribe(DiscordRPC.EventType.JoinRequest);

            //Setup Discord client hooks
            client.OnReady         += Client_OnReady;
            client.OnError         += Client_OnError;
            client.OnJoinRequested += Client_OnJoinRequested;
            client.OnJoin          += Client_OnJoin;

            //When a new stage is entered, update stats
            On.RoR2.Run.BeginStage += Run_BeginStage;

            //Used to handle additional potential presence changes
            SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;

            //Handle Presence when Lobby is created
            On.RoR2.SteamworksLobbyManager.OnLobbyCreated += SteamworksLobbyManager_OnLobbyCreated;
            //Handle Presence when Lobby is joined
            On.RoR2.SteamworksLobbyManager.OnLobbyJoined += SteamworksLobbyManager_OnLobbyJoined;
            //Handle Presence when Lobby changes
            On.RoR2.SteamworksLobbyManager.OnLobbyChanged += SteamworksLobbyManager_OnLobbyChanged;
            //Handle Presence when user leaves Lobby
            On.RoR2.SteamworksLobbyManager.LeaveLobby += SteamworksLobbyManager_LeaveLobby;

            On.RoR2.CharacterBody.Awake += CharacterBody_Awake;


            //Messy work around for hiding timer in Discord when user pauses the game during a run
            RoR2Application.onPauseStartGlobal += OnGamePaused;

            //When the user un-pauses, re-broadcast run time to Discord
            RoR2Application.onPauseEndGlobal += OnGameUnPaused;

            //Register console commands
            On.RoR2.Console.Awake += (orig, self) =>
            {
                CommandHelper.RegisterCommands(self);
                orig(self);
            };
        }
Example #13
0
        public void CreateRoomForClient(Message receivedMessage, Guid senderId)
        {
            string       roomName     = CheckType.TryAssignType <string>(receivedMessage.Data[0]);
            RoomType     roomType     = CheckType.TryAssignType <RoomType>(receivedMessage.Data[1]);
            PrivacyLevel privacyLevel = CheckType.TryAssignType <PrivacyLevel>(receivedMessage.Data[2]);

            CreateNewRoomInDatabase(senderId, roomName, roomType, privacyLevel,
                                    delegate(IServerDistributedRoom newRoom)
            {
                SendClientAvailableRooms(senderId, MessageSubType.ClientOwnedRooms);
            }
                                    );
        }
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="User">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="Organization">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public User2OrganizationEdge(User User,
                                     User2OrganizationEdgeLabel EdgeLabel,
                                     Organization Organization,
                                     PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                                     DateTime?Created          = null)

            : base(User ?? throw new ArgumentNullException(nameof(User), "The given user must not be null!"),
                   EdgeLabel,
                   Organization ?? throw new ArgumentNullException(nameof(Organization), "The given organization must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
Example #15
0
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="User">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="UserGroup">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public User2UserGroupEdge(User User,
                                  User2UserGroupEdgeLabel EdgeLabel,
                                  UserGroup UserGroup,
                                  PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                                  DateTime?Created          = null)

            : base(User ?? throw new ArgumentNullException(nameof(User), "The given user must not be null!"),
                   EdgeLabel,
                   UserGroup ?? throw new ArgumentNullException(nameof(UserGroup), "The given user group must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="GroupA">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="GroupB">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public UserGroup2UserGroupEdge(UserGroup GroupA,
                                       UserGroup2UserGroupEdgeLabel EdgeLabel,
                                       UserGroup GroupB,
                                       PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                                       DateTime?Created          = null)

            : base(GroupA ?? throw new ArgumentNullException(nameof(GroupA), "The given user group must not be null!"),
                   EdgeLabel,
                   GroupB ?? throw new ArgumentNullException(nameof(GroupB), "The given user group must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="ChargeBoxA">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="ChargeBoxB">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public ChargeBox2ChargeBoxEdge(ChargeBox ChargeBoxA,
                                       ChargeBox2ChargeBoxEdgeLabel EdgeLabel,
                                       ChargeBox ChargeBoxB,
                                       PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                                       DateTime?Created          = null)

            : base(ChargeBoxA ?? throw new ArgumentNullException(nameof(ChargeBoxA), "The given charge box must not be null!"),
                   EdgeLabel,
                   ChargeBoxB ?? throw new ArgumentNullException(nameof(ChargeBoxB), "The given charge box must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
Example #18
0
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="OrganizationA">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="OrganizationB">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public Organization2OrganizationEdge(Organization OrganizationA,
                                             Organization2OrganizationEdgeLabel EdgeLabel,
                                             Organization OrganizationB,
                                             PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                                             DateTime?Created          = null)

            : base(OrganizationA ?? throw new ArgumentNullException(nameof(OrganizationA), "The given user must not be null!"),
                   EdgeLabel,
                   OrganizationB ?? throw new ArgumentNullException(nameof(OrganizationB), "The given user must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
Example #19
0
        /// <summary>
        /// Create a new miniedge.
        /// </summary>
        /// <param name="UserA">The source of the edge.</param>
        /// <param name="EdgeLabel">The label of the edge.</param>
        /// <param name="UserB">The target of the edge</param>
        /// <param name="PrivacyLevel">The level of privacy of this edge.</param>
        /// <param name="Created">The creation timestamp of the miniedge.</param>
        public User2UserEdge(User UserA,
                             User2UserEdgeTypes EdgeLabel,
                             User UserB,
                             PrivacyLevel PrivacyLevel = PrivacyLevel.Private,
                             DateTime?Created          = null)

            : base(UserA ?? throw new ArgumentNullException(nameof(UserA), "The given user must not be null!"),
                   EdgeLabel,
                   UserB ?? throw new ArgumentNullException(nameof(UserB), "The given user must not be null!"),
                   PrivacyLevel,
                   Created)

        {
        }
Example #20
0
        public static bool TryGet <T>(this PrivacyLevel level, LookupContext ctx, T input, out T output, T absentValue = default)
        {
            output = default;
            if (!level.CanAccess(ctx))
            {
                return(false);
            }
            if (Equals(input, absentValue))
            {
                return(false);
            }

            output = input;
            return(true);
        }
Example #21
0
        public static Boolean TryParsePrivacyLevel(String Value,
                                                   out PrivacyLevel PrivacyLevel)
        {
            if (Value.IsNullOrEmpty())
            {
                PrivacyLevel = PrivacyLevel.Private;
                return(false);
            }

            switch (Value.Trim().ToLower())
            {
            case "world":
                PrivacyLevel = PrivacyLevel.World;
                return(true);

            case "public":
                PrivacyLevel = PrivacyLevel.Public;
                return(true);

            case "gdpr":
                PrivacyLevel = PrivacyLevel.GDPR;
                return(true);

            case "country":
                PrivacyLevel = PrivacyLevel.Country;
                return(true);

            case "city":
                PrivacyLevel = PrivacyLevel.City;
                return(true);

            case "friends":
                PrivacyLevel = PrivacyLevel.Friends;
                return(true);

            case "internal":
                PrivacyLevel = PrivacyLevel.Internal;
                return(true);

            case "private":
                PrivacyLevel = PrivacyLevel.Private;
                return(true);

            default:
                PrivacyLevel = PrivacyLevel.Private;
                return(false);
            }
        }
Example #22
0
        public async void PrivacyLevelInfo_TestGetChild()
        {
            const int ID_VALUE = 999;

            var emailType = new PrivacyLevel()
            {
                Id          = ID_VALUE,
                Description = "Test email type",
                Notes       = "email type notes"
            };

            var emailTypeInfo = await PrivacyLevelInfo.GetPrivacyLevelInfo(emailType);

            Assert.NotNull(emailTypeInfo);
            Assert.IsType <PrivacyLevelInfo>(emailTypeInfo);
            Assert.Equal(ID_VALUE, emailTypeInfo.Id);
        }
Example #23
0
        public static RoomProperties GetRoomPropertiesFromXml(XmlNode roomXmlNode, IServerAssetRepository serverAssetRepository)
        {
            RoomProperties returnRoomProperties = null;
            string         roomName             = string.Empty;
            RoomId         roomId       = null;
            RoomType       roomType     = RoomType.Default;
            List <ItemId>  itemIds      = new List <ItemId>();
            AccountId      accountId    = null;
            PrivacyLevel   privacyLevel = PrivacyLevel.Default;

            //if we find a room that's marked as Enabled="true", load it into memory
            if (RoomXmlUtil.GetRoomInfoFromRoomXmlNode(roomXmlNode, out accountId, out privacyLevel, out roomName, out roomId, out roomType, out itemIds))
            {
                XmlDocument roomItemsDnaXml = serverAssetRepository.GetXmlDna(itemIds);
                returnRoomProperties = new RoomProperties(accountId, roomName, roomId, roomType, privacyLevel, roomItemsDnaXml);
            }
            return(returnRoomProperties);
        }
Example #24
0
        /// <summary>
        /// Get the hashcode of this object.
        /// </summary>
        public override Int32 GetHashCode()
        {
            // Overflow is fine, just wrap
            // http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode

            unchecked
            {
                var hash = 17;

                hash = hash * 23 + Source.GetHashCode();
                hash = hash * 23 + EdgeLabel.GetHashCode();
                hash = hash * 23 + Target.GetHashCode();
                hash = hash * 23 + PrivacyLevel.GetHashCode();
                hash = hash * 23 + Created.GetHashCode();

                return(hash);
            }
        }
Example #25
0
        public static void CreateParty(PartyType partyType, PrivacyLevel privacyLevel, byte[] creatorBlob, BnetParty.CreateSuccessCallback successCallback)
        {
            string @string = EnumUtils.GetString <PartyType>(partyType);

            if (BnetParty.s_pendingPartyCreates != null && BnetParty.s_pendingPartyCreates.ContainsKey(partyType))
            {
                BnetParty.RaisePartyError(true, @string, BnetFeatureEvent.Party_Create_Callback, "CreateParty: Already creating party of type {0}", new object[]
                {
                    partyType
                });
                return;
            }
            if (BnetParty.s_pendingPartyCreates == null)
            {
                BnetParty.s_pendingPartyCreates = new Map <PartyType, BnetParty.CreateSuccessCallback>();
            }
            BnetParty.s_pendingPartyCreates[partyType] = successCallback;
            BattleNet.CreateParty(@string, (int)privacyLevel, creatorBlob);
        }
Example #26
0
        public ServerDistributedRoom(ServerObjectRepository serverObjectRepository, AccountId roomOwnerAccountId, string roomName, RoomType roomType, RoomId roomId, PrivacyLevel privacyLevel, DistributedObjectId doId, XmlNode itemIdXml)
            : base(serverObjectRepository, doId)
        {
            mRoomPopulation = new List <Guid>();
            mRoomName       = roomName;
            mRoomType       = roomType;
            mRoomId         = roomId;
            mObjectType     = DistributedObjectTypes.Room;
            mPrivacyLevel   = privacyLevel;

            mObjectData.Add(mObjectType); //0
            mObjectData.Add("mock path");
            mObjectData.Add(mRoomType);
            mObjectData.Add(itemIdXml.OuterXml);
            mObjectData.Add(mPrivacyLevel);
            mObjectData.Add(mRoomName); //5
            mObjectData.Add(mRoomPopulation.Count);
            mObjectData.Add(mRoomId);
            mObjectData.Add(roomOwnerAccountId);
        }
    public static void CreateParty(PartyType partyType, PrivacyLevel privacyLevel, CreateSuccessCallback successCallback)
    {
        string szPartyType = EnumUtils.GetString <PartyType>(partyType);

        if ((s_pendingPartyCreates != null) && s_pendingPartyCreates.ContainsKey(partyType))
        {
            object[] args = new object[] { partyType };
            RaisePartyError(true, szPartyType, BnetFeatureEvent.Party_Create_Callback, 6, "CreateParty: Already creating party of type {0}", args);
        }
        else
        {
            if (s_pendingPartyCreates == null)
            {
                s_pendingPartyCreates = new Map <PartyType, CreateSuccessCallback>();
            }
            s_pendingPartyCreates[partyType] = successCallback;
            byte[] creatorBlob = ProtobufUtil.ToByteArray(BnetEntityId.CreateForNet(BnetPresenceMgr.Get().GetMyGameAccountId()));
            BattleNet.CreateParty(szPartyType, (int)privacyLevel, creatorBlob);
        }
    }
Example #28
0
        /// <summary>
        /// This is called after PaymentItemsCommand response.  If the command was for purchasing a room, add a room
        /// to the users room database.
        /// </summary>
        /// <param name="responseData"></param>
        /// <returns></returns>
        public bool RoomItemPurchaseCallback(XmlNodeList purchasedRoomItems, Guid sessionId)
        {
            bool roomCreated = false;

            //flag this to true if we find item elements in the xmlNodeList
            roomCreated = (purchasedRoomItems.Count > 0);
            foreach (XmlElement item in purchasedRoomItems)
            {
                Console.WriteLine("Room Addition purchase complete for sessionId: " + sessionId.ToString() + ".  Adding room to database.");
                string       roomName     = item.GetAttribute("buttonName");
                RoomType     roomType     = RoomType.GreenScreenRoom;
                PrivacyLevel privacyLevel = PrivacyLevel.Private;
                CreateNewRoomInDatabase(sessionId, roomName, roomType, privacyLevel,
                                        delegate(IServerDistributedRoom newRoom)
                {
                    SendClientAvailableRooms(sessionId, MessageSubType.ClientOwnedRooms);
                });
            }

            return(roomCreated);
        }
Example #29
0
        public static JProperty ToJSON(this PrivacyLevel Privacylevel,
                                       String PropertyKey = "privacyLevel")
        {
            if (PropertyKey != null)
            {
                PropertyKey = PropertyKey.Trim();
            }

            if (PropertyKey.IsNullOrEmpty())
            {
                PropertyKey = "privacyLevel";
            }

            switch (Privacylevel)
            {
            case PrivacyLevel.Private:
                return(new JProperty(PropertyKey, "private"));

            case PrivacyLevel.Internal:
                return(new JProperty(PropertyKey, "internal"));

            case PrivacyLevel.Public:
                return(new JProperty(PropertyKey, "public"));

            case PrivacyLevel.Friends:
                return(new JProperty(PropertyKey, "friends"));

            case PrivacyLevel.City:
                return(new JProperty(PropertyKey, "city"));

            case PrivacyLevel.Country:
                return(new JProperty(PropertyKey, "country"));

            case PrivacyLevel.GDPR:
                return(new JProperty(PropertyKey, "GDPR"));

            default:
                return(new JProperty(PropertyKey, "world"));
            }
        }
Example #30
0
        private static void SetPrivacyLevel(ConCommandArgs args)
        {
            if (args.Count != 1)
            {
                Debug.LogError("discord_privacy_level accepts 1 parameter only");
                return;
            }

            int  level;
            bool parse = int.TryParse(args[0], out level);

            if (parse)
            {
                currentPrivacyLevel = (PrivacyLevel)level;                 //unchecked
            }
            else
            {
                Debug.LogError("Failed to parse arg - must be integer value");
            }

            //TODO - if disabled, clear presence
        }
Example #31
0
        protected virtual void CreateNewRoomInDatabaseService(Guid sessionId, string roomName, PrivacyLevel privacyLevel, System.Action <XmlDocument> createRoomFinishedCallback)
        {
            ServerAccount account = mServerStateMachine.SessionManager.GetServerAccountFromSessionId(sessionId);

            RoomManagerServiceAPI.CreateNewRoomService(account.AccountId, roomName, privacyLevel, createRoomFinishedCallback);
        }
 public static PrivacySettings Create(PrivacyLevel level, bool onlyLoggedIn, bool publicize, Guid owner, ICollection<GroupDto> groups = null)
 {
     switch (level)
     {
         case PrivacyLevel.Public:
             return new PublicPrivacy(onlyLoggedIn, publicize);
         case PrivacyLevel.Hidden:
             return new HiddenPrivacy(onlyLoggedIn, publicize);
         case PrivacyLevel.Group:
             return new GroupPrivacy(onlyLoggedIn, publicize, groups);
         case PrivacyLevel.Private:
             return new PrivatePrivacy(onlyLoggedIn, publicize, owner);
         default:
             return new PublicPrivacy(onlyLoggedIn, publicize);
     }
 }