back to suggestions
Thoughts about inheritance
with actual code
suppose that I have six kind of people using my website
- superadmin (no comment)
- users admins : able to add/delete users, change their roles...
- articles admins : able to moderate article incoming, delete...
- photos admins : able to moderate photos incoming, delete...
- users : able to comment and see the web stuff
- guests : only able to see the web stuff
I want to keep those roles separated because not so much people can
- be good at reading like an article admin
AND
- be good at seeing like an photo admin
But suppose I know this old man who is very good at reading AND seeing. I would like to grant him article admins AND photos admins rights.
Now what can I do ?
create a new role 'articles_and_photos_admin'
this is easy if we have only two basic admin roles like in the example
but this is not if we have three:
- articles_and_photos_and_music_admin
- articles_and_photos_admin
- articles_and_music_admin
- photos_and_music_admin
- articles_admin
- photos_admin
- music_admin
because not everybody can 'be good at reading' AND 'be good at seeing' AND 'be good at listening'
another important point : hierarchy in its current state does not allow us to manage those 3 roles (we have a tree here)
apm --+--ap--+--a
| |
| +--p
|
+--am--+--a
| |
| +--m
|
+--pm--+--p
|
+--m
now if users can have several roles, we can simply have
$config['FAL_roles_and_ancestors'] = array(
'users_admin' => array('superadmin'),
'articles_admin' => array('superadmin'),
'photos_admin' => array('superadmin'),
'music_admin' => array('superadmin'),
'users' => array(
'users_admin','articles_admin','photos_admin','music_admin','superadmin'
),
);
you can see Iksander's comment here.
