Skip to content

Commit

Permalink
Merge pull request #203 from bcgov/add-additional-role
Browse files Browse the repository at this point in the history
add admin now grants generate_documents role
  • Loading branch information
mgtennant authored May 21, 2024
2 parents fbbddb6 + 7824f76 commit 3689f87
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion backend/src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ProvisionService } from 'src/provision/provision.service';
import { DocumentTypeService } from 'src/document_type/document_type.service';
import { DocumentType } from 'src/document_type/entities/document_type.entity';
import { TTLSService } from 'src/ttls/ttls.service';
import { Role } from 'src/enum/role.enum';

const axios = require('axios');

Expand Down Expand Up @@ -195,7 +196,24 @@ export class AdminService {
.post(
addAdminUrl,
{
roleName: 'ticdi_admin',
roleName: Role.TICDI_ADMIN,
username: userObject.idirUsername + '@idir',
operation: 'add',
},
{ headers: { Authorization: 'Bearer ' + bearerToken } }
)
.then((res) => {
return res.data;
})
.catch((err) => {
console.log(err);
throw new Error('Failed to add admin role');
});
await axios
.post(
addAdminUrl,
{
roleName: Role.GENERATE_DOCUMENTS,
username: userObject.idirUsername + '@idir',
operation: 'add',
},
Expand Down

0 comments on commit 3689f87

Please sign in to comment.