67ba021e36
* Add UI feature allowing database role credential rotation * Only show the 'rotate credentials' option for static roles * rotate role path uses id for permissions * Add rotate credentials button to show page on static role * Mirage handlers for role for simple testing * Add changelog * lint rules * fix lint Co-authored-by: Bartek Marczak <bartek.marczak@gmail.com>
28 lines
706 B
JavaScript
28 lines
706 B
JavaScript
export default function (server) {
|
|
server.get('/database/static-roles', function () {
|
|
return {
|
|
data: { keys: ['dev-static', 'prod-static'] },
|
|
};
|
|
});
|
|
|
|
server.get('/database/static-roles/:rolename', function (db, req) {
|
|
if (req.params.rolename.includes('tester')) {
|
|
return new Response(400);
|
|
}
|
|
return {
|
|
data: {
|
|
rotation_statements: [
|
|
'{ "db": "admin", "roles": [{ "role": "readWrite" }, {"role": "read", "db": "foo"}] }',
|
|
],
|
|
db_name: 'connection',
|
|
username: 'alice',
|
|
rotation_period: '1h',
|
|
},
|
|
};
|
|
});
|
|
|
|
server.post('/database/rotate-role/:rolename', function () {
|
|
return new Response(204);
|
|
});
|
|
}
|