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 - + 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',