If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > normalisation and table design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-07, 09:53
pam_w pam_w is offline
Registered User
 
Join Date: Dec 2007
Posts: 5
normalisation and table design

hi,

I am designing a database at the moment for my dissertation, I have designed it partly but I am a bit stuck. I am creating an online application form using PHP and MySQL. I have a table called project which will hold details such as project ID, Project Code, Project Manager, Start date etc.

The problem that I am having is that each project has 1-20 users (members of staff) and each of the staff can be granted different access rights.

I have created a seperate table staff (Staff ID, Name, email address). I am guessing that I should also create a table with the access levels (access_level_ID, access_level). The only problem is I don't know how to link these to the project table as there will be more than one user per project and each user will be assigned a certain access level.

Any help would be great,

Pam
Reply With Quote
  #2 (permalink)  
Old 12-17-07, 10:17
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
You are broadly there - you just need to piece things together. Are the access rights specific to the project per user or does a user get the same access rights to all projects they are a user of?
Reply With Quote
  #3 (permalink)  
Old 12-17-07, 10:32
pam_w pam_w is offline
Registered User
 
Join Date: Dec 2007
Posts: 5
The user is assigned specific access rights to each project when the application form is completed...
Reply With Quote
  #4 (permalink)  
Old 12-17-07, 10:59
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Ignore access for now. Break the problem down.
Quote:
Originally Posted by pam_w
each project has 1-20 users (members of staff)
Therefore you need....
Reply With Quote
  #5 (permalink)  
Old 12-17-07, 16:40
wdoliver wdoliver is offline
Registered User
 
Join Date: Feb 2007
Posts: 3
Really need more information, but here is a simple group/ role base access:

Assign Project to Application
Assign Group to Application
Assign Role to Group
Assign Role to Application
Assign Permission to Role
Assign Permission to Group
*** Need to add rules if Role contain in group and has higher permissions which is used role or group?
Assign user to role

First, you need to determine what you are going to base your access on - user, role, group, other...

Next, you need to know how you are going to access the data in the database. . I personally do not like to allow direct access to my database especially when queries are from internet. I suggest two service components on to determine access and the other to perform CRUD services. I would grant access only to the services which would access the database on the user's behalf. If a hacker successfully gets into your system and the only access allowed is via services you will be able to determine what data may of been compromised. (It is more involved than I made it sound).
Reply With Quote
  #6 (permalink)  
Old 12-19-07, 08:11
pam_w pam_w is offline
Registered User
 
Join Date: Dec 2007
Posts: 5
Hi, the database will only be accessable by the admin users. The application form is for project managers to use when they are requesting a new project created in a testing tool. It's all a bit complicated.

The only thing I really need help with is somehow linking the following tables. I have decided to assign each user a default access level:

Project (project_id, name, start_date, end_date, project_manager, users (there are up to 20 users per project)

and

Users (user_id, first_name, last_name, email address, access_level)

There is a problem in that one project has many users and each user can belong to many projects...

Pam
Reply With Quote
  #7 (permalink)  
Old 12-19-07, 08:23
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
This is not a problem - this is just a particular type of relationship.

I will give you two clues:
1) Users does not belong in Project
2) You need another table.

Have a read through this and keep in mind your problem:
http://www.tonymarston.net/php-mysql...se-design.html
Reply With Quote
  #8 (permalink)  
Old 12-19-07, 09:25
pam_w pam_w is offline
Registered User
 
Join Date: Dec 2007
Posts: 5
Just had an idea to create a table that would just hold the details:

Table (Primary Key, Project_id, User_id)

Have no idea if this will work or not but the tables would be linked...

Pam
Reply With Quote
  #9 (permalink)  
Old 12-19-07, 09:39
pam_w pam_w is offline
Registered User
 
Join Date: Dec 2007
Posts: 5
Reply With Quote
  #10 (permalink)  
Old 12-19-07, 09:59
pootle flump pootle flump is offline
King of Understatement
 
Join Date: Feb 2004
Location: One Flump in One Place
Posts: 14,905
Yep - that's called a junction table (and one or two other names).

Link works for me. Try:
http://www.tonymarston.net/
then "PHP/MySQL"
then search for "The Relational Data Model, Normalisation and effective Database Design" & click the link
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On