We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21739
    • 49 Posts
    I'm trying to create a "front-end members manager" (web context).

    (1)
    Is it possible to create an admin user (mgr context) that can only list/view/edit/create the users from a specific "User Group"?
    In other words, I would like to hide the users & user groups for the admin to which he/she is not part of. Makes sense?

    (2)
    Additionally, it should not be possible for this admin to view the "settings tabs, extended fields tab, access permissions tab & Sudo User checkbox" when editing/creating a user.

    Any input is appreciated!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      User management is not that granular. If you have permissions to manage users, there is no further control.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21739
        • 49 Posts
        I was afraid of that. Perhaps there's a way to tweak things a bit with custom css/js in the manager's html smiley
        Thnx Susan.
          • 3749
          • 24,544 Posts
          It might be possible to create a plugin connected to OnUserFormPrerender or OnUserFormRender that does it. You'd have to see if $modx->user is available at that point (and is the current user), and if the $user variable holds the user object for the user about to be edited. I'm not sure. If you get both of those, you can use
          if ($user->isMember('somegroup')) {
          }
          

          to check memberships, and if they're not authorized, forward them somewhere with

          $modx->sendRedirect($url)


          The forward can be to a front-end page or some page in the Manager.

          The user about to be edited should also be available as $_GET['id'], but you'd have to get the user object with this before calling isMember().

          $u = $modx->getObject('modUser', $_GET['id']);
          if ($u->isMember('somegroup')) {
          
          }

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 21739
            • 49 Posts
            I wasn't aware there was a system event connected to the user form, this sounds like it could go somewhere.
            Gonna try this out and report back for anyone else that's interested to know, thanks Bob!
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yes, it's certainly possible to use those events to prevent actions taken on a user creation/editing form. I looked, but I didn't find any events for working with the user list display.

              If limiting the actual user list display is necessary, you could use one of the user listing snippets, and have the tpl contain a link to the Manager for editing the selected user. I know that pdoUsers lets you filter the user list by group. If the resource containing the snippet is unpublished, then only logged-in Manager users with view_unpublished permissions could access the page.

              It's probably also possible to use the snippet in a CMP, although I'm not sure exactly how that would work.

                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 3749
                • 24,544 Posts
                It's also possible to create a CMP that's based on, and replaces, the current Manage Users panel. Then, you can prevent users from showing up on the list by modifying the user/getlist processor.

                It's not too difficult, but once you have it, you'll probably think of several other things you want it to do and those will not be so easy. [ed. note: BobRay last edited this post 12 years, 3 months ago.]
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 4172
                  • 5,888 Posts
                  Its easy to build a CMP, which does that, with help of MIGXdb.
                  We did that several times.

                  Here's an example
                  https://github.com/Bruno17/migxclientmanager
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 21739
                    • 49 Posts
                    Quote from: Bruno17 at Jul 03, 2014, 11:32 PM
                    Its easy to build a CMP, which does that, with help of MIGXdb.
                    We did that several times.

                    Here's an example
                    https://github.com/Bruno17/migxclientmanager

                    This looks great!
                    Are there any additional things I need besides this package to be able to add users aswell?
                    Just enabling the 'addItem' action didn't work & nothing showing up in error log (latest version migx/modx).

                    Thnx!
                      • 4172
                      • 5,888 Posts
                      you will need some code here:

                      https://github.com/Bruno17/migxclientmanager/blob/master/core/components/migxclientmanager/processors/mgr/default/update.php#L82

                      and call
                      $response = $modx->runProcessor('security/user/create', $data);


                      if it's a new object.
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!