deanlearner Posted April 16, 2010 Share Posted April 16, 2010 Hi everyone, I have made a system that uses XML as a basis for directory permissions <?xml version="1.0" encoding="ISO-8859-1"?> <permissions group_a="1" group_b="1"> <folder1 group_b="0" /> <folder2> <page1.php group_a="0" /> <page2.php group_b="0" /> </folder2> </permissions> Basically, the system looks for the most relevant permission possible, so if a user of group_a requests /folder2/page1.php access will be denied because access is set to "0". If a user of group_b requests /folder2/page1.php access will be granted because the most relevant permission is set in the head xml tag. This file will be accessed via the system with every request made by a user so I am wondering if it's worth it, or possible to store it in memory? I know multiple files will be accessed with every request, but as I know this one will always occur I am wondering about loading it into memory. Also, while hoping people are actually able to understand the security scheme I've used above, would anyone suggest an alternative? Would storing permissions for each possible request URI (ignoring $_GET stuff) in a database be a better solution? There will be about 20-30 users of this system at any one time (so again, maybe I am threating about something thats not important at all). Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/198731-loading-xml-into-memory-possible-worth-it/ Share on other sites More sharing options...
salathe Posted April 16, 2010 Share Posted April 16, 2010 I am wondering if it's worth it ... to store it in memory? Most likely, not. Until you run proper profiling on the system, to discover and analyse weak points, it is usually not worth worrying about "small" things (of which this is one). If at some point the loading and parsing of this file becomes troublesome, you will (or should have in place the resources to) know it and the answer would be obvious. Of course, there are various ways to get that data loaded cross-request in a less memory/time/etc. way which you might like to discuss here regardless of whether it is really necessary at this stage, if you really want to? Quote Link to comment https://forums.phpfreaks.com/topic/198731-loading-xml-into-memory-possible-worth-it/#findComment-1042979 Share on other sites More sharing options...
deanlearner Posted April 16, 2010 Author Share Posted April 16, 2010 Thanks for the reply Salathe, based on the fact you think this is a small issue, I'll stick with my current system for now but might post again regarding finding an alternative solution at a later date, but hopefully it won't come need to come to that! Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/198731-loading-xml-into-memory-possible-worth-it/#findComment-1042989 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.