Granting permission to individual fields in MySQL -
i have mysql database , have several tables in it. one, of course, users table storing username , passwords (which has rest of information). tables in schema, want able grant users (or groups) permission individual fields. maybe example help:
there;'s table called accounts. in table, user fills out (and keeps date) data company (name, address, poc, etc). want have fields attached table read users, such lastpaymentdate (can't have them changing that!). further, among users, permissions differ. example, admin/superuser can change name , address of company, standard users should not.
i'm thinking might need done making several views table, 1 each level of permission (group). i'm relatively new mysql, don't know if best way. can see lookup table says fields allowed view/edit.
my initial thought include in comments (or name of field) value 0-5, , user have permission level (0-can't see; 1-read only; 2-read-write; 3-(not used); 4-(not used); 5-edit/delete field itself.
any suggestions? views? lookup table determine fields display? again, it'd not whole table, each column within table.
you can grant rights individual columns user, using code:
grant select (col1), insert (col1,col2) on mydb.mytbl 'someuser'@'somehost';
example taken here:
http://dev.mysql.com/doc/refman/5.1/en/grant.html
also there no support groups of users or sql roles (which groups of privileges) in mysql.
Comments
Post a Comment