Example #1
0
 private void SaveState(string origState, string state)
 {
     if (_nodb)
     {
         State = state;
     }
     else
     {
         ZbuKeyValueStore.SetValue("Zbu.Yol.Manager." + _name + ".State", origState, state);
     }
 }
Example #2
0
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            base.ApplicationStarted(umbracoApplication, applicationContext);

            LogHelper.Info <YolApplication>("Configure.");

            // ensure we have the key-value store
            UmbracoApplicationBase.ApplicationStarted += (sender, args) => ZbuKeyValueStore.EnsureInstalled(applicationContext);

            // - cannot run on .ApplicationStarted because it plays with authentication/authorization
            // and therefore wants to have access to the current request's cookie and such
            // - cannot register it here either because it would add it to only one HttpApplication
            // and therefore cause inconsitencies - and a crypting exception in ASP.NET pipeline
            // - so in order to properly register it... have to use a module.

            //umbracoApplication.PostAuthorizeRequest += ExecuteInitialized;
        }
Example #3
0
        internal void Execute(HttpApplication umbracoApplication, ApplicationContext applicationContext)
        {
            if (umbracoApplication == null)
            {
                throw new ArgumentNullException("umbracoApplication");
            }
            if (applicationContext == null)
            {
                throw new ArgumentNullException("applicationContext");
            }

            // temp for compat
            if (!_nodb)
            {
                var state = ZbuKeyValueStore.GetValue("Zbu.Yol.Manager." + _name + ".State");
                if (string.IsNullOrWhiteSpace(state) && !string.IsNullOrWhiteSpace(_statePath))
                {
                    try
                    {
                        state = File.ReadAllText(_statePath);
                    }
                    catch (Exception)
                    {
                        state = null;
                    }
                    if (!string.IsNullOrWhiteSpace(state))
                    {
                        LogHelper.Info <YolManager>("Copying state from file to database.");
                        ZbuKeyValueStore.SetValue("Zbu.Yol.Manager." + _name + ".State", state);
                    }
                }
            }

            ValidateTransitions();

            // impersonate and run - in a using() block to ensure we terminate properly impersonation,
            // whatever happens when executing transitions.
            using (Security.Impersonate(umbracoApplication, applicationContext, _login))
            {
                ExecuteInternal();
            }
        }
Example #4
0
        private string GetState()
        {
            var state = _nodb ? State : ZbuKeyValueStore.GetValue("Zbu.Yol.Manager." + _name + ".State");

            return(state ?? string.Empty);
        }