forked from janus-idp/backstage-plugins
-
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.
feat(rbac): save role modification information to the metadata (janus…
…-idp#1280) * feat(rbac): save role modification information to the metadata Signed-off-by: Oleksandr Andriienko <[email protected]>
- Loading branch information
1 parent
57dee0c
commit 0454509
Showing
18 changed files
with
1,609 additions
and
239 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
plugins/rbac-backend/migrations/20240404111242_migrations.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,41 @@ | ||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.up = async function up(knex) { | ||
const isRoleMetaDataExist = await knex.schema.hasTable('role-metadata'); | ||
if (isRoleMetaDataExist) { | ||
await knex.schema.alterTable('role-metadata', table => { | ||
table.string('author'); | ||
table.string('modifiedBy'); | ||
table.dateTime('createdAt'); | ||
table.dateTime('lastModified'); | ||
}); | ||
|
||
await knex('role-metadata') | ||
.update({ | ||
description: | ||
'The default permission policy for the admin role allows for the creation, deletion, updating, and reading of roles and permission policies.', | ||
author: 'application configuration', | ||
modifiedBy: 'application configuration', | ||
lastModified: new Date().toUTCString(), | ||
}) | ||
.where('roleEntityRef', 'role:default/rbac_admin'); | ||
} | ||
}; | ||
|
||
/** | ||
* @param { import("knex").Knex } knex | ||
* @returns { Promise<void> } | ||
*/ | ||
exports.down = async function down(knex) { | ||
const isRoleMetaDataExist = await knex.schema.hasTable('role-metadata'); | ||
if (isRoleMetaDataExist) { | ||
await knex.schema.alterTable('role-metadata', table => { | ||
table.dropColumn('author'); | ||
table.dropColumn('modifiedBy'); | ||
table.dropColumn('createdAt'); | ||
table.dropColumn('lastModified'); | ||
}); | ||
} | ||
}; |
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
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
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
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
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
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
Oops, something went wrong.