diff --git a/admin/tool/dataprivacy/amd/build/categoriesactions.min.js b/admin/tool/dataprivacy/amd/build/categoriesactions.min.js index 66e3b0a458b38..cac33a4329791 100644 --- a/admin/tool/dataprivacy/amd/build/categoriesactions.min.js +++ b/admin/tool/dataprivacy/amd/build/categoriesactions.min.js @@ -1 +1 @@ -define(["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:'[data-action="deletecategory"]'},h=function(){this.registerEvents()};return h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name"),j=[{key:"deletecategory",component:"tool_dataprivacy",param:i},{key:"deletecategorytext",component:"tool_dataprivacy",param:i}];d.get_strings(j).then(function(d){var g=d[0],i=d[1];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){return d.setSaveButtonText(g),d.getRoot().on(f.save,function(){var d={methodname:"tool_dataprivacy_delete_category",args:{id:h}};b.call([d])[0].done(function(b){b.result?a('tr[data-categoryid="'+h+'"]').remove():c.addNotification({message:b.warnings[0].message,type:"error"})}).fail(c.exception)}),d.getRoot().on(f.hidden,function(){d.destroy()}),d})}).done(function(a){a.show()}).fail(c.exception)})},{init:function(){return new h}}}); \ No newline at end of file +define(["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:'[data-action="deletecategory"]'},h=function(){this.registerEvents()};return h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name"),j=[{key:"deletecategory",component:"tool_dataprivacy"},{key:"deletecategorytext",component:"tool_dataprivacy",param:i},{key:"delete"}];d.get_strings(j).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){return d.setSaveButtonText(j),d.getRoot().on(f.save,function(){var d={methodname:"tool_dataprivacy_delete_category",args:{id:h}};b.call([d])[0].done(function(b){b.result?a('tr[data-categoryid="'+h+'"]').remove():c.addNotification({message:b.warnings[0].message,type:"error"})}).fail(c.exception)}),d.getRoot().on(f.hidden,function(){d.destroy()}),d})}).done(function(a){a.show()}).fail(c.exception)})},{init:function(){return new h}}}); \ No newline at end of file diff --git a/admin/tool/dataprivacy/amd/build/purposesactions.min.js b/admin/tool/dataprivacy/amd/build/purposesactions.min.js index 0b159814b52d6..33b773c865681 100644 --- a/admin/tool/dataprivacy/amd/build/purposesactions.min.js +++ b/admin/tool/dataprivacy/amd/build/purposesactions.min.js @@ -1 +1 @@ -define(["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:'[data-action="deletepurpose"]'},h=function(){this.registerEvents()};return h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name"),j=[{key:"deletepurpose",component:"tool_dataprivacy",param:i},{key:"deletepurposetext",component:"tool_dataprivacy",param:i}];d.get_strings(j).then(function(d){var g=d[0],i=d[1];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){return d.setSaveButtonText(g),d.getRoot().on(f.save,function(){var d={methodname:"tool_dataprivacy_delete_purpose",args:{id:h}};b.call([d])[0].done(function(b){b.result?a('tr[data-purposeid="'+h+'"]').remove():c.addNotification({message:b.warnings[0].message,type:"error"})}).fail(c.exception)}),d.getRoot().on(f.hidden,function(){d.destroy()}),d})}).done(function(a){a.show()}).fail(c.exception)})},{init:function(){return new h}}}); \ No newline at end of file +define(["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:'[data-action="deletepurpose"]'},h=function(){this.registerEvents()};return h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name"),j=[{key:"deletepurpose",component:"tool_dataprivacy"},{key:"deletepurposetext",component:"tool_dataprivacy",param:i},{key:"delete"}];d.get_strings(j).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){return d.setSaveButtonText(j),d.getRoot().on(f.save,function(){var d={methodname:"tool_dataprivacy_delete_purpose",args:{id:h}};b.call([d])[0].done(function(b){b.result?a('tr[data-purposeid="'+h+'"]').remove():c.addNotification({message:b.warnings[0].message,type:"error"})}).fail(c.exception)}),d.getRoot().on(f.hidden,function(){d.destroy()}),d})}).done(function(a){a.show()}).fail(c.exception)})},{init:function(){return new h}}}); \ No newline at end of file diff --git a/admin/tool/dataprivacy/amd/src/categoriesactions.js b/admin/tool/dataprivacy/amd/src/categoriesactions.js index c40a1a75c8581..6d059771ae0cb 100644 --- a/admin/tool/dataprivacy/amd/src/categoriesactions.js +++ b/admin/tool/dataprivacy/amd/src/categoriesactions.js @@ -58,25 +58,28 @@ function($, Ajax, Notification, Str, ModalFactory, ModalEvents) { var stringkeys = [ { key: 'deletecategory', - component: 'tool_dataprivacy', - param: categoryname + component: 'tool_dataprivacy' }, { key: 'deletecategorytext', component: 'tool_dataprivacy', param: categoryname + }, + { + key: 'delete' } ]; Str.get_strings(stringkeys).then(function(langStrings) { var title = langStrings[0]; var confirmMessage = langStrings[1]; + var buttonText = langStrings[2]; return ModalFactory.create({ title: title, body: confirmMessage, type: ModalFactory.types.SAVE_CANCEL }).then(function(modal) { - modal.setSaveButtonText(title); + modal.setSaveButtonText(buttonText); // Handle save event. modal.getRoot().on(ModalEvents.save, function() { diff --git a/admin/tool/dataprivacy/amd/src/purposesactions.js b/admin/tool/dataprivacy/amd/src/purposesactions.js index fd92141b869ec..05abf71896e30 100644 --- a/admin/tool/dataprivacy/amd/src/purposesactions.js +++ b/admin/tool/dataprivacy/amd/src/purposesactions.js @@ -58,25 +58,28 @@ function($, Ajax, Notification, Str, ModalFactory, ModalEvents) { var stringkeys = [ { key: 'deletepurpose', - component: 'tool_dataprivacy', - param: purposename + component: 'tool_dataprivacy' }, { key: 'deletepurposetext', component: 'tool_dataprivacy', param: purposename + }, + { + key: 'delete' } ]; Str.get_strings(stringkeys).then(function(langStrings) { var title = langStrings[0]; var confirmMessage = langStrings[1]; + var buttonText = langStrings[2]; return ModalFactory.create({ title: title, body: confirmMessage, type: ModalFactory.types.SAVE_CANCEL }).then(function(modal) { - modal.setSaveButtonText(title); + modal.setSaveButtonText(buttonText); // Handle save event. modal.getRoot().on(ModalEvents.save, function() { diff --git a/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php b/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php index a50a2710d4173..42a10520ae59a 100644 --- a/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php +++ b/admin/tool/dataprivacy/lang/en/tool_dataprivacy.php @@ -77,12 +77,12 @@ $string['daterequested'] = 'Date requested'; $string['daterequesteddetail'] = 'Date requested:'; $string['defaultsinfo'] = 'Default categories and purposes are applied to all newly created instances.'; -$string['deletecategory'] = 'Delete "{$a}" category'; -$string['deletecategorytext'] = 'Are you sure you want to delete "{$a}" category?'; +$string['deletecategory'] = 'Delete category'; +$string['deletecategorytext'] = 'Are you sure you want to delete the following category?

{$a}

'; $string['deleteexpiredcontextstask'] = 'Delete expired contexts'; $string['deleteexpireddatarequeststask'] = 'Delete files from completed data requests that have expired'; -$string['deletepurpose'] = 'Delete "{$a}" purpose'; -$string['deletepurposetext'] = 'Are you sure you want to delete "{$a}" purpose?'; +$string['deletepurpose'] = 'Delete purpose'; +$string['deletepurposetext'] = 'Are you sure you want to delete the following purpose?

{$a}

'; $string['defaultssaved'] = 'Defaults saved'; $string['deny'] = 'Deny'; $string['denyrequest'] = 'Deny request'; diff --git a/admin/tool/dataprivacy/templates/categories.mustache b/admin/tool/dataprivacy/templates/categories.mustache index 5bf63fb03f77e..ef310417b8ab1 100644 --- a/admin/tool/dataprivacy/templates/categories.mustache +++ b/admin/tool/dataprivacy/templates/categories.mustache @@ -53,7 +53,7 @@

{{#str}}categories, tool_dataprivacy{{/str}}

-
diff --git a/admin/tool/dataprivacy/templates/purposes.mustache b/admin/tool/dataprivacy/templates/purposes.mustache index 6e6c855f30a3e..4461eab1f82f3 100644 --- a/admin/tool/dataprivacy/templates/purposes.mustache +++ b/admin/tool/dataprivacy/templates/purposes.mustache @@ -60,7 +60,7 @@

{{#str}}purposes, tool_dataprivacy{{/str}}

-
diff --git a/admin/tool/dataprivacy/tests/behat/manage_categories.feature b/admin/tool/dataprivacy/tests/behat/manage_categories.feature new file mode 100644 index 0000000000000..94d9351fac77f --- /dev/null +++ b/admin/tool/dataprivacy/tests/behat/manage_categories.feature @@ -0,0 +1,34 @@ +@tool @tool_dataprivacy @javascript +Feature: Manage data categories + As the privacy officer + In order to manage the data registry + I need to be able to manage the data categories for the data registry + + Background: + Given I log in as "admin" + And I navigate to "Users > Privacy and policies > Data registry" in site administration + And I click on "Edit" "link" + And I choose "Categories" in the open action menu + And I press "Add category" + And I set the field "Name" to "Category 1" + And I set the field "Description" to "Category 1 description" + When I press "Save" + Then I should see "Category 1" in the "List of data categories" "table" + And I should see "Category 1 description" in the "Category 1" "table_row" + + Scenario: Update a data category + Given I click on "Actions" "link" in the "Category 1" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Name" to "Category 1 edited" + And I set the field "Description" to "Category 1 description edited" + When I press "Save changes" + Then I should see "Category 1 edited" in the "List of data categories" "table" + And I should see "Category 1 description edited" in the "List of data categories" "table" + + Scenario: Delete a data category + Given I click on "Actions" "link" in the "Category 1" "table_row" + And I choose "Delete" in the open action menu + And I should see "Delete category" + And I should see "Are you sure you want to delete the category \"Category 1\"?" + When I press "Delete" + Then I should not see "Category 1" in the "List of data categories" "table" diff --git a/admin/tool/dataprivacy/tests/behat/manage_purposes.feature b/admin/tool/dataprivacy/tests/behat/manage_purposes.feature new file mode 100644 index 0000000000000..36845df328939 --- /dev/null +++ b/admin/tool/dataprivacy/tests/behat/manage_purposes.feature @@ -0,0 +1,56 @@ +@tool @tool_dataprivacy @javascript +Feature: Manage data storage purposes + As the privacy officer + In order to manage the data registry + I need to be able to manage the data storage purposes for the data registry + + Background: + Given I log in as "admin" + And I navigate to "Users > Privacy and policies > Data registry" in site administration + And I click on "Edit" "link" + And I choose "Purposes" in the open action menu + And I press "Add purpose" + And I set the field "Name" to "Purpose 1" + And I set the field "Description" to "Purpose 1 description" + And I click on ".form-autocomplete-downarrow" "css_element" in the "Lawful bases" "form_row" + And I click on "Contract (GDPR Art. 6.1(b))" "list_item" + And I click on "Legal obligation (GDPR Art 6.1(c))" "list_item" + And I press key "27" in the field "Lawful bases" + And I click on ".form-autocomplete-downarrow" "css_element" in the "Sensitive personal data processing reasons" "form_row" + And I click on "Explicit consent (GDPR Art. 9.2(a))" "list_item" + And I press key "27" in the field "Sensitive personal data processing reasons" + And I set the field "retentionperiodnumber" to "2" + When I press "Save" + Then I should see "Purpose 1" in the "List of data purposes" "table" + And I should see "Contract (GDPR Art. 6.1(b))" in the "Purpose 1" "table_row" + And I should see "Legal obligation (GDPR Art 6.1(c))" in the "Purpose 1" "table_row" + And I should see "Explicit consent (GDPR Art. 9.2(a))" in the "Purpose 1" "table_row" + And I should see "2 years" in the "Purpose 1" "table_row" + And I should see "No" in the "Purpose 1" "table_row" + + Scenario: Update a data storage purpose + Given I click on "Actions" "link" in the "Purpose 1" "table_row" + And I choose "Edit" in the open action menu + And I set the field "Name" to "Purpose 1 edited" + And I set the field "Description" to "Purpose 1 description edited" + And I click on "Legal obligation (GDPR Art 6.1(c))" "text" in the ".form-autocomplete-selection" "css_element" + And I click on ".form-autocomplete-downarrow" "css_element" in the "Lawful bases" "form_row" + And I click on "Vital interests (GDPR Art. 6.1(d))" "list_item" + And I press key "27" in the field "Lawful bases" + And I set the field "retentionperiodnumber" to "3" + And I click on "protected" "checkbox" + When I press "Save changes" + Then I should see "Purpose 1 edited" in the "List of data purposes" "table" + And I should see "Purpose 1 description edited" in the "Purpose 1 edited" "table_row" + And I should see "Vital interests (GDPR Art. 6.1(d))" in the "Purpose 1 edited" "table_row" + And I should see "3 years" in the "Purpose 1 edited" "table_row" + But I should not see "Legal obligation (GDPR Art 6.1(c))" in the "Purpose 1 edited" "table_row" + And I should not see "No" in the "Purpose 1 edited" "table_row" + + Scenario: Delete a data storage purpose + Given I click on "Actions" "link" in the "Purpose 1" "table_row" + And I choose "Delete" in the open action menu + And I should see "Delete purpose" + And I should see "Are you sure you want to delete the purpose \"Purpose 1\"?" + When I press "Delete" + Then I should not see "Purpose 1" in the "List of data purposes" "table"