Cool ideas Chris! (I say while cleaning out my inbox)

On Mon, Nov 29, 2010 at 5:11 PM, Chris Blackwell <[email protected]> wrote:
> I was thinking about this the other day, running through a few scenarios.
> One use case that crossed my mind was what if you needed a way for admins to
> restart the app, but only via the apps control panel, so the action could be
> logged. And if that admin's access is revoked you shouldn't have to change
> the apps config to alter the reload key/password.
> So just for fun, i hacked together a little solution.
> function onApplicationStart(any event) {
> var mg = event.getModelGlue();
> var cfg = mg.getBean("modelglue.modelGlueConfiguration");
> var pwd = hash(createuuid());  // generate a random password
> cfg.setReloadPassword(pwd);    // overwrite the password in the cfg bean
> mg.configuration.reloadpassword = pwd;  // overwrite the password cached
> inside MG
> }
> function reloadApp(any event) {
> var mg = event.getModelGlue();
> // get the key and password from the config
> var key = mg.getConfigSetting("ReloadKey");
> var pwd = mg.getConfigSetting("ReloadPassword");
> // set the key=password pair into the event
> event.setValue(key, pwd);
> // redirect to a page, appending key=password to the url
> event.forward("page.index", key);
> }
> So when the app first starts the password is randomized so it can not be
> guessed.  you then call the reloadApp controller function from a secured
> event-handler which will reload the app, causing onApplicationStart to be
> called and reset the password so it can't be reused.
> Its pretty slick IMHO, apart from having to dip into the MG object to update
> the password. I'm not sure why the values are cached as a struct in the MG
> object rather than a reference to config bean, probably just for speed..
> just how it is.
> To restrict access via ip in my MG onApplicationStart i'd set the reloadKey
> & password into the application scope, then in my
> Application.onRequestStart() i'd check to see if they were present, correct
> and then check the requests ip address. If the key/password don't match, or
> the ip is invalid i'd structDelete() them from the url before the request
> hits MG.
> Cheers, Chris
>
>
> On 29 November 2010 21:06, Dan Wilson <[email protected]> wrote:
>>
>> Look into using the built in event: modelglue.onApplicationStart
>> As far as restricting the reloading, you may have to do this inside of
>> your application specific index.cfm page. At the moment, Model Glue doesn't
>> look at IP addresses.
>>
>> DW
>>
>>
>>
>> On Mon, Nov 29, 2010 at 4:02 PM, Ryan Stille <[email protected]>
>> wrote:
>>>
>>> I would like to have some kind of popup or jquery notification when my
>>> app is reinitted.  It just confirms for me that I did enter the right
>>> reloadKey and everything worked as I expected.
>>>
>>> What is a good way to do this?  Is there some built in event that gets
>>> run when an reinit happens?  Alternatively I could add some code in
>>> the onRequestStart event that looks for URL.init and sees if its true,
>>> but that doesn't work if the reloadKey value has been changed.
>>>
>>> Also I'd like to add a restriction so that only certain IPs can cause
>>> the app to reinit.  I assume this code would go in the same place as
>>> my notification code.
>>>
>>> Any ideas? Thanks.
>>>
>>> --
>>> Model-Glue Sites:
>>> Home Page: http://www.model-glue.com
>>> Documentation: http://docs.model-glue.com
>>> Bug Tracker: http://bugs.model-glue.com
>>> Blog: http://www.model-glue.com/blog
>>>
>>> You received this message because you are subscribed to the Google
>>> Groups "model-glue" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/model-glue?hl=en
>>
>>
>> --
>> Plutarch - "The mind is not a vessel to be filled but a fire to be
>> kindled."
>>
>> --
>> Model-Glue Sites:
>> Home Page: http://www.model-glue.com
>> Documentation: http://docs.model-glue.com
>> Bug Tracker: http://bugs.model-glue.com
>> Blog: http://www.model-glue.com/blog
>>
>> You received this message because you are subscribed to the Google
>> Groups "model-glue" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/model-glue?hl=en
>
> --
> Model-Glue Sites:
> Home Page: http://www.model-glue.com
> Documentation: http://docs.model-glue.com
> Bug Tracker: http://bugs.model-glue.com
> Blog: http://www.model-glue.com/blog
>
> You received this message because you are subscribed to the Google
> Groups "model-glue" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/model-glue?hl=en



-- 
Bob Silverberg
www.silverwareconsulting.com

-- 
Model-Glue Sites:
Home Page: http://www.model-glue.com
Documentation: http://docs.model-glue.com
Bug Tracker: http://bugs.model-glue.com
Blog: http://www.model-glue.com/blog

You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

Reply via email to