Marc Weistroff wrote a really good article on using feature flags in a PHP application. The idea is that you can enable certain features for certain users only (for example enable feature X only for your beta testers).
Marc’s article is complete in itself, however I wanted to add a test to ensure that my controller action was truly inaccessible by another other than beta testers.
Here is the controller action and a corresponding test that ensures that a 404 is shown if the user is not a beta tester. I probably could have used the security firewall to do this or a JMS security annotation as an alternative to specifically writing the conditional in the controller action.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
Feel free to comment if you have any suggestions or improvements. Thanks to Marc for the original article.