We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36786 ☆ A M B ☆
    • 209 Posts
    Hi, I am trying to create a website that acts as a research database where multiple users can submit scientific documentation for display/categorizing on a website.

    I am wondering if it is possible to give a certain level of user access to create resources utilizing MIGXdb (like the calendar: http://rtfm.modx.com/extras/revo/migxdb/migxdb.tutorials/migxdb.manage-events-resources-in-a-cmp-with-help-of-migxdb), but only give them the ability to edit and view the listing of those resources they themselves created. Each resource being a different scientific study.

    Example: One user who has created 10 resources in MIGXdb TV would be able to create more, but only see listed those 10 resources and only edit those they themselves created. Only administrators to the website would be able to see ALL resources created in that MIGXdb TV.

    This way multiple people can add/edit studies, but not edit or modify studies they themselves do not "own." Some of these individuals come from competing organizations and are collaborating, meaning we need to prevent them from stepping on each other's toes.

    Is there a way to accomplish this?

    This question has been answered by Bruno17. See the first response.

      Ben Morrison
      Hacking templates to pieces since 2003
    • discuss.answer
      • 4172
      • 5,888 Posts
      This is possible, but you will need to create custom-processors, where you check the permissions.

      You can give your administrators a new permission something like (editAllRecords)

      Than you can have in the getlist-processor something like that

      if ($modx->hasPermission('editAllRecords')){
          //do nothing
      }
      else{
          //filter own records
          $c->where(array('createdby'=>$modx->user->get('id')));
      }


      and you should have in the update-processor and other processors, which are in use, a check for this permission and if its a new record or if its a existing record of the currently logged-in user.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 36786 ☆ A M B ☆
        • 209 Posts
        Thanks that is a big help! I'm not sure how to go about writing up the update-processor and other processors but I will do a bit of trial and error and see if I can figure it out.
          Ben Morrison
          Hacking templates to pieces since 2003
          • 36613
          • 328 Posts
          Hi Ben you have resolve this problem ? You can post the solution ? I don't understand that create new processors.
            • 4172
            • 5,888 Posts
            you have created your own package, right?

            than you can create your custom-processors (copies from components/migx/processors/mgr/default/)

            under

            components/yourpackage/processors/mgr/default/

            migx will find these processors and use them instaed

            or, if you need different processors for your package, you can set the MIGXdb - setting 'processorspath' in your configuration

            and put them under:
            components/yourpackage/processors/mgr/yourprocessorspath/

              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 36613
              • 328 Posts
              Wow work smiley I Add this control:

              if ($modx->user->get('id') == 1 || $modx->user->get('id') == 2){
              //do nothing
              }
              else{
              //filter own records
              $c->where(array('createdby'=>$modx->user->get('id')));
              }

              to file:
              core/components/mypackage/processors/mgr/default/getlist.php