Hi, after reading the good topics and contents on disaster to resolve the problems in recent years finally its my chance to signup :) and be the one to ask:

im working on a cms (not exactly) and stuck on menus and permissions. im wondering is there anyway the cms assign the menus by user permissions . for example user guest has this items (message, profile settings, article manager) but admin or root access has full items and this items will dynamically assigned to user.

im used this tutorial " a better login " and do some customize on it but not a chance to make what i wanted.

can you guys help me? Please

Hi,

You can do this by adding another column on your members database table. For example, we have a table member witht he following columns,

id --- username --- password --- other stuffs..

We can then modify the above to something like this

id -- username -- password --- privs -- other stuffs

You must then give a unique integer values for the privs for every member group.. for example 1 for regular member, 5 for the admin. This way you can easily sort out the content you want to show for specific group.

For the guest, all you have to do is validate that this person or browser is not logged in..

veedeoo thank you for reply let me check, ill be back

Member Avatar for diafol

Further to veedeeo's suggestion. Using cumulative bits is quite effective, eg reg = 1, mod = 2, supermod = 4, admin = 8. So your nav items can then have a permission field like 15 for everybody; 12 for just supermods and admins; 8 for admins only. You check for a bit with the '&' operator. Just an idea.

Or create an extra table user_roles the user role table will be "extended" with another table role_permissions
Think this is a clean concept. And role_pemissions will have something like ... module, controller or action if your application is MVC
And another field permission_level, for example view/edit .Hope you get the ideea.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.