Security framework??
| From: | Steve | Date: | Fri, 21 Feb 2003 22:33:19 +0000 |
| Subject: | Security framework?? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8105@lists.php.net to get a copy of this message | ||
I suppose this is an extension to the thread the other day on how you use
smarty....
I have built a rather easy to use security (permissions) framework that I
use with my Smarty applications. I'm wondering if there are others out
there who would be interested in it, helping develop it, etc.
I'm sure it could use improvement, but thought I would see what others
think. I don't have it packaged up seperately, but would be willing to if
others wanted it.
Here is the basic way it works:
Each logged in user has an array of operations stored in their session's
operation array. This array of integers corresponds to system functions
that require permission to perform.
Then, all that is needed to check if a user has permission is a simple:
in the .php file:
if(@in_array(22,$_SESSION['operations'])) {
do database query for something cool;
}
in the .tpl file:
{if @in_array(22,$smarty.session.operations)}
show something cool;
{/if}
Now, it is important that the session information is secure (i use either a
secured directory or the database).
I use a MVC type of architecture. This type of system allows the
permissions to affect both the business logic (only execute the database
query if authorized) and the display logic (only show the link to the admin
page if logged in as admin group).
Anyone interested??
Steve