jeudi 13 août 2015

Creating a database schema that allows the admin to set 1 or many access to user

I am planning to create a database that allows many vehicles of the user to access different gates depending on their privileges.

For example, I have 5 gates namely Gate 1, Gate 2, Gate 3, Gate 4, Gate 5 and I have 3 users namely User 1, User 2 and user 3.

Scenario 1: User 1 is the owner of the city so this user should have access to all 5 gates.

Scenario 2: User 2 is just a visitor so this user shouldn't have access to all 5 gates.

Scenario 3: User 3 is one of the residents of this city, but gates 4 and 5 only allows the owners of the city, this user should only access gates 1-3 since this user is not the owner.

Scenario 4: User 3 is one the residents of this city and since user 1 is the owner he allows user 3 to access also gate 4 for them have a dinner this evening and ask the administrator that tomorrow he should remove the gate 4 privilege of this user

Based on my planning this database schema should be something like this

vehicle_info table         access_type table

  1. vehicle_id                 1. access_id
  2. plate_num                 2. name
  3. access_type
  4. validity - the validity of the access type (date only)

Then I will connect vehicle_info.access_type to access_type.name. But what if the city builds another gate namely gate 6 and also want it to add to the access_type?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire