We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29774
    • 386 Posts
    Apologies if this is a stupid question, but I’m getting rather lost getting my head round user access concepts in Revo.

    I’m building a web application that requires granular permissions. Essentially I have a checklist list of things that each user can do, eg:

    * Modify your firm’s profile
    * Create and modify user accounts and set access permissions for staff at your firm
    * Create and modify SEPIC data for your firm
    * Create and modify firm news
    * Create and modify referrals that your firm has made

    These would be configurable only for users that belong to a user group I’ve called ’firm_member’.

    There would be a separate list of configurable permissions for another user group.

    Is it possible to set this up in Revo or should I be creating custom tables?

    Many thanks for your help.

    EDIT: I should point out that the administration screens for the above would be entirely separate from the Manager interface

      Snippets: GoogleMap | FileDetails | Related Plugin: SSL
      • 28215
      • 4,149 Posts
      Quote from: therebechips at Jul 07, 2009, 03:57 AM

      Apologies if this is a stupid question, but I’m getting rather lost getting my head round user access concepts in Revo.

      I’m building a web application that requires granular permissions. Essentially I have a checklist list of things that each user can do, eg:

      * Modify your firm’s profile
      * Create and modify user accounts and set access permissions for staff at your firm
      * Create and modify SEPIC data for your firm
      * Create and modify firm news
      * Create and modify referrals that your firm has made

      These would be configurable only for users that belong to a user group I’ve called ’firm_member’.

      There would be a separate list of configurable permissions for another user group.

      Is it possible to set this up in Revo or should I be creating custom tables?

      Many thanks for your help.

      EDIT: I should point out that the administration screens for the above would be entirely separate from the Manager interface

      You’ll want to create an "Access Policy" with all the permissions that you want - say, ’modify_profile’, ’create_news’, etc. Let’s call it "FirmPolicy" for example.

      Then you’ll go to Access Permissions, and add an ACL to the first grid for your ’firm_member’ User Group so that it has access to the ’web’ context (I’m assuming that’s where you’re building this). Give it an arbitrary authority of, say, 10. For the policy, select the "FirmPolicy" policy you just created.

      If you want this policy only on certain Resources, create a Resource Group, and then assign in the 2nd grid in Access Permissions a link between the User Group and Resource Group with the "FirmPolicy" policy.

      Then, from there, flush your permissions.

      Now to use the policy permissions, in your script, simply do:

      if (!$modx->hasPermission('create_news')) { return 'Access Denied!'; } // or something of the sort
      

        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 29774
        • 386 Posts
        Thanks for the reply, I’ve followed those directions but run into a stumbling block - how do you assign different permissions to individual users? I want to be able to set, for example, modify_profile=true for some users and modify_profile=false for others without creating multiple access policies.

        Have I missed something?

        Thanks again for your help,

        Mark
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
          • 29774
          • 386 Posts
          I’ll answer my own question - you can’t. Permissions are stored with their boolean value as serialised data, so no way to directly relate user<>permission.

          Thus my permissions are going into a custom table.

            Snippets: GoogleMap | FileDetails | Related Plugin: SSL
            • 28215
            • 4,149 Posts
            Quote from: therebechips at Jul 08, 2009, 04:13 AM

            I’ll answer my own question - you can’t. Permissions are stored with their boolean value as serialised data, so no way to directly relate user<>permission.

            Thus my permissions are going into a custom table.

            You cant...yet. Specific user-based permissions is planned for 2.0.1 or 2.0.2.
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 29774
              • 386 Posts
              That’s good to know, thanks.
                Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                • 21257 MODX Staff
                • 730 Posts
                If you don’t need the baked-in functionality of access policies/permissions, you can still easily store custom settings per user. Your web app can treat custom settings any way it wishes, e.g. granting user access to specific functionality based on a setting.
                  Mike Schell
                  Lead Developer, MODX Cloud
                  Email: [email protected]
                  GitHub: https://github.com/netProphET/
                  Twitter: @mkschell
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Actually, the access tables can store data for different principal classes (i.e. UserGroups or Users), but some additional work in the UI as well as the code that checks permissions needs to be completed to make it respect these in a proper aggregated way (i.e. so User permissions take precedence over UserGroup permissions).
                    • 29774
                    • 386 Posts
                    But - would it be the case that each user would end up with a string of permissions like this: {"create":true,"remove":true,"save":true.... } ? Isn’t that somewhat redundant if many of the parameters are identical for different users?

                    For me it would be ideal if you could to create access policies that are collections of permissions (defined individually elsewhere), and then be able to assign individual permissions and access policies to users and/or user groups, with precedence something like:

                    user permissions > user access policy > user group permissions > user group access policy

                    However I’m not entirely sure I understand what you have planned so I’ll shut up now smiley





                      Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                      • 10449
                      • 956 Posts
                      It would be nice to have something like freely configurable TVs for users... something like "manager-/webuser TVs" smiley