public static string GetTarget_AccountID(string memberEmailAddress)
        {
            string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(memberEmailAddress);
            TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);

            return(emailRoot.Account.ID);
        }
 public static void ExecuteMethod_UpdateAccountToEmails(TBRAccountRoot accountRoot, TBREmailRoot[] accountEmails)
 {
     foreach(var accountEmail in accountEmails)
     {
         accountEmail.Account = accountRoot.Account;
     }
 }
示例#3
0
        public static void Execute(UnlinkEmailAddressParameters parameters)
        {
            PrepareParameters(parameters);
            TBRAccountRoot AccountRootBeforeGroupRemoval = UnlinkEmailAddressImplementation.GetTarget_AccountRootBeforeGroupRemoval(parameters.AccountID);
            string         EmailAddress = UnlinkEmailAddressImplementation.GetTarget_EmailAddress(parameters.AccountContainerBeforeGroupRemoval, parameters.EmailAddressID);

            TBRGroupRoot[] GroupRoots = UnlinkEmailAddressImplementation.GetTarget_GroupRoots(AccountRootBeforeGroupRemoval, EmailAddress);
            UnlinkEmailAddressImplementation.ExecuteMethod_RemoveGroupMemberships(EmailAddress, GroupRoots);
            TBRAccountRoot AccountRootAfterGroupRemoval = UnlinkEmailAddressImplementation.GetTarget_AccountRootAfterGroupRemoval(parameters.AccountID);
            TBREmailRoot   EmailRoot = UnlinkEmailAddressImplementation.GetTarget_EmailRoot(EmailAddress);

            UnlinkEmailAddressImplementation.ExecuteMethod_RemoveEmailFromAccountRoot(AccountRootAfterGroupRemoval, EmailAddress);
            UnlinkEmailAddressImplementation.ExecuteMethod_DeleteEmailRoot(EmailRoot);
            UnlinkEmailAddressImplementation.ExecuteMethod_StoreObjects(AccountRootAfterGroupRemoval);

            {     // Local block to allow local naming
                UpdateAccountContainerFromAccountRootParameters operationParameters = UnlinkEmailAddressImplementation.UpdateAccountContainer_GetParameters(parameters.AccountID);
                UpdateAccountContainerFromAccountRoot.Execute(operationParameters);
            }     // Local block closing

            {     // Local block to allow local naming
                UpdateAccountRootToReferencesParameters operationParameters = UnlinkEmailAddressImplementation.UpdateAccountRoot_GetParameters(parameters.AccountID);
                UpdateAccountRootToReferences.Execute(operationParameters);
            }     // Local block closing
        }
 public static void ExecuteMethod_StoreObjects(TBRLoginRoot[] accountLogins, TBREmailRoot[] accountEmails)
 {
     foreach (var acctLogin in accountLogins)
         acctLogin.StoreInformation();
     foreach (var acctEmail in accountEmails)
         acctEmail.StoreInformation();
 }
