From 14380e48568d96fc24bf6641dd58726bdf858f51 Mon Sep 17 00:00:00 2001 From: Vijaivir Dhaliwal <91633223+vijaivir@users.noreply.github.com> Date: Thu, 5 Sep 2024 12:02:16 -0700 Subject: [PATCH 1/2] Fix: Extend Form Submitter permissions for GET /documentTemplates (#1493) * removed template read permissions * migration to extend form submitter role * update form_submitter permission --- ...0240904140843_047-extend-submitter-role.js | 34 +++++++++++++++++++ app/src/forms/common/constants.js | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 app/src/db/migrations/20240904140843_047-extend-submitter-role.js diff --git a/app/src/db/migrations/20240904140843_047-extend-submitter-role.js b/app/src/db/migrations/20240904140843_047-extend-submitter-role.js new file mode 100644 index 000000000..c5519b811 --- /dev/null +++ b/app/src/db/migrations/20240904140843_047-extend-submitter-role.js @@ -0,0 +1,34 @@ +const uuid = require('uuid'); + +const { Permissions, Roles } = require('../../forms/common/constants'); + +const CREATED_BY = 'migration-047'; +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = function(knex) { + return Promise.resolve().then(() => { + const rolePermission = { + id: uuid.v4(), + createdBy: CREATED_BY, + role: Roles.FORM_SUBMITTER, + permission: Permissions.DOCUMENT_TEMPLATE_READ, + }; + return knex('role_permission').insert(rolePermission); + }); +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = function(knex) { + return Promise.resolve().then(() => + knex('role_permission') + .where({ + createdBy: CREATED_BY, + }) + .del() + ); +}; diff --git a/app/src/forms/common/constants.js b/app/src/forms/common/constants.js index 7d377bedf..6cd51fbf9 100644 --- a/app/src/forms/common/constants.js +++ b/app/src/forms/common/constants.js @@ -29,7 +29,7 @@ module.exports = Object.freeze({ FORM_API_UPDATE: 'form_api_update', FORM_DELETE: 'form_delete', FORM_READ: 'form_read', - FORM_SUBMITTER: ['form_read', 'submission_create'], + FORM_SUBMITTER: ['form_read', 'submission_create', 'document_template_read'], FORM_UPDATE: 'form_update', SUBMISSION_CREATE: 'submission_create', SUBMISSION_DELETE: 'submission_delete', From dbe9498a85bec759ccaa3e5f832b349afa672636 Mon Sep 17 00:00:00 2001 From: Walter Moar Date: Thu, 5 Sep 2024 14:21:23 -0700 Subject: [PATCH 2/2] docs: FORMS-1450 update the PR template (#1487) * docs: FORMS-1450 update the PR template Working on documentation for all things PR and using a commit body to improve my commits so I can document the process * docs: FORMS-1450 clean up the title description Small update to use a real-world example for the title * docs: FORMS-1450 remove markdown from title comment Removed the markdown from the comment, since it will never be rendered. * revert: FORMS-1450 switch type back to individual comments Realized that some people just might be uncommenting the type, where my way of working is to delete everything except the type --- .github/pull_request_template.md | 36 ++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ddef99018..b25b4f0aa 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,14 +1,25 @@ - + # Description - - - + -## Types of changes +## Type of Change - + @@ -18,6 +29,7 @@ + @@ -27,8 +39,10 @@ This is a breaking change because ... ## Checklist - - + - [ ] I have read the [CONTRIBUTING](/bcgov/common-hosted-form-service/blob/main/CONTRIBUTING.md) doc - [ ] I have checked that unit tests pass locally with my changes @@ -39,4 +53,8 @@ This is a breaking change because ... ## Further comments - +