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

Implement core_privacy for auth_mnet plugin

    XMLWordPrintable

Details

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-62269-master
    • Hide

      Automatic testing can be achieved by executing the attached scripts (see Privacy API/Utilities doc]). Make sure you've purged the caches (php admin/cli/purge_caches.php), before running the scripts.

      • Check that auth_mnet plugin is compliant: testwithmanager.php
        Assign user to be tested inside the script (for instance, 84):

        $user = \core_user::get_user(84);

        Run script:

        php testscriptwithmanager.php auth

        Running testscriptwithmanager.php, if mnet_log table is empty or not have records associated to the user, you should receive a script output like:

        Testing the compliant plugins:
        ...
        == auth_mnet (auth_mnet\privacy\provider) ==
            Found 4 items of metadata
            Nothing to export.
        ...
        

        After inserting some records in table mnet_log with the userid to be tested, you should get:

        Testing the compliant plugins:
        ...
        == auth_mnet (auth_mnet\privacy\provider) ==
            Found 4 items of metadata
            Successfully ran a test export
        ...
        

        Example records for testing (change table name and userid value). Note that mnet_log.hostid must match mnet_host.id.

        INSERT INTO mnet_host (id, deleted, wwwroot, ip_address, name, public_key, public_key_expires, transport, portno, last_connect_time, last_log_id, force_theme, theme, applicationid, sslverification) VALUES (3, 0, 'https://34.moodle.test', '127.0.0.1', 'Moodle Test A', '-----BEGIN CERTIFICATE----', 1527854427, 0, 0, 1525439658, 0, 0, NULL, 1, 0);
        INSERT INTO mnet_host (id, deleted, wwwroot, ip_address, name, public_key, public_key_expires, transport, portno, last_connect_time, last_log_id, force_theme, theme, applicationid, sslverification) VALUES (5, 0, 'https://33.moodle.test', '127.0.0.1', 'Moodle Test B', '-----BEGIN CERTIFICATE-----', 0, 0, 0, 0, 0, 0, NULL, 1, 0);
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (3, 8, 0, 84, '', 2, 'course test 2', 'forum', 23, 'view', '', '');
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (5, 4, 0, 84, '', 3, 'course test 3', 'assign', 5, 'view', '', '');
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (5, 4, 0, 84, '', 3, 'course test 3', '', 0, '', '', '');
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (5, 4, 0, 84, '10.99.101.99', 3, 'course test 3', '', 0, '', '', '');
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (5, 4, 0, 84, '', 4, 'course test 4', '', 0, '', '', '');
        INSERT INTO mnet_log (hostid, remoteid, "time", userid, ip, course, coursename, module, cmid, action, url, info) VALUES (5, 4, 0, 84, '', 5, 'course test 5', '', 0, '', '', '');
        

      • Check data exported: testexport.php
        Run the script using the userid being tested:

        php testexport.php --userid=84

        You should get a similar output:

        Processing export for Adéla Němcová
         
        == File was successfully exported to /path/to/moodledata/masterdata/localcache/70dd06d4-5d6e-47ad-a0d3-bb22d7d386f2/df10ffbb-0e63-452e-9d61-00b86b8a23f3/export.zip
        == File export was uncompressed to /path/to/moodledata/masterdata/temp/privacy/7134f7d9-806e-4a02-9f7d-d02ad5060dcc
        ============================================================================
        

        Check that the content of the file

        /path/to/moodledata/masterdata/temp/privacy/7134f7d9-806e-4a02-9f7d-d02ad5060dcc/System/User\ Adéla\ Němcová/MNet\ authentication/hostname/coursename/data.json

        matches with the records in table mnet_log for the user being tested.

      Show
      Automatic testing can be achieved by executing the attached scripts (see Privacy API/Utilities doc ]). Make sure you've purged the caches (php admin/cli/purge_caches.php), before running the scripts. Check that auth_mnet plugin is compliant: testwithmanager.php Assign user to be tested inside the script (for instance, 84): $user = \core_user::get_user(84); Run script: php testscriptwithmanager.php auth Running testscriptwithmanager.php , if mnet_log table is empty or not have records associated to the user, you should receive a script output like: Testing the compliant plugins: ... == auth_mnet (auth_mnet\privacy\provider) == Found 4 items of metadata Nothing to export. ... After inserting some records in table mnet_log with the userid to be tested, you should get: Testing the compliant plugins: ... == auth_mnet (auth_mnet\privacy\provider) == Found 4 items of metadata Successfully ran a test export ... Example records for testing (change table name and userid value). Note that mnet_log.hostid must match mnet_host.id. INSERT INTO mnet_host (id, deleted, wwwroot, ip_address, name , public_key, public_key_expires, transport, portno, last_connect_time, last_log_id, force_theme, theme, applicationid, sslverification) VALUES (3, 0, 'https://34.moodle.test' , '127.0.0.1' , 'Moodle Test A' , '-----BEGIN CERTIFICATE----' , 1527854427, 0, 0, 1525439658, 0, 0, NULL , 1, 0); INSERT INTO mnet_host (id, deleted, wwwroot, ip_address, name , public_key, public_key_expires, transport, portno, last_connect_time, last_log_id, force_theme, theme, applicationid, sslverification) VALUES (5, 0, 'https://33.moodle.test' , '127.0.0.1' , 'Moodle Test B' , '-----BEGIN CERTIFICATE-----' , 0, 0, 0, 0, 0, 0, NULL , 1, 0); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (3, 8, 0, 84, '' , 2, 'course test 2' , 'forum' , 23, 'view' , '' , '' ); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (5, 4, 0, 84, '' , 3, 'course test 3' , 'assign' , 5, 'view' , '' , '' ); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (5, 4, 0, 84, '' , 3, 'course test 3' , '' , 0, '' , '' , '' ); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (5, 4, 0, 84, '10.99.101.99' , 3, 'course test 3' , '' , 0, '' , '' , '' ); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (5, 4, 0, 84, '' , 4, 'course test 4' , '' , 0, '' , '' , '' ); INSERT INTO mnet_log (hostid, remoteid, "time" , userid, ip, course, coursename, module, cmid, action , url, info) VALUES (5, 4, 0, 84, '' , 5, 'course test 5' , '' , 0, '' , '' , '' ); Check data exported: testexport.php Run the script using the userid being tested: php testexport.php --userid=84 You should get a similar output: Processing export for Adéla Němcová   == File was successfully exported to /path/to/moodledata/masterdata/localcache/70dd06d4-5d6e-47ad-a0d3-bb22d7d386f2/df10ffbb-0e63-452e-9d61-00b86b8a23f3/export.zip == File export was uncompressed to /path/to/moodledata/masterdata/temp/privacy/7134f7d9-806e-4a02-9f7d-d02ad5060dcc ============================================================================ Check that the content of the file /path/to/moodledata/masterdata/temp/privacy/7134f7d9-806e-4a02-9f7d-d02ad5060dcc/System/User\ Adéla\ Němcová/MNet\ authentication/hostname/coursename/data.json matches with the records in table mnet_log for the user being tested.

    Description

      In recent versions, data is not being stored in the table mnet_log, but it can store data from a previous Moodle version upgraded.

      Table mnet_session only stores data temporarily, so it's not necessary to export this data.

      It's necessary:

      • declare mnet_session
      • declare and export mnet_log

      To improve the PHP memory usage, the export creates a file for every external system/course set.

      Attachments

        Issue Links

          Activity

            People

              vmdef Víctor Déniz Falcón
              vmdef Víctor Déniz Falcón
              David Monllaó David Monllaó
              Andrew Lyons Andrew Lyons
              Zig Tan Zig Tan (Inactive)
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/May/18