示例#5
0
        public static void DeleteEntireGroup(string groupID)
        {
            TBRGroupRoot groupToDelete = TBRGroupRoot.RetrieveFromDefaultLocation(groupID);

            throw new NotImplementedException("Call remove group membership for each member, then delete to recycle bin");
            foreach (var member in groupToDelete.Group.Roles.CollectionContent)
            {
                string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(member.Email.EmailAddress);
                TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
                emailRoot.Account.GroupRoleCollection.CollectionContent.RemoveAll(
                    candidate => candidate.GroupID == groupToDelete.Group.ID);
                emailRoot.Account.StoreAccountToRoot();
            }
            StorageSupport.DeleteInformationObject(groupToDelete);
            //WorkerSupport.DeleteEntireOwner(groupToDelete.Group);
            OperationRequest operationRequest = new OperationRequest
            {
                DeleteEntireOwner = DeleteEntireOwnerOperation.CreateDefault()
            };

            operationRequest.DeleteEntireOwner.ContainerName  = groupToDelete.Group.ContainerName;
            operationRequest.DeleteEntireOwner.LocationPrefix = groupToDelete.Group.LocationPrefix;
            //QueueSupport.PutToOperationQueue(operationRequest);
            InformationContext.Current.AddOperationRequestToFinalizingQueue(operationRequest);
        }
        public static AccountRootAndContainer[] GetTarget_AccountRootsAndContainers(TBRGroupRoot groupRoot)
        {
            var accountIDs = groupRoot.Group.Roles.CollectionContent.
                             Select(role => role.Email.EmailAddress).
                             Select(email =>
            {
                string emailRootID     = TBREmailRoot.GetIDFromEmailAddress(email);
                TBREmailRoot emailRoot = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
                return(emailRoot.Account.ID);
            }).Distinct().ToArray();
            List <AccountRootAndContainer> result = new List <AccountRootAndContainer>();

            foreach (var accountID in accountIDs)
            {
                TBRAccountRoot          accountRoot             = TBRAccountRoot.RetrieveFromDefaultLocation(accountID);
                VirtualOwner            owner                   = new VirtualOwner("acc", accountID);
                var                     accountContainer        = AccountContainer.RetrieveFromOwnerContent(owner, "default");
                AccountRootAndContainer accountRootAndContainer = new AccountRootAndContainer
                {
                    AccountContainer = accountContainer,
                    AccountRoot      = accountRoot
                };
                result.Add(accountRootAndContainer);
            }
            return(result.ToArray());
        }
        public static TBREmailRoot[] GetTarget_AccountEmails(TBRAccountRoot accountRoot)
        {
            var emailIDs   = accountRoot.Account.Emails.CollectionContent.Select(email => TBREmailRoot.GetIDFromEmailAddress(email.EmailAddress));
            var emailRoots =
                emailIDs.Select(emailAddress => TBREmailRoot.RetrieveFromDefaultLocation(emailAddress)).ToArray();

            return(emailRoots);
        }
示例#8
0
        public static TBAccount GetAccountFromEmail(string emailAddress)
        {
            string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(emailAddress);
            TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
            TBAccount    account     = emailRoot.Account;

            return(account);
        }
        public static string GetTarget_AccountIDOfEmail(string memberEmailAddress, string accountID)
        {
            if (memberEmailAddress != null && accountID != null)
            {
                throw new NotSupportedException("Both parameters email and accountID not supported");
            }
            if (accountID != null)
            {
                return(accountID);
            }
            string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(memberEmailAddress);
            TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);

            return(emailRoot.Account.ID);
        }
示例#10
0
        private void GroupInvitationHandling()
        {
            string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(EmailAddress);
            TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);

            if (emailRoot == null)
            {
                throw new NotSupportedException("Email used for group invitation is not yet registered to the system");
            }
            VirtualOwner owner   = VirtualOwner.FigureOwner(this);
            string       groupID = owner.LocationPrefix;

            InviteMemberToGroup.Execute(new InviteMemberToGroupParameters
            {
                GroupID = groupID, MemberEmailAddress = EmailAddress
            });
        }
示例#11
0
        private void AddAccountEmailAddressHandling()
        {
            string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(EmailAddress);
            TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);

            if (emailRoot != null)
            {
                throw new InvalidDataException("Email address '" + EmailAddress + "' is already registered to the system.");
            }
            string            accountID       = StorageSupport.GetAccountIDFromLocation(this.RelativeLocation);
            VirtualOwner      owner           = VirtualOwner.FigureOwner(this);
            TBEmailValidation emailValidation = new TBEmailValidation();

            emailValidation.AccountID  = accountID;
            emailValidation.Email      = this.EmailAddress;
            emailValidation.ValidUntil = DateTime.UtcNow.AddMinutes(30);
            StorageSupport.StoreInformation(emailValidation);
            EmailSupport.SendValidationEmail(emailValidation);
        }
 public static void ExecuteMethod_DeleteEmailRoot(TBREmailRoot emailRoot)
 {
     emailRoot.DeleteInformationObject();
 }
 public static void ExecuteMethod_DeleteEmailRoot(TBREmailRoot emailRoot)
 {
     emailRoot.DeleteInformationObject();
 }
        public static TBREmailRoot GetTarget_EmailRoot(string emailAddress)
        {
            var emailRootID = TBREmailRoot.GetIDFromEmailAddress(emailAddress);

            return(TBREmailRoot.RetrieveFromDefaultLocation(emailRootID));
        }
