Danny, >that is an interesting formulation which you gave. can you please comment >that with an example? would you create roles for users who are assigned the >same privileges and individual users who have multiple roles? In this fragment from an example, a role has a name (roles.name), eg 'payments clerk', a role is referenced in one or more rows in usecases (eg usecases.name='enter/edit payments'), so a role defines access to multiple jobs (the list of usecases rows which reference that roleID), a users.username must exist as a mysql.user.User, and a user may have multiple roles, whence the users-roles bridge table userroles. CREATE TABLE IF NOT EXISTS roles( roleID INT NOT NULL AUTO_INCREMENT, name CHAR(50) NOT NULL, roleRank SMALLINT NOT NULL, PRIMARY KEY (roleID), UNIQUE UC_roleRank (roleRank)); CREATE TABLE IF NOT EXISTS usecases( usecaseID INT NOT NULL AUTO_INCREMENT, name CHAR(50) NOT NULL, roleID INT NOT NULL, PRIMARY KEY (usecaseID), INDEX roleID (roleID)) ENGINE=InnoDb; CREATE TABLE IF NOT EXISTS users( userID INT NOT NULL AUTO_INCREMENT, username CHAR(16) NOT NULL, status SMALLINT NOT NULL, date_created DATETIME NOT NULL, date_edited DATETIME, entered_by INT, PRIMARY KEY (userID) ); CREATE TABLE IF NOT EXISTS userroles( userroleID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, roleID INT NOT NULL , userID INT NOT NULL , INDEX ur_roleID( roleID ) , INDEX ur_userID( userID ) , ); For more flexibility, define metaroles as collections of roles, and/or model the hierachy as nodes and edges. PB ----- Danny Stolle wrote: Peter, |
No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.7.2 - Release Date: 6/14/2005
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]