ok, the tables are now how you suggested... what's the next step? Any ideas?
On Jun 3, 7:40 pm, brian <[email protected]> wrote: > If your models/tables don't follow Cake's conventions, you're going to > cause yourself more trouble than it's worth. Given that Cake's ACL is > already a bear to work with, I strongly suggest you get the other > stuff in order first. > > On Wed, Jun 3, 2009 at 2:26 PM, Jenski <[email protected]> wrote: > > > Its not the model's I'm having problems with... > > it's the setting up of ACL - any ideas? > > > On Jun 3, 7:17 pm, brian <[email protected]> wrote: > >> You should clean up your table schema, first to get them in line with > >> Cake's conventions. It'll save you lots of headaches down the road. > > >> CREATE TABLE staffs ( > >> id int(11) NOT NULL auto_increment, > >> department_id int(11) default NULL, > >> logon_code char(10) NOT NULL, > >> forename char(50) NOT NULL, > >> surname char(50) NOT NULL, > >> PRIMARY KEY (id), > >> ) ; > > >> CREATE TABLE managers ( > >> id int(11) NOT NULL auto_increment, > >> logon_code varchar(15) NOT NULL, > >> department_id int(11) default NULL, > >> SystemAdmin tinyint(1) unsigned default NULL, > >> PRIMARY KEY (id) > >> ) ; > > >> CREATE TABLE departments ( > >> id int(11) default NULL, > >> sect_id varchar(50) default NULL, > >> subsect_id varchar(50) default NULL, > >> sect_name varchar(50) default NULL, > >> sect_abbr varchar(50) default NULL, > >> subsect_name varchar(50) default NULL, > >> PRIMARY KEY (id) > >> ) ; > > >> - all table names are lowercase, plural forms of the model > > >> - all PK are 'id int(11) NOT NULL auto_increment' > > >> - all FK are singular table name + '_id' (eg. department_id) > > >> If departments.sect_id is a FK to another table, it should be > >> section_id and the table named sections (assuming thatsect is short > >> for section). > > >> I guess staffs isn't the greatest name. Maybe members would be better. > > >> On Wed, Jun 3, 2009 at 6:26 AM, Jenski <[email protected]> wrote: > > >> > I have a database setup like this (I know it isnt the best setup but > >> > its out of my power to change it :-( > > >> > Basically there are 3 levels of users > >> > - Admin > >> > - Managers > >> > - Staff > > >> > Few notes: > >> > -Each member of staff belongs to department > >> > -If the Staffs logon_code appears in the manager table they are a > >> > Manager, otherwise they are a member of staff > >> > -If the staffs logon_code appears in the manager table and SystemAdmin > >> > is set to 1, they are Admin > > >> > How on earth do I go about setting ACL/Auth for this? Any ideas? > > >> > CREATE TABLE `tblStaff` ( > >> > `StaffID` int(11) NOT NULL auto_increment, > >> > `dept_id` varchar(5) default NULL, > >> > `logon_code` char(10) NOT NULL, > >> > `forename` char(50) NOT NULL, > >> > `surname` char(50) NOT NULL, > >> > PRIMARY KEY (`StaffID`), > >> > ) ; > > >> > CREATE TABLE `tblManager` ( > >> > `ManagerID` varchar(15) NOT NULL, > >> > `logon_code` varchar(15) NOT NULL, > >> > `dept_id` varchar(5) NOT NULL, > >> > `SystemAdmin` tinyint(1) unsigned default NULL, > >> > PRIMARY KEY (`ManagerID`) > >> > ) ; > > >> > CREATE TABLE `tblDepartment` ( > >> > `dept_id` varchar(5) NOT NULL, > >> > `sect_id` varchar(50) default NULL, > >> > `subsect_id` varchar(50) default NULL, > >> > `sect_name` varchar(50) default NULL, > >> > `sect_abbr` varchar(50) default NULL, > >> > `subsect_name` varchar(50) default NULL, > >> > PRIMARY KEY (`dept_id`) > >> > ) ; > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