示例#15
0
        public void StoreAccountToRoot()
        {
            TBRAccountRoot accountRoot = TBRAccountRoot.RetrieveFromDefaultLocation(this.ID);

            accountRoot.Account = this;
            StorageSupport.StoreInformation(accountRoot);
            return;

            AccountContainer accountContainer = AccountContainer.RetrieveFromOwnerContent(this, "default");

            if (accountContainer == null)
            {
                accountContainer = AccountContainer.CreateDefault();
                accountContainer.SetLocationAsOwnerContent(this, "default");
            }
            accountContainer.AccountModule.Security.LoginInfoCollection = this.Logins;
            foreach (var loginItem in this.Logins.CollectionContent)
            {
                string       loginRootID = TBLoginInfo.GetLoginIDFromLoginURL(loginItem.OpenIDUrl);
                TBRLoginRoot loginRoot   = TBRLoginRoot.RetrieveFromDefaultLocation(loginRootID);
                loginRoot.Account = this;
                StorageSupport.StoreInformation(loginRoot);
                // TODO: Remove invalid group role logins at this stage
                foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent.Where(grpRole => TBCollaboratorRole.IsRoleStatusValidMember(grpRole.RoleStatus)))
                {
                    string            loginGroupID   = TBRLoginGroupRoot.GetLoginGroupID(groupRoleItem.GroupID, loginRootID);
                    TBRLoginGroupRoot loginGroupRoot = TBRLoginGroupRoot.RetrieveFromDefaultLocation(loginGroupID);
                    if (loginGroupRoot == null)
                    {
                        loginGroupRoot    = TBRLoginGroupRoot.CreateDefault();
                        loginGroupRoot.ID = loginGroupID;
                        loginGroupRoot.UpdateRelativeLocationFromID();
                    }
                    loginGroupRoot.GroupID = groupRoleItem.GroupID;
                    loginGroupRoot.Role    = groupRoleItem.GroupRole;
                    StorageSupport.StoreInformation(loginGroupRoot);
                }
            }
            //accountContainer.AccountModule.Security.EmailCollection = this.Emails;
            foreach (var emailItem in this.Emails.CollectionContent)
            {
                string       emailRootID = TBREmailRoot.GetIDFromEmailAddress(emailItem.EmailAddress);
                TBREmailRoot emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID);
                if (emailRoot == null)
                {
                    emailRoot    = TBREmailRoot.CreateDefault();
                    emailRoot.ID = emailRootID;
                    emailRoot.UpdateRelativeLocationFromID();
                }
                emailRoot.Account = this;
                StorageSupport.StoreInformation(emailRoot);
            }
            var roles = accountContainer.AccountModule.Roles;

            roles.MemberInGroups.CollectionContent.Clear();
            roles.ModeratorInGroups.CollectionContent.Clear();
            foreach (var groupRoleItem in this.GroupRoleCollection.CollectionContent)
            {
                var groupRoot = TBRGroupRoot.RetrieveFromDefaultLocation(groupRoleItem.GroupID);
                if (groupRoot == null)
                {
                    continue;
                }
                var grp = groupRoot.Group;
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              groupRoot.ID);
                reference.Title = grp.Title + " - " + groupRoleItem.GroupRole;
                switch (groupRoleItem.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    roles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    roles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            StorageSupport.StoreInformation(accountContainer);
        }