Exemple #1
0
        public Guid Create(Guid adminId, string name, string description, bool bypassNameReservation = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            var id = Guid.NewGuid();
            var adminInfos = this.motherStorage.user.GetFullInfo(adminId);
            var accountInfo = new FullAccountInfo
                {
                    Id = id,
                    AccountInfo = new AccountInfo(name, description),
                    Users = new HashSet<Guid> { adminId },
                    AdminId = adminId,
                    FollowerOfLists = new HashSet<Guid>(),
                    MemberOfLists = new HashSet<Guid>()
                };

            if (this.idFromName.ContainsKey(name))
            {
                throw new AccountAlreadyExists();
            }

            this.infoFromId.Add(id, accountInfo);
            this.idFromName.Add(name, id);
            adminInfos.Accounts.Add(id);
            accountInfo.PersonalListId = this.motherStorage.list.CreateList(
                id, "personal list", "personal list", false, true);

            return id;
        }
Exemple #2
0
        public Guid Create(Guid adminId, string name, string description, bool bypassNameReservation = false)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            var id          = Guid.NewGuid();
            var adminInfos  = this.motherStorage.user.GetFullInfo(adminId);
            var accountInfo = new FullAccountInfo
            {
                Id          = id,
                AccountInfo = new AccountInfo(name, description),
                Users       = new HashSet <Guid> {
                    adminId
                },
                AdminId         = adminId,
                FollowerOfLists = new HashSet <Guid>(),
                MemberOfLists   = new HashSet <Guid>()
            };

            if (this.idFromName.ContainsKey(name))
            {
                throw new AccountAlreadyExists();
            }

            this.infoFromId.Add(id, accountInfo);
            this.idFromName.Add(name, id);
            adminInfos.Accounts.Add(id);
            accountInfo.PersonalListId = this.motherStorage.list.CreateList(
                id, "personal list", "personal list", false, true);

            return(id);
        }
Exemple #3
0
        public FullAccountInfo GetFullAccountInfo(Account acc)
        {
            var info = new FullAccountInfo
            {
                Name          = acc.Name,
                IsActive      = acc.IsActive,
                StatusUntil   = acc.StatusUntil,
                AccountId     = acc.AccountId,
                EmailAddress  = acc.EmailAddress,
                ClientId      = acc.ClientId,
                RoleGroupName = acc.RoleGroupName,
                LastIP        = acc.LastIP,
                LastLogin     = acc.LastLogin,
                Locale        = acc.Locale
            };

            return(info);
        }