Forum Moderators: coopster
$curdirtwo = substr(strrchr(getcwd(), '/'), 1); //gets current directory
if ($curdirtwo == 'somedirectory') {
$oktoworkindir = array( "billtest","johntest","joetest","janetest"); //users who are allowed to work in this dir
}
It gets the current directory. If the current directory is equal to a defined directory, a set of users are allowed to be in there working. Works fine. However, I'd have to do a whole bunch of 'else ifs' for each directory that has a unique set of users to work in it... Seems cumbersome and long. Is there any way to accomplish this that I'm not thinking of? Thanks for any input!
//gets current directory
//queries for directory id (from db)
//queries database for user information and group membership
//queries database for privilege to current directory id
//if/else statement to allow or disallow current user.
Create an access control system in terms of users, groups and permissions (similar to WordPress's role based permissions)
Users are assigned to groups and the groups have permissions. In effect the permissions are not user based but group based.
If the user belongs to that group he inherits all the groups permissions.
The users can belong to many groups, which can have many users
and
a permission can be given to multiple groups and each group can have multiple permissions.
For more information try searching for "role based access system in php".
HTH