File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
main/kotlin/com/cosmotech/common/rbac
test/kotlin/com/cosmotech/common/rbac Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ const val PERMISSION_DELETE = "delete"
2222const val PERMISSION_LAUNCH = " launch"
2323const val PERMISSION_VALIDATE = " validate"
2424
25+ val NO_PERMISSIONS = emptyList<String >()
26+
2527val COMMON_ROLE_READER_PERMISSIONS = listOf (PERMISSION_READ )
2628val COMMON_ROLE_USER_PERMISSIONS =
2729 listOf (PERMISSION_READ , PERMISSION_READ_SECURITY , PERMISSION_CREATE_CHILDREN )
@@ -92,6 +94,7 @@ fun getCommonRolesDefinition(): RolesDefinition {
9294 return RolesDefinition (
9395 permissions =
9496 mutableMapOf (
97+ ROLE_NONE to NO_PERMISSIONS ,
9598 ROLE_VIEWER to COMMON_ROLE_READER_PERMISSIONS ,
9699 ROLE_USER to COMMON_ROLE_USER_PERMISSIONS ,
97100 ROLE_EDITOR to COMMON_ROLE_EDITOR_PERMISSIONS ,
@@ -104,6 +107,7 @@ fun getRunnerRolesDefinition(): RolesDefinition {
104107 return RolesDefinition (
105108 permissions =
106109 mutableMapOf (
110+ ROLE_NONE to NO_PERMISSIONS ,
107111 ROLE_VIEWER to RUNNER_ROLE_VIEWER_PERMISSIONS ,
108112 ROLE_EDITOR to RUNNER_ROLE_EDITOR_PERMISSIONS ,
109113 ROLE_VALIDATOR to RUNNER_ROLE_VALIDATOR_PERMISSIONS ,
Original file line number Diff line number Diff line change @@ -639,6 +639,7 @@ class CsmRbacTests {
639639 fun `get default role definition permissions` () {
640640 val expected: MutableMap <String , List <String >> =
641641 mutableMapOf (
642+ ROLE_NONE to NO_PERMISSIONS ,
642643 ROLE_VIEWER to COMMON_ROLE_READER_PERMISSIONS ,
643644 ROLE_USER to COMMON_ROLE_USER_PERMISSIONS ,
644645 ROLE_EDITOR to COMMON_ROLE_EDITOR_PERMISSIONS ,
@@ -660,6 +661,7 @@ class CsmRbacTests {
660661 definition.permissions.put(customRole, customRolePermissions)
661662 val expected: MutableMap <String , List <String >> =
662663 mutableMapOf (
664+ ROLE_NONE to NO_PERMISSIONS ,
663665 ROLE_VIEWER to COMMON_ROLE_READER_PERMISSIONS ,
664666 ROLE_USER to COMMON_ROLE_USER_PERMISSIONS ,
665667 ROLE_EDITOR to COMMON_ROLE_EDITOR_PERMISSIONS ,
You can’t perform that action at this time.
0 commit comments