Tying the ACL to Controllers/Action in Zend Framework 1.5
I have been using the PHP application framework ‘Zend Framework’ a lot lately. The 1.5 release in particular is very feature packed.
Zend Framework has built in classes for creating Access Control Lists, or ACL’s. These ACL’s allow for roles (users / groups) and resources (any resource a role may want to access). They also have the concept of privileges, which are what action you want to take on the resource (e.g. add / delete / edit etc).
If you are making an MVC application your first thought is probably like mine. How can we make the ACL automatically apply to controllers and actions? The answer I have found is by writing a custom Controller Plugin. By using a Controller Plugin, we can automatically apply our ACL without having to add any ACL related code in our actual Controllers.
This allows us to do the following
- Assign our users to arbitrary groups
- Allow groups to access only specific Controller and Action combinations, e.g. /news/add
- Do all of this seamlessly. No code is needed in each controller class. Only one line is added to the boot strap
Get/Set Windows Mobile 5 date/time using C#.NET
When the backup battery on your Windows Mobile 5 device runs out, there’s a good chance the date/time settings of the device will revert to a time in the past. The devices I’m working on (The Symbol MC70), for example, revert back to a date in 2005.
This poses a problem in particular if you are designing an application for inexperienced users that will probably not even notice the change. When correct date settings are vital to your application, you have a recipe for disaster.
Luckily for me I picked this up very early in the testing phase, and without much help from the MSDN article on setting the devices date, I came up with a working solution. The code supplied on the MSDN site did not even compile due to large syntax errors. This was my first time using P/Invoke so there was a bit of trial and error. I got there in the end. Once again to possibly save someone else the headache, here is the working code for C#.NET CompactFramework 2.0. (more…)
Disable ‘Flight Mode’ using C#.NET CompactFramework on Windows Mobile 5 Devices
After spending way too long looking for what should be an easy answer, I ended up finding out a relatively easy way to do it. Rather than add to the cryptic nonsense replies you will find all over the web when trying to find a way to just turn flight mode off programmatically, I thought I’d make a blog and post the answer here.
Basically a nice gent called Alex Feinman has created a wrapper class. I found out this information at the OpenNetCF Forums. I have also uploaded the zip archive mentioned in that thread in case it is no longer available by the time you’re reading this.
In my code I have set up two very easy and simple basic functions. One to turn Flight Mode on, and one to turn it off. (more…)
