forked from bcgov/common-hosted-form-service
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Extend Form Submitter permissions for GET /documentTemplates (bc…
…gov#1493) * removed template read permissions * migration to extend form submitter role * update form_submitter permission
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
app/src/db/migrations/20240904140843_047-extend-submitter-role.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<void> } | ||
*/ | ||
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<void> } | ||
*/ | ||
exports.down = function(knex) { | ||
return Promise.resolve().then(() => | ||
knex('role_permission') | ||
.where({ | ||
createdBy: CREATED_BY, | ||
}) | ||
.del() | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters