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());
        }
Ejemplo n.º 2
0
        public static AccountContainer GetTarget_AccountContainer(string accountID)
        {
            VirtualOwner owner            = new VirtualOwner("acc", accountID);
            var          accountContainer = AccountContainer.RetrieveFromOwnerContent(owner, "default");

            return(accountContainer);
        }
        public static void ExecuteMethod_UpdateAccountContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, GroupSummaryContainer groupSummaryContainer, TBRAccountRoot accountRoot, AccountContainer accountContainer)
        {
            string currRootId = groupRoot.Group.ID;
            string currReferenceUrlPrefix = String.Format("/auth/grp/{0}/", currRootId);
            var currRoles = accountContainer.AccountModule.Roles;
            currRoles.MemberInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));
            currRoles.ModeratorInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));

            foreach (var acctRole in accountRoot.Account.GroupRoleCollection.CollectionContent.Where(role => role.GroupID == currRootId))
            {
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              currRootId);
                reference.Title = currGroup.GroupName + " - " + acctRole.GroupRole;
                switch (acctRole.GroupRole.ToLower())
                {
                    case "initiator":
                    case "moderator":
                        currRoles.ModeratorInGroups.CollectionContent.Add(reference);
                        break;
                    case "collaborator":
                    case "viewer":
                        currRoles.MemberInGroups.CollectionContent.Add(reference);
                        break;
                }
            }
            currRoles.ModeratorInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            currRoles.MemberInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            // TODO: Update account summary
            //accountContainer.AccountSummary.GroupSummary
        }
Ejemplo n.º 4
0
        public static void Execute(UpdateAccountContainerFromAccountRootParameters parameters)
        {
            PrepareParameters(parameters);
            TBRAccountRoot   AccountRoot      = UpdateAccountContainerFromAccountRootImplementation.GetTarget_AccountRoot(parameters.AccountID);
            AccountContainer AccountContainer = UpdateAccountContainerFromAccountRootImplementation.GetTarget_AccountContainer(AccountRoot);

            UpdateAccountContainerFromAccountRootImplementation.ExecuteMethod_UpdateAccountContainerLogins(AccountRoot, AccountContainer);
            UpdateAccountContainerFromAccountRootImplementation.ExecuteMethod_UpdateAccountContainerEmails(AccountRoot, AccountContainer);
            UpdateAccountContainerFromAccountRootImplementation.ExecuteMethod_StoreObjects(AccountContainer);
        }
Ejemplo n.º 5
0
        public static AccountContainer GetTarget_AccountContainer(TBRAccountRoot accountRoot)
        {
            TBAccount        account          = accountRoot.Account;
            AccountContainer accountContainer = AccountContainer.RetrieveFromOwnerContent(account, "default");

            if (accountContainer == null)
            {
                accountContainer = AccountContainer.CreateDefault();
                accountContainer.SetLocationAsOwnerContent(account, "default");
            }
            return(accountContainer);
        }
Ejemplo n.º 6
0
        public static void Execute(UpdateAccountContainersGroupMembershipParameters parameters)
        {
            PrepareParameters(parameters);
            GroupContainer        GroupContainer        = UpdateAccountContainersGroupMembershipImplementation.GetTarget_GroupContainer(parameters.GroupRoot);
            Group                 Group                 = UpdateAccountContainersGroupMembershipImplementation.GetTarget_Group(GroupContainer);
            TBRAccountRoot        AccountRoot           = UpdateAccountContainersGroupMembershipImplementation.GetTarget_AccountRoot(parameters.AccountID);
            AccountContainer      AccountContainer      = UpdateAccountContainersGroupMembershipImplementation.GetTarget_AccountContainer(parameters.AccountID);
            GroupSummaryContainer GroupSummaryContainer = UpdateAccountContainersGroupMembershipImplementation.GetTarget_GroupSummaryContainer(parameters.AccountID);

            UpdateAccountContainersGroupMembershipImplementation.ExecuteMethod_UpdateGroupSummaryContainerMemberships(parameters.GroupRoot, Group, AccountRoot, GroupSummaryContainer);
            UpdateAccountContainersGroupMembershipImplementation.ExecuteMethod_UpdateAccountContainerMemberships(parameters.GroupRoot, Group, GroupSummaryContainer, AccountRoot, AccountContainer);
            UpdateAccountContainersGroupMembershipImplementation.ExecuteMethod_StoreObjects(AccountContainer, GroupSummaryContainer);
        }
Ejemplo n.º 7
0
 public static void ExecuteMethod_UpdateAccountContainerEmails(TBRAccountRoot accountRoot, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.EmailCollection = accountRoot.Account.Emails;
 }
 public static AccountContainer GetTarget_AccountContainerAfterGroupRemoval(AccountContainer accountContainerBeforeGroupRemoval)
 {
     return(AccountContainer.RetrieveAccountContainer(accountContainerBeforeGroupRemoval.RelativeLocation));
 }
Ejemplo n.º 9
0
 public static void ExecuteMethod_StoreObjects(AccountContainer accountContainer, GroupSummaryContainer groupSummaryContainer)
 {
     accountContainer.StoreInformation();
     groupSummaryContainer.StoreInformation();
 }
 public static void ExecuteMethod_ClearDefaultGroupValue(AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Profile.SimplifiedAccountGroupID = null;
     accountContainer.AccountModule.Profile.IsSimplifiedAccount = false;
 }
 public static string GetTarget_EmailAddress(AccountContainer accountContainer, string emailAddressID)
 {
     return
         accountContainer.AccountModule.Security.EmailCollection.CollectionContent.First(
             email => email.ID == emailAddressID).EmailAddress;
 }
Ejemplo n.º 12
0
        public static void ExecuteMethod_UpdateAccountContainerMemberships(TBRGroupRoot groupRoot, Group currGroup, GroupSummaryContainer groupSummaryContainer, TBRAccountRoot accountRoot, AccountContainer accountContainer)
        {
            string currRootId             = groupRoot.Group.ID;
            string currReferenceUrlPrefix = String.Format("/auth/grp/{0}/", currRootId);
            var    currRoles = accountContainer.AccountModule.Roles;

            currRoles.MemberInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));
            currRoles.ModeratorInGroups.CollectionContent.RemoveAll(
                refToInfo => refToInfo.URL.StartsWith(currReferenceUrlPrefix));


            foreach (var acctRole in accountRoot.Account.GroupRoleCollection.CollectionContent.Where(role => role.GroupID == currRootId))
            {
                ReferenceToInformation reference = ReferenceToInformation.CreateDefault();
                reference.URL = string.Format("/auth/grp/{0}/website/oip-group/oip-layout-groups-edit.phtml",
                                              currRootId);
                reference.Title = currGroup.GroupName + " - " + acctRole.GroupRole;
                switch (acctRole.GroupRole.ToLower())
                {
                case "initiator":
                case "moderator":
                    currRoles.ModeratorInGroups.CollectionContent.Add(reference);
                    break;

                case "collaborator":
                case "viewer":
                    currRoles.MemberInGroups.CollectionContent.Add(reference);
                    break;
                }
            }
            currRoles.ModeratorInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            currRoles.MemberInGroups.CollectionContent.Sort(ReferenceToInformation.CompareByReferenceTitle);
            // TODO: Update account summary
            //accountContainer.AccountSummary.GroupSummary
        }
Ejemplo n.º 13
0
 public static void ExecuteMethod_UpdateAccountContainerLogins(TBRAccountRoot accountRoot, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.LoginInfoCollection = accountRoot.Account.Logins;
 }
 public static AccountContainer GetTarget_AccountContainerAfterGroupRemoval(AccountContainer accountContainerBeforeGroupRemoval)
 {
     return AccountContainer.RetrieveAccountContainer(accountContainerBeforeGroupRemoval.RelativeLocation);
 }
 public static void ExecuteMethod_UpdateAccountContainerEmails(TBRAccountRoot accountRoot, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.EmailCollection = accountRoot.Account.Emails;
 }
 public static void ExecuteMethod_SetDefaultGroupValue(string groupId, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Profile.IsSimplifiedAccount = true;
     accountContainer.AccountModule.Profile.SimplifiedAccountGroupID = groupId;
 }
 public static void ExecuteMethod_RemoveEmailFromAccountContainer(string emailAddressID, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.EmailCollection.CollectionContent.RemoveAll(
         email => email.ID == emailAddressID);
 }
Ejemplo n.º 18
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);
        }
 public static void ExecuteMethod_StoreObject(AccountContainer accountContainer)
 {
     accountContainer.StoreInformation(InformationContext.CurrentOwner);
 }
 public static void ExecuteMethod_StoreObjects(AccountContainer accountContainer)
 {
     accountContainer.StoreInformation();
 }
 public static string GetTarget_EmailAddress(AccountContainer accountContainer, string emailAddressID)
 {
     return
         (accountContainer.AccountModule.Security.EmailCollection.CollectionContent.First(
              email => email.ID == emailAddressID).EmailAddress);
 }
 public static void ExecuteMethod_UpdateAccountContainerLogins(TBRAccountRoot accountRoot, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.LoginInfoCollection = accountRoot.Account.Logins;
 }
 public static void ExecuteMethod_RemoveEmailFromAccountContainer(string emailAddressID, AccountContainer accountContainer)
 {
     accountContainer.AccountModule.Security.EmailCollection.CollectionContent.RemoveAll(
         email => email.ID == emailAddressID);
 }