How to generate a user role grid
Posted
by
Svish
on Stack Overflow
See other posts from Stack Overflow
or by Svish
Published on 2010-09-14T22:05:12Z
Indexed on
2010/12/23
2:54 UTC
Read the original article
Hit count: 260
I have the following tables:
users (id, username, ... )
roles (id, name)
roles_users (user_id, role_id)
I am wondering how I can create a nice sort of user-role-grid from that which an admin can use to administer roles to users in a clear way. What I would like is basically a table full of checkboxes sort of like this:
Login Editor Admin
Alice ¦ ¦ ¦
Bob ¦ ? ?
Carol ¦ ¦ ?
[Apply]
Generating the table isn't too much of a deal, but I am very unsure how to handle it when it comes to how to name all the checkboxes and especially how to read and update the database in a not too clumsy way. Does anyone have any good advice or pointers on how to do this in a mostly clean way?
I'm using the Kohana 3 framework, if there is anything there that can make this even easier, but I of course welcome any answer.
© Stack Overflow or respective owner