Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78689

Remove/add power level of user with the change in capabilities

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_404_STABLE
    • MDL-78689-master
    • Hide

      Setup for user testing

      1. Clone Andrew's helper repository:

        git clone https://github.com/andrewnicols/moodle-synapse
        cd moodle-synapse
        chmod 777 *_data
        

      2. Run the docker-compose up command:

        docker compose up -d
        

      3. Wait for about 10 seconds for the first run to complete
      4. Run the setup script:

        ./setup.sh
        

      5. Copy the command it outputs
      6. Change into your Moodle directory
      7. Paste in the command, for EXAMPLE:

        cd path/to/moodle
        sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php
        cd -
        

      8. If you have not done so already, edit your /etc/hosts file to add:

        127.0.0.1 element.container.docker.internal element
        127.0.0.1 synapse.container.docker.internal synapse
        127.0.0.1 keycloak.container.docker.internal keycloak
        

      9. Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.

       

      Setup Matrix Mock

      1. Clone git repo https://github.com/davewoloszyn/matrixsynapse_mock/
      2. Checkout branch MDL-79460
      3. Following the 'local development' setup instructions here

      Test scenario

      1. Create three new user
      2. Create a new course
      3. Enroll three new users to the course, two as students and one as a teacher
      4. Go to the communication from the More menu
      5. Set the Communication service to 'Matrix'
      6. Set Room name to 'Test room'
      7. Save changes.
      8. Run the queued ad-hoc tasks by running cron from the command line: php admin/cli/cron.php
      9. Navigate the matrix room
      10. Confirm that the room is created and three users are added to the room
      11. Change the role of the two users from student to manager
      12. Go to the task_adhoc table and remove all the communication-related tasks
      13. Go to the console and run the following command to run the scheduled task for provider sync: php admin/cli/scheduled_task.php --execute='\core_communication\task\synchronise_providers_task'
      14. Go to the task_adhoc table
      15. Confirm that the task synchronise_provider_task is added to the queue
      16. Run the cron from the console: php admin/cli/cron.php
      17. Confirm that the power level of the users is updated in the matrix room
      18. Go to Site administration > Users > Define role
      19. Change the Teacher role and remove the matrix moderator permission from the role
      20. Go to the console and run the following command to run the scheduled task for provider sync: php admin/cli/scheduled_task.php --execute='\core_communication\task\synchronise_providers_task'
      21. Go to the task_adhoc table
      22. Confirm that the task synchronise_provider_task is added to the queue
      23. Run the cron from the console: php admin/cli/cron.php
      24. Confirm that the power level of all the teachers is updated to default in the matrix room

      PHPUnit tests

      1. Run the test suite for core_communication_testsuite and communication_matrix_testsuite to confirm everything passes.
      Show
      Setup for user testing Clone Andrew's helper repository: git clone https://github.com/andrewnicols/moodle-synapse cd moodle-synapse chmod 777 *_data Run the docker-compose up command: docker compose up -d Wait for about 10 seconds for the first run to complete Run the setup script: ./setup.sh Copy the command it outputs Change into your Moodle directory Paste in the command, for EXAMPLE : cd path/to/moodle sed -i '/^require_once.*lib.*setup.php.*$/i require_once("/Users/nicols/git/moodlehq/synapse/moodle-config.php");' config.php cd - If you have not done so already, edit your /etc/hosts file to add: 127.0.0.1 element.container.docker.internal element 127.0.0.1 synapse.container.docker.internal synapse 127.0.0.1 keycloak.container.docker.internal keycloak Follow the instructions at https://github.com/andrewnicols/moodle-synapse#trusting to trust the root CA that is used for this.   Setup Matrix Mock Clone git repo https://github.com/davewoloszyn/matrixsynapse_mock/ Checkout branch MDL-79460 Following the 'local development' setup instructions here Test scenario Create three new user Create a new course Enroll three new users to the course, two as students and one as a teacher Go to the communication from the More menu Set the Communication service to 'Matrix' Set Room name to 'Test room' Save changes. Run the queued ad-hoc tasks by running cron from the command line: php admin/cli/cron.php Navigate the matrix room Confirm that the room is created and three users are added to the room Change the role of the two users from student to manager Go to the task_adhoc table and remove all the communication-related tasks Go to the console and run the following command to run the scheduled task for provider sync: php admin/cli/scheduled_task.php --execute='\core_communication\task\synchronise_providers_task' Go to the task_adhoc table Confirm that the task synchronise_provider_task is added to the queue Run the cron from the console: php admin/cli/cron.php Confirm that the power level of the users is updated in the matrix room Go to Site administration > Users > Define role Change the Teacher role and remove the matrix moderator permission from the role Go to the console and run the following command to run the scheduled task for provider sync: php admin/cli/scheduled_task.php --execute='\core_communication\task\synchronise_providers_task' Go to the task_adhoc table Confirm that the task synchronise_provider_task is added to the queue Run the cron from the console: php admin/cli/cron.php Confirm that the power level of all the teachers is updated to default in the matrix room PHPUnit tests Run the test suite for core_communication_testsuite and communication_matrix_testsuite to confirm everything passes.
    • 6
    • Team Hedgehog 2023 Sprint 3.2, Team Hedgehog 2023 Review 3, Team Hedgehog 2023 Sprint 4.1, Team Hedgehog 2023 Sprint 4.2, Team Hedgehog 2023 Sprint 4.3

      As of MDL-78129, some users (eg teachers, managers) have moderator power levels in Matrix, which are controlled by a capability and checked during membership/enrolment changes. However, capability changes (eg removing from a role or user) are not currently synced to update those users' power levels in Matrix when their capabilities are modified. This issue aims to address this missing sync, so that the current state of a user's permissions in Moodle will be reflected in the communication provider.

      User story

      • As an admin I want changes I make to users' communication power level capabilities to be reflected in relevant communication rooms, so users' access levels match their current capabilities.

        1. MDL-78689.png
          MDL-78689.png
          830 kB
        2. test_filter.png
          test_filter.png
          37 kB
        3. test_testsuite_comm.png
          test_testsuite_comm.png
          37 kB
        4. test_testsuite_matrix.png
          test_testsuite_matrix.png
          45 kB

            safat.shahin@moodle.com Safat Shahin
            safat.shahin@moodle.com Safat Shahin
            David Woloszyn David Woloszyn
            Huong Nguyen Huong Nguyen
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 days, 6 hours, 45 minutes
                2d 6h 45m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.