Commit 4dbc14a4 authored by Varunkumar Manohar's avatar Varunkumar Manohar
Browse files

Ensure subproject list entities have acls + ensure old subprojects have...

Ensure subproject list entities have acls  + ensure old subprojects have service groups in the list result
parent 647b112e
Pipeline #31794 passed with stages
in 6 minutes and 52 seconds
......@@ -47,18 +47,18 @@ export class SubProjectDAO {
// Fix entities with no acls
if (!entity.acls) {
const tenant = await TenantDAO.get(tenantName)
// const tenant = await TenantDAO.get(tenantName)
const acls = {
'admins': [],
'viewers': []
}
// const acls = {
// 'admins': [],
// 'viewers': []
// }
acls.admins.push(SubprojectGroups.oldAdminGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
acls.admins.push(SubprojectGroups.oldEditorGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
acls.viewers.push(SubprojectGroups.oldViewerGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
// acls.admins.push(SubprojectGroups.oldAdminGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
// acls.admins.push(SubprojectGroups.oldEditorGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
// acls.viewers.push(SubprojectGroups.oldViewerGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
entity.acls = acls
entity.acls = await this.constructServiceGroupACLs(entity, tenantName)
}
return entity;
......@@ -100,6 +100,11 @@ export class SubProjectDAO {
for (const entity of entities) {
if (!entity.name) { entity.name = entity[journalClient.KEY].name; }
if (!entity.tenant) { entity.tenant = tenantName; }
if (!entity.acls) {
entity.acls = await this.constructServiceGroupACLs(entity, tenantName)
}
}
}
return entities;
......@@ -113,4 +118,21 @@ export class SubProjectDAO {
return entity !== undefined;
}
public static async constructServiceGroupACLs(entity, tenantName: string) {
const tenant = await TenantDAO.get(tenantName)
const acls = {
'admins': [],
'viewers': []
}
acls.admins.push(SubprojectGroups.oldAdminGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
acls.admins.push(SubprojectGroups.oldEditorGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
acls.viewers.push(SubprojectGroups.oldViewerGroupName(entity.tenant, entity.name) + '@' + tenant.esd)
return acls
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment