4 Replies Latest reply on Oct 17, 2008 4:10 AM by (Krech_Ion)

    Multi User Levels per user?

    Level 1
      Is there a way with ADDT to setup mutiple user levels per user.

      Example I want said user to be have admin rights to:
      Module 1
      Module 2
      Module 4

      So they would have more than 1 auth level.

      Then if I add another module I could add a that module/access level to their profile?

      Its getting harder as I add diffrent sections to a website to keep creating diffrent auth levels seeing as some people need to overlap and have access to 3-4 diff sections and other just needing access to the 1 module.
        • 1. Re: Multi User Levels per user?
          Günter Schenk Level 4
          Hi Brad,

          using ADDT´s "levels" feature is not the only way to grant permissions, and in some cases they are not flexible enough -- however here´s a different approach I´m using for situations which require a more detailed set of permission:

          Let´s assume you´re adding an extra column (char 1, for storing a Y/N value) to your ADDT "login" table, name it "module_one" and add this column to ADDT´s array of session variables (naming it e.g. "kt_module_one"), you could implement a Show If Conditional Region behaviour that´s based on the condition:

          if Session Variable kt_module_one equals Y

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Multi User Levels per user?
            Level 1
            What about storing the levels in a comma separated list? Would the built in function be able to decipher this? I havent looked at the code to see if it would or not.

            I think I found the file that I would need to modify though,

            Includes -> tng -> triggers
            tNG_RestrictAccess.class.php

            Let me know what you think if this would be feasible. I can see the overhead of having to modify the db to add another field for every new module would just be a pain =(. (I store all my user levels in a database and have form so I can easily add new ones, then Im thinking just use the ADDT function comma separated checkboxes for the admin side to assign the levels based off the other access table =))
            • 3. Re: Multi User Levels per user?
              Level 1
              Well this is what Ive come up. It appears to work from my limited testing, Does this look right? Its a slight mod of the tNG_RestrictAccess.class.php that puts the users and page auth levels into two arrays then compares them and if they intersect it grants access

              //if (in_array($_SESSION['kt_login_level'], $this->levels) ) { // orig code

              //New Code

              $user = explode(",",$_SESSION['kt_login_level']); //makes array of users auth levels (1,2,3,4)
              $page = $this->levels; //makes array of auth levels requred to access page
              $auth = array_intersect($user,$page); //compares two arrays, if a common auth level is found its stored

              if (isset($auth)) { // if auth var is not empty then grant access
              $grantAccess = true;
              } else {
              • 4. Re: Multi User Levels per user?
                Level 1
                Brad Baker, it works just fine if you drop the "isset" from "if (isset($auth))" and in junction with ADDT form control Comma separated Menu or Check boxes is great!
                Use simply if($auth).
                If the "isset" remains it will grant access all the time.

                Thank you very much. This is the only post that is talking about this problem!