Skip to content

Commit 0d54122

Browse files
modify test after role_viewer reading rights removal
modified tests in all services after role_viewer got the right to read security
1 parent 9983041 commit 0d54122

File tree

9 files changed

+44
-53
lines changed

9 files changed

+44
-53
lines changed

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ val springWebVersion = "6.1.4"
5454

5555
// Implementation
5656
val kotlinJvmTarget = 21
57-
val cosmotechApiCommonVersion = "2.0.0-SNAPSHOT"
57+
val cosmotechApiCommonVersion = "2.0.1-SNAPSHOT"
5858
val jedisVersion = "4.4.6"
5959
val springOauthVersion = "6.2.2"
6060
val redisOmSpringVersion = "0.9.1"
@@ -131,6 +131,7 @@ allprojects {
131131
configurations { all { resolutionStrategy { force("com.redis.om:redis-om-spring:0.9.1") } } }
132132

133133
repositories {
134+
mavenLocal()
134135
maven {
135136
name = "GitHubPackages"
136137
url = uri("https://maven.pkg.github.com/Cosmo-Tech/cosmotech-api-common")

dataset/src/integrationTest/kotlin/com/cosmotech/dataset/service/DatasetServiceRBACTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,7 @@ class DatasetServiceRBACTest : CsmRedisTestBase() {
18581858
@TestFactory
18591859
fun `test Dataset RBAC getDatasetAccessControl`() =
18601860
mapOf(
1861-
ROLE_VIEWER to false,
1861+
ROLE_VIEWER to true,
18621862
ROLE_EDITOR to false,
18631863
ROLE_USER to false,
18641864
ROLE_NONE to true,
@@ -2104,7 +2104,7 @@ class DatasetServiceRBACTest : CsmRedisTestBase() {
21042104
@TestFactory
21052105
fun `test Dataset RBAC getDatasetSecurityUsers`() =
21062106
mapOf(
2107-
ROLE_VIEWER to false,
2107+
ROLE_VIEWER to true,
21082108
ROLE_EDITOR to false,
21092109
ROLE_USER to false,
21102110
ROLE_NONE to true,
@@ -2180,7 +2180,7 @@ class DatasetServiceRBACTest : CsmRedisTestBase() {
21802180
@TestFactory
21812181
fun `test Dataset RBAC getDatasetSecurity`() =
21822182
mapOf(
2183-
ROLE_VIEWER to false,
2183+
ROLE_VIEWER to true,
21842184
ROLE_EDITOR to false,
21852185
ROLE_USER to false,
21862186
ROLE_NONE to true,

organization/src/integrationTest/kotlin/com/cosmotech/organization/service/OrganizationServiceIntegrationTest.kt

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
364364
component = "organization",
365365
roles =
366366
mutableMapOf(
367-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
367+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
368368
ROLE_USER to
369369
mutableListOf(
370370
PERMISSION_READ,
@@ -389,7 +389,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
389389
component = "workspace",
390390
roles =
391391
mutableMapOf(
392-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
392+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
393393
ROLE_USER to
394394
mutableListOf(
395395
PERMISSION_READ,
@@ -414,7 +414,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
414414
component = "runner",
415415
roles =
416416
mutableMapOf(
417-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
417+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
418418
ROLE_EDITOR to
419419
mutableListOf(
420420
PERMISSION_READ,
@@ -450,8 +450,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
450450
var organizationUserPermissions =
451451
organizationApiService.getOrganizationPermissions(
452452
organizationRegistered.id!!, ROLE_VIEWER)
453-
assertEquals(
454-
mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY), organizationUserPermissions)
453+
assertEquals(mutableListOf(PERMISSION_READ), organizationUserPermissions)
455454
organizationUserPermissions =
456455
organizationApiService.getOrganizationPermissions(
457456
organizationRegistered.id!!, ROLE_USER)
@@ -494,14 +493,12 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
494493
runAsDifferentOrganizationUser()
495494
val organizationRegistered =
496495
organizationApiService.registerOrganization(
497-
createTestOrganizationWithSimpleSecurity(
498-
name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
496+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
499497
runAsOrganizationUser()
500498
var organizationUserPermissions =
501499
organizationApiService.getOrganizationPermissions(
502500
organizationRegistered.id!!, ROLE_VIEWER)
503-
assertEquals(
504-
mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY), organizationUserPermissions)
501+
assertEquals(mutableListOf(PERMISSION_READ), organizationUserPermissions)
505502
organizationUserPermissions =
506503
organizationApiService.getOrganizationPermissions(
507504
organizationRegistered.id!!, ROLE_USER)
@@ -573,8 +570,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
573570
runAsDifferentOrganizationUser()
574571
val organizationRegistered =
575572
organizationApiService.registerOrganization(
576-
createTestOrganizationWithSimpleSecurity(
577-
name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
573+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
578574
runAsOrganizationUser()
579575
assertNotNull(organizationApiService.getOrganizationSecurity(organizationRegistered.id!!))
580576
}
@@ -685,14 +681,13 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
685681
runAsDifferentOrganizationUser()
686682
val organizationRegistered =
687683
organizationApiService.registerOrganization(
688-
createTestOrganizationWithSimpleSecurity(
689-
name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
684+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
690685
runAsOrganizationUser()
691686
val organizationRole =
692687
organizationApiService.getOrganizationAccessControl(
693688
organizationRegistered.id!!, TEST_USER_ID)
694689
assertNotNull(organizationRole)
695-
assertEquals(ROLE_VIEWER, organizationRole.role)
690+
assertEquals(ROLE_USER, organizationRole.role)
696691
assertEquals(TEST_USER_ID, organizationRole.id)
697692
}
698693
}
@@ -704,8 +699,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
704699
runAsDifferentOrganizationUser()
705700
val organizationRegistered =
706701
organizationApiService.registerOrganization(
707-
createTestOrganizationWithSimpleSecurity(
708-
name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
702+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
709703
runAsOrganizationUser()
710704
organizationApiService.getOrganizationAccessControl(
711705
organizationRegistered.id!!, UNKNOWN_IDENTIFIER)
@@ -793,8 +787,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
793787
runAsDifferentOrganizationUser()
794788
val organizationRegistered =
795789
organizationApiService.registerOrganization(
796-
createTestOrganizationWithSimpleSecurity(
797-
name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
790+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
798791
runAsOrganizationUser()
799792
assertThrows<CsmResourceNotFoundException> {
800793
organizationApiService.getOrganizationAccessControl(
@@ -1013,7 +1006,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
10131006
runAsDifferentOrganizationUser()
10141007
val organizationRegistered =
10151008
organizationApiService.registerOrganization(
1016-
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_VIEWER))
1009+
createTestOrganizationWithSimpleSecurity(name, TEST_USER_ID, ROLE_NONE, ROLE_USER))
10171010
runAsOrganizationUser()
10181011
val orgaUsers =
10191012
organizationApiService.getOrganizationSecurityUsers(organizationRegistered.id!!)
@@ -1292,7 +1285,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
12921285
component = "organization",
12931286
roles =
12941287
mutableMapOf(
1295-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
1288+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
12961289
ROLE_USER to
12971290
mutableListOf(
12981291
PERMISSION_READ,
@@ -1317,7 +1310,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
13171310
component = "workspace",
13181311
roles =
13191312
mutableMapOf(
1320-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
1313+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
13211314
ROLE_USER to
13221315
mutableListOf(
13231316
PERMISSION_READ,
@@ -1342,7 +1335,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
13421335
component = "runner",
13431336
roles =
13441337
mutableMapOf(
1345-
ROLE_VIEWER to mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY),
1338+
ROLE_VIEWER to mutableListOf(PERMISSION_READ),
13461339
ROLE_EDITOR to
13471340
mutableListOf(
13481341
PERMISSION_READ,
@@ -1378,8 +1371,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
13781371
var organizationUserPermissions =
13791372
organizationApiService.getOrganizationPermissions(
13801373
organizationRegistered.id!!, ROLE_VIEWER)
1381-
assertEquals(
1382-
mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY), organizationUserPermissions)
1374+
assertEquals(mutableListOf(PERMISSION_READ), organizationUserPermissions)
13831375
organizationUserPermissions =
13841376
organizationApiService.getOrganizationPermissions(
13851377
organizationRegistered.id!!, ROLE_USER)
@@ -1428,8 +1420,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
14281420
var organizationUserPermissions =
14291421
organizationApiService.getOrganizationPermissions(
14301422
organizationRegistered.id!!, ROLE_VIEWER)
1431-
assertEquals(
1432-
mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY), organizationUserPermissions)
1423+
assertEquals(mutableListOf(PERMISSION_READ), organizationUserPermissions)
14331424
organizationUserPermissions =
14341425
organizationApiService.getOrganizationPermissions(
14351426
organizationRegistered.id!!, ROLE_USER)
@@ -1478,8 +1469,7 @@ class OrganizationServiceIntegrationTest : CsmRedisTestBase() {
14781469
var organizationUserPermissions =
14791470
organizationApiService.getOrganizationPermissions(
14801471
organizationRegistered.id!!, ROLE_VIEWER)
1481-
assertEquals(
1482-
mutableListOf(PERMISSION_READ, PERMISSION_READ_SECURITY), organizationUserPermissions)
1472+
assertEquals(mutableListOf(PERMISSION_READ), organizationUserPermissions)
14831473
organizationUserPermissions =
14841474
organizationApiService.getOrganizationPermissions(
14851475
organizationRegistered.id!!, ROLE_USER)

organization/src/integrationTest/kotlin/com/cosmotech/organization/service/OrganizationServiceRBACTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class OrganizationServiceRBACTest : CsmRedisTestBase() {
196196
@TestFactory
197197
fun `test RBAC getOrganizationPermissions`() =
198198
mapOf(
199-
ROLE_VIEWER to false,
199+
ROLE_VIEWER to true,
200200
ROLE_EDITOR to false,
201201
ROLE_VALIDATOR to true,
202202
ROLE_USER to false,
@@ -227,7 +227,7 @@ class OrganizationServiceRBACTest : CsmRedisTestBase() {
227227
@TestFactory
228228
fun `test RBAC getOrganizationSecurity`() =
229229
mapOf(
230-
ROLE_VIEWER to false,
230+
ROLE_VIEWER to true,
231231
ROLE_EDITOR to false,
232232
ROLE_VALIDATOR to true,
233233
ROLE_USER to false,
@@ -327,7 +327,7 @@ class OrganizationServiceRBACTest : CsmRedisTestBase() {
327327
@TestFactory
328328
fun `test RBAC getOrganizationAccessControl`() =
329329
mapOf(
330-
ROLE_VIEWER to false,
330+
ROLE_VIEWER to true,
331331
ROLE_EDITOR to false,
332332
ROLE_VALIDATOR to true,
333333
ROLE_USER to false,
@@ -429,7 +429,7 @@ class OrganizationServiceRBACTest : CsmRedisTestBase() {
429429
@TestFactory
430430
fun `test RBAC getOrganizationSecurityUsers`() =
431431
mapOf(
432-
ROLE_VIEWER to false,
432+
ROLE_VIEWER to true,
433433
ROLE_EDITOR to false,
434434
ROLE_VALIDATOR to true,
435435
ROLE_USER to false,

organization/src/test/kotlin/com/cosmotech/organization/service/OrganizationServiceImplTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ class OrganizationServiceImplTests {
210210
@TestFactory
211211
fun `test RBAC getOrganizationSecurity organization`() =
212212
mapOf(
213-
ROLE_VIEWER to false,
213+
ROLE_VIEWER to true,
214214
ROLE_EDITOR to false,
215215
ROLE_ADMIN to false,
216216
ROLE_VALIDATOR to true,
@@ -243,7 +243,7 @@ class OrganizationServiceImplTests {
243243
@TestFactory
244244
fun `test RBAC getOrganizationAccessControl organization`() =
245245
mapOf(
246-
ROLE_VIEWER to false,
246+
ROLE_VIEWER to true,
247247
ROLE_EDITOR to false,
248248
ROLE_ADMIN to false,
249249
ROLE_VALIDATOR to true,
@@ -312,7 +312,7 @@ class OrganizationServiceImplTests {
312312
@TestFactory
313313
fun `test getOrganizationSecurityUsers`() =
314314
mapOf(
315-
ROLE_VIEWER to false,
315+
ROLE_VIEWER to true,
316316
ROLE_EDITOR to false,
317317
ROLE_ADMIN to false,
318318
ROLE_VALIDATOR to true,

runner/src/integrationTest/kotlin/com/cosmotech/runner/service/RunnerServiceRBACTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,7 +1953,7 @@ class RunnerServiceRBACTest : CsmRedisTestBase() {
19531953
@TestFactory
19541954
fun `test Runner RBAC getRunnerPermissions`() =
19551955
mapOf(
1956-
ROLE_VIEWER to false,
1956+
ROLE_VIEWER to true,
19571957
ROLE_EDITOR to false,
19581958
ROLE_VALIDATOR to false,
19591959
ROLE_NONE to true,
@@ -2276,7 +2276,7 @@ class RunnerServiceRBACTest : CsmRedisTestBase() {
22762276
@TestFactory
22772277
fun `test Runner RBAC getRunnerSecurity`() =
22782278
mapOf(
2279-
ROLE_VIEWER to false,
2279+
ROLE_VIEWER to true,
22802280
ROLE_EDITOR to false,
22812281
ROLE_VALIDATOR to false,
22822282
ROLE_NONE to true,
@@ -3322,7 +3322,7 @@ class RunnerServiceRBACTest : CsmRedisTestBase() {
33223322
@TestFactory
33233323
fun `test Runner RBAC getRunnerAccessControl`() =
33243324
mapOf(
3325-
ROLE_VIEWER to false,
3325+
ROLE_VIEWER to true,
33263326
ROLE_EDITOR to false,
33273327
ROLE_VALIDATOR to false,
33283328
ROLE_NONE to true,
@@ -4391,7 +4391,7 @@ class RunnerServiceRBACTest : CsmRedisTestBase() {
43914391
@TestFactory
43924392
fun `test Runner RBAC getRunnerSecurityUsers`() =
43934393
mapOf(
4394-
ROLE_VIEWER to false,
4394+
ROLE_VIEWER to true,
43954395
ROLE_EDITOR to false,
43964396
ROLE_VALIDATOR to false,
43974397
ROLE_NONE to true,

solution/src/integrationTest/kotlin/com/cosmotech/solution/service/SolutionServiceRBACTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ class SolutionServiceRBACTest : CsmRedisTestBase() {
519519
@TestFactory
520520
fun `test Solution RBAC getSolutionAccessControl`() =
521521
mapOf(
522-
ROLE_VIEWER to false,
522+
ROLE_VIEWER to true,
523523
ROLE_EDITOR to false,
524524
ROLE_USER to false,
525525
ROLE_NONE to true,
@@ -596,7 +596,7 @@ class SolutionServiceRBACTest : CsmRedisTestBase() {
596596
@TestFactory
597597
fun `test Solution RBAC getSolutionSecurityUsers`() =
598598
mapOf(
599-
ROLE_VIEWER to false,
599+
ROLE_VIEWER to true,
600600
ROLE_EDITOR to false,
601601
ROLE_USER to false,
602602
ROLE_NONE to true,
@@ -1473,7 +1473,7 @@ class SolutionServiceRBACTest : CsmRedisTestBase() {
14731473
@TestFactory
14741474
fun `test Solution RBAC getSolutionSecurity`() =
14751475
mapOf(
1476-
ROLE_VIEWER to false,
1476+
ROLE_VIEWER to true,
14771477
ROLE_EDITOR to false,
14781478
ROLE_USER to false,
14791479
ROLE_NONE to true,

workspace/src/integrationTest/kotlin/com/cosmotech/workspace/service/WorkspaceServiceRBACTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ class WorkspaceServiceRBACTest : CsmRedisTestBase() {
10351035
@TestFactory
10361036
fun `test Workspace RBAC getWorkspacePermissions`() =
10371037
mapOf(
1038-
ROLE_VIEWER to false,
1038+
ROLE_VIEWER to true,
10391039
ROLE_EDITOR to false,
10401040
ROLE_USER to false,
10411041
ROLE_NONE to true,
@@ -1127,7 +1127,7 @@ class WorkspaceServiceRBACTest : CsmRedisTestBase() {
11271127
@TestFactory
11281128
fun `test Workspace RBAC getWorkspaceSecurity`() =
11291129
mapOf(
1130-
ROLE_VIEWER to false,
1130+
ROLE_VIEWER to true,
11311131
ROLE_EDITOR to false,
11321132
ROLE_USER to false,
11331133
ROLE_NONE to true,
@@ -1411,7 +1411,7 @@ class WorkspaceServiceRBACTest : CsmRedisTestBase() {
14111411
@TestFactory
14121412
fun `test Workspace RBAC getWorkspaceAccessControl`() =
14131413
mapOf(
1414-
ROLE_VIEWER to false,
1414+
ROLE_VIEWER to true,
14151415
ROLE_EDITOR to false,
14161416
ROLE_USER to false,
14171417
ROLE_NONE to true,
@@ -1699,7 +1699,7 @@ class WorkspaceServiceRBACTest : CsmRedisTestBase() {
16991699
@TestFactory
17001700
fun `test Workspace RBAC getWorkspaceSecurityUsers`() =
17011701
mapOf(
1702-
ROLE_VIEWER to false,
1702+
ROLE_VIEWER to true,
17031703
ROLE_EDITOR to false,
17041704
ROLE_USER to false,
17051705
ROLE_NONE to true,

workspace/src/test/kotlin/com/cosmotech/workspace/service/WorkspaceServiceImplTests.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ class WorkspaceServiceImplTests {
470470
@TestFactory
471471
fun `test RBAC get workspace security`() =
472472
mapOf(
473-
ROLE_VIEWER to false,
473+
ROLE_VIEWER to true,
474474
ROLE_EDITOR to false,
475475
ROLE_ADMIN to false,
476476
ROLE_VALIDATOR to true,
@@ -504,7 +504,7 @@ class WorkspaceServiceImplTests {
504504
@TestFactory
505505
fun `test RBAC get workspace access control`() =
506506
mapOf(
507-
ROLE_VIEWER to false,
507+
ROLE_VIEWER to true,
508508
ROLE_EDITOR to false,
509509
ROLE_ADMIN to false,
510510
ROLE_VALIDATOR to true,
@@ -579,7 +579,7 @@ class WorkspaceServiceImplTests {
579579
@TestFactory
580580
fun `test RBAC get workspace security users`() =
581581
mapOf(
582-
ROLE_VIEWER to false,
582+
ROLE_VIEWER to true,
583583
ROLE_EDITOR to false,
584584
ROLE_ADMIN to false,
585585
ROLE_VALIDATOR to true,

0 commit comments

Comments
 (0)