예제 #1
0
        private static void PatchBlogsAndActivitiesSelectedCollections()
        {
            var ownerLocations = GetAllOwnerLocations();
            int totalCount     = ownerLocations.Length;
            int currIX         = 0;

            foreach (var ownerLocation in ownerLocations)
            {
                Console.WriteLine("Updating number " + (++currIX) + " out of " + totalCount);
                VirtualOwner owner = VirtualOwner.FigureOwner(ownerLocation);
                var          informationObjects = StorageSupport.CurrActiveContainer.
                                                  GetInformationObjects(ownerLocation, null,
                                                                        iObj =>
                                                                        iObj is Blog ||
                                                                        iObj is Activity).ToArray();
                foreach (var iObj in informationObjects)
                {
                    try
                    {
                        //StorageSupport.StoreInformationMasterFirst(iObj, owner, true);
                        StorageSupport.StoreInformationMasterFirst(iObj, owner, false);
                    }
                    catch (Exception ex)
                    {
                        bool letThrow = false;
                        if (letThrow)
                        {
                            throw;
                        }
                    }
                }
            }
            InformationContext.ProcessAndClearCurrent();
            InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
        }
예제 #2
0
 private static void RemoveMemberFromGroup(string groupID, string memberEmail)
 {
     AaltoGlobalImpact.OIP.RemoveMemberFromGroup.Execute(new RemoveMemberFromGroupParameters()
     {
         GroupID      = groupID,
         EmailAddress = memberEmail
     });
     InformationContext.ProcessAndClearCurrent();
     InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
 }
예제 #3
0
        private static void DoCustomCleanup(string groupLoc)
        {
            var defaultBlogToDelete = StorageSupport.CurrActiveContainer.
                                      GetInformationObjects(groupLoc, null,
                                                            item => item is Blog && item.RelativeLocation.EndsWith("/default")).ToArray();

            foreach (Blog blog in defaultBlogToDelete)
            {
                StorageSupport.DeleteInformationObject(blog);
            }
            InformationContext.ProcessAndClearCurrent();
            InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
        }
예제 #4
0
        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request = context.Request;

            WebSupport.InitializeContextStorage(context.Request);
            try
            {
                if (request.Path.StartsWith(AuthEmailValidation))
                {
                    HandleEmailValidation(context);
                }
            } finally
            {
                InformationContext.ProcessAndClearCurrent();
            }
        }
예제 #5
0
        private static void UpdateAccountAndGroups(string accountEmail)
        {
            string         emailID     = TBREmailRoot.GetIDFromEmailAddress(accountEmail);
            TBREmailRoot   emailRoot   = TBREmailRoot.RetrieveFromDefaultLocation(emailID);
            TBRAccountRoot accountRoot = TBRAccountRoot.RetrieveFromDefaultLocation(emailRoot.Account.ID);

            foreach (var groupRole in accountRoot.Account.GroupRoleCollection.CollectionContent)
            {
                TBRGroupRoot groupRoot = TBRGroupRoot.RetrieveFromDefaultLocation(groupRole.GroupID);
                RefreshAccountGroupMemberships.Execute(new RefreshAccountGroupMembershipsParameters
                {
                    AccountID = accountRoot.Account.ID,
                    GroupRoot = groupRoot
                });
                InformationContext.ProcessAndClearCurrent();
                InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
            }
        }
예제 #6
0
        public void ProcessRequest(HttpContext context)
        {
            string user            = context.User.Identity.Name;
            bool   isAuthenticated = String.IsNullOrEmpty(user) == false;
            var    request         = context.Request;
            var    response        = context.Response;

            WebSupport.InitializeContextStorage(context.Request);
            if (request.Path.StartsWith(AboutPrefix))
            {
                if (request.Path.EndsWith("/oip-layout-register.phtml"))
                {
                    ProcessDynamicRegisterRequest(request, response);
                }
                else
                {
                    HandleAboutGetRequest(context, request.Path);
                }
                return;
            }

            if (isAuthenticated == false)
            {
                return;
            }
            try
            {
                if (request.Path.StartsWith(AuthPersonalPrefix))
                {
                    HandlePersonalRequest(context);
                }
                else if (request.Path.StartsWith(AuthGroupPrefix))
                {
                    HandleGroupRequest(context);
                }
                else if (request.Path.StartsWith(AuthAccountPrefix))
                {
                    HandleAccountRequest(context);
                }
            } finally
            {
                InformationContext.ProcessAndClearCurrent();
            }
        }
예제 #7
0
        private static void ClearEmptyLocations()
        {
            var locations =
                GetAllInformationObjects(null, io => io is AddressAndLocation).Cast <AddressAndLocation>().ToArray();

            foreach (var loc in locations)
            {
                if (String.IsNullOrEmpty(loc.Location.LocationName))
                {
                    try
                    {
                        StorageSupport.DeleteInformationObject(loc);
                    } finally
                    {
                        InformationContext.ProcessAndClearCurrent();
                        InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
                    }
                }
            }
        }
예제 #8
0
        private static void InitBlogProfileAndIconOnce()
        {
            var blogs = GetAllInformationObjects(name => name.Contains("/Blog/"), io => io is Blog).Cast <Blog>().ToArray();

            try
            {
                foreach (var blog in blogs)
                {
                    blog.IconImage    = Image.CreateDefault();
                    blog.ProfileImage = Image.CreateDefault();
                    VirtualOwner owner = VirtualOwner.FigureOwner(blog);
                    blog.StoreInformationMasterFirst(owner, false);
                }
            }
            finally
            {
                InformationContext.ProcessAndClearCurrent();
                InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
            }
        }
예제 #9
0
        private static void UpdateAllImageFormatsCustomGroup()
        {
            //var images =
            //    GetAllInformationObjects(name => name.Contains("/Image/") && name.Contains("/9798daca-"), io => io is Image).Cast<Image>().ToArray();
            var ownerLocations = GetAllOwnerLocations();
            var ownerLocation  = ownerLocations.Where(loc => loc.Contains("/9798daca-")).SingleOrDefault();
            var images         = StorageSupport.CurrActiveContainer.GetInformationObjects(ownerLocation, name => name.Contains("/Image/"), io => io is Image).Cast <Image>().ToArray();
            int currImageIndex = 0;

            foreach (var image in images)
            {
                if (image.ImageData.ID.Contains("a25982") == false)
                {
                    continue;
                }
                image.ImageData.UpdateAdditionalMediaFormats();
                Console.WriteLine("Processed Image: " + ++currImageIndex + " out of " + images.Length);
            }
            InformationContext.ProcessAndClearCurrent();
            InformationContext.Current.InitializeCloudStorageAccess(Properties.Settings.Default.CurrentActiveContainerName);
        }