Check out my database design / PHP / MySQL

I am currently working on improving my database to make room for growth. Accordingly, different users have different β€œpermissions” for areas of the website. Some users have permissions to several areas of the website.

I would like to receive feedback if I do this in the most efficient way:

 tblUsers:
    usrID       usrFirst       usrLast       phone    //etc....
      1            John          Doe 
      2            Jane          Smith
      3            Bill          Jones          


 tblAreas: 
    id      name   
     1       Marketing
     2       Support
     3       Human Resources
     4       Media Relations

 tblPermissions:

    id       usrID       areaID   
    1          1           2
    2          1           4
    3          2           1
    4          3           3

Right now, for each "area" I have separate directories. However, I would like to minimize all of these directories to one main directory, and then redirect users when entering their respective 'area' based on their permissions.

, ? , , , , .

!

+3
3

. , , .

  • SQL - / (tblUsers β†’ users).
  • ...
  • ... "id", ( areaId)
  • "" "" (: firstName)
  • tblPermissions β†’ userAreas

, /.

, . .

:

, - , ? ?

, ?

@brianpeiris: :

  • JOINs
  • ( "foo_id" , "id" )
  • (foo_id) JOIN ON (foo.id = bar.id).
+3

.

, URL, .

+1

, , .

. , , "area", ? , , , ? - . . , ​​ "security_check_for_area (4)", .

+1

Source: https://habr.com/ru/post/1717516/


All Articles