Wednesday, October 29, 2014

Conditionally set defaultConnectionName

i may be overthinking this - if so, tell me.

i'd like to have a DB config for the general website user, who needs only SELECT for most things, and a separate config for the Admin side of the site where other privileges are needed.

Since defaultConnectionName returns which config to use, is it possible to determine within that method which connection i need to return (Admin or basic) for the Table?

My original thought was to somehow set the connection i need in the controllers, as i have an abstract AdminController that the Admin-level controllers inherit from. But i don't see any obvious reference to doing this in the documentation. So i thought a conditional return from [Table]::defaultConnectionName might work.

If it's better just to use a single higher-privilege account for all purposes, so be it. Just thought i'd ask. :)

Thanks.
-joe t.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: