Skip to content

Commit 27a6dee

Browse files
Sergey PolyarusSergey Polyarus
authored andcommitted
Fix errors from last Rbac commons
1 parent 0c453fc commit 27a6dee

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

organization/src/main/kotlin/com/cosmotech/organization/azure/OrganizationServiceImpl.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,7 @@ class OrganizationServiceImpl(private val csmRbac: CsmRbac, private val csmAdmin
144144
hasChanged = true
145145
}
146146
if (organization.security != null && existingOrganization.security == null) {
147-
if (csmRbac.isAdmin(
148-
organization.getRbac(),
149-
getCurrentAuthenticatedMail(this.csmPlatformProperties),
150-
getCommonRolesDefinition())) {
147+
if (csmRbac.isAdmin(organization.getRbac(), getCommonRolesDefinition())) {
151148
existingOrganization.security = organization.security
152149
hasChanged = true
153150
} else {

scenario/src/main/kotlin/com/cosmotech/scenario/azure/ScenarioServiceImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ internal class ScenarioServiceImpl(
391391
templateQuery += " AND $sqlCondition"
392392
sqlParams.forEach { params.add(it) }
393393
}
394-
val isAdmin = csmRbac.isAdmin(workspace.getRbac(), currentUser, getCommonRolesDefinition())
394+
val isAdmin = csmRbac.isAdmin(workspace.getRbac(), getCommonRolesDefinition())
395395
if (!isAdmin && this.csmPlatformProperties.rbac.enabled) {
396396
templateQuery +=
397397
" AND (ARRAY_CONTAINS(c.security.accessControlList, {id: @ACL_USER}, true) " +
@@ -607,10 +607,7 @@ internal class ScenarioServiceImpl(
607607
}
608608

609609
if (scenario.security != null && existingScenario.security == null) {
610-
if (csmRbac.isAdmin(
611-
organization.getRbac(),
612-
getCurrentAuthenticatedMail(this.csmPlatformProperties),
613-
getCommonRolesDefinition())) {
610+
if (csmRbac.isAdmin(organization.getRbac(), getCommonRolesDefinition())) {
614611
existingScenario.security = scenario.security
615612
hasChanged = true
616613
} else {

scenario/src/test/kotlin/com/cosmotech/scenario/azure/ScenarioServiceImplTests.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ class ScenarioServiceImplTests {
549549
every { workspace.security } returns workspaceSecurity
550550
every { workspace.security?.default } returns String()
551551
every { workspace.security?.accessControlList } returns mutableListOf()
552-
every { csmRbac.isAdmin(any(), any(), any()) } returns true
552+
every { csmRbac.isAdmin(any(), any()) } returns true
553553

554554
val authentication =
555555
mockk<CsmPlatformProperties.CsmPlatformAzure.CsmPlatformAzureEventBus.Authentication>()

workspace/src/main/kotlin/com/cosmotech/workspace/azure/WorkspaceServiceImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ internal class WorkspaceServiceImpl(
7676
val currentUser = getCurrentAuthenticatedMail(this.csmPlatformProperties)
7777
val organization = organizationService.findOrganizationById(organizationId)
7878
logger.debug("Getting workspaces for user $currentUser")
79-
val isAdmin = csmRbac.isAdmin(organization.getRbac(), currentUser, getCommonRolesDefinition())
79+
val isAdmin = csmRbac.isAdmin(organization.getRbac(), getCommonRolesDefinition())
8080
if (isAdmin || !this.csmPlatformProperties.rbac.enabled) {
8181
return cosmosTemplate.findAll("${organizationId}_workspaces")
8282
}
@@ -176,10 +176,7 @@ internal class WorkspaceServiceImpl(
176176
}
177177

178178
if (workspace.security != null && existingWorkspace.security == null) {
179-
if (csmRbac.isAdmin(
180-
workspace.getRbac(),
181-
getCurrentAuthenticatedMail(this.csmPlatformProperties),
182-
getCommonRolesDefinition())) {
179+
if (csmRbac.isAdmin(workspace.getRbac(), getCommonRolesDefinition())) {
183180
existingWorkspace.security = workspace.security
184181
hasChanged = true
185182
} else {

0 commit comments

Comments
 (0)