1 Reply Latest reply on Aug 8, 2007 10:00 AM by levancho

    Advanced Login System

    LucaLT
      Hello there,

      For the past month I've been developing a database managemnet system for a department in my university. It's nothing super complicated, but considering the fact the we are a music college and I have no formal training in web development, it turned out pretty good. For this application I created a vey simple login system using PHP and MySQL, but now i've been asked if it would be possible to add custom user groups with different privileges.
      I was wondering what would be the best design for such feature, or if there is some sort of template I can base this system on. Right now what I have in mind is to store true/false information in a "usergroup" table as a serialized array and use this data as visible or enabled properties of the various sections inside the application. I don't know, but this doesn't really seem a good design to me especially considering that new sections might get added in the near future.
      I'm here to see if there is somebody so kind to give me some advice. Thank you very much for your time.
        • 1. Re: Advanced Login System
          levancho Level 3
          I would have most common classic design on Database side following way :

          User Table
          -------------------
          User_id:varchar(255) (can safely be primary key )
          etc ...
          ____________

          Roles Table
          ----------------
          role_Id:int Primary key
          RoleName:Varchar(255) (this can also be primary key since its unique , but indexing works better on int vs varchars)
          __________________


          User_Roles
          -----------------------
          user_id : composite Key --> references user_id from Users table
          Role_id: composite_key --> references Role_id from Roles table

          they both make up a Primary Key .

          with this design you can have many users with many role or one user with many roles or one user with one role, or user with no roles at all.
          -------

          but this all is outside flex, where flex fits into this ?