-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ID-1328 system resource access policy creation on boot (#1482)
- Loading branch information
Showing
7 changed files
with
271 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,26 @@ prometheus { | |
|
||
admin { | ||
serviceAccountAdmins = ${?SERVICE_ACCOUNT_ADMINS} | ||
} | ||
|
||
resourceAccessPolicies { | ||
resource_type_admin { | ||
workspace { | ||
rawls-policy { | ||
memberEmails = ["[email protected]"] | ||
descendantPermissions = [ | ||
{ | ||
resourceTypeName = "workspace", | ||
roles = ["owner"] | ||
} | ||
] | ||
} | ||
} | ||
kubernetes-app { | ||
leo-policy { | ||
memberEmails = ["[email protected]"] | ||
roles = ["support"] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
package org.broadinstitute.dsde.workbench.sam.config | ||
|
||
import com.typesafe.config.{ConfigException, ConfigFactory, ConfigValueFactory} | ||
import org.broadinstitute.dsde.workbench.model.WorkbenchEmail | ||
import org.broadinstitute.dsde.workbench.sam.model.api.AccessPolicyMembershipRequest | ||
import org.broadinstitute.dsde.workbench.sam.model.{ | ||
AccessPolicyDescendantPermissions, | ||
AccessPolicyName, | ||
FullyQualifiedPolicyId, | ||
FullyQualifiedResourceId, | ||
ResourceId, | ||
ResourceRoleName, | ||
ResourceTypeName, | ||
SamResourceTypes | ||
} | ||
import org.scalatest.flatspec.AnyFlatSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
|
@@ -36,4 +48,28 @@ class AppConfigSpec extends AnyFlatSpec with Matchers { | |
AppConfig.readConfig(combinedConfig.withoutPath("googleServices.appName")) | ||
} | ||
} | ||
|
||
it should "load resourceAccessPolicies" in { | ||
val appConfig = AppConfig.load | ||
appConfig.resourceAccessPolicies should contain allElementsOf Map( | ||
FullyQualifiedPolicyId(FullyQualifiedResourceId(SamResourceTypes.resourceTypeAdminName, ResourceId("workspace")), AccessPolicyName("rawls-policy")) -> | ||
AccessPolicyMembershipRequest( | ||
Set(WorkbenchEmail("[email protected]")), | ||
Set.empty, | ||
Set.empty, | ||
Some( | ||
Set( | ||
AccessPolicyDescendantPermissions( | ||
ResourceTypeName("workspace"), | ||
Set.empty, | ||
Set(ResourceRoleName("owner")) | ||
) | ||
) | ||
), | ||
None | ||
), | ||
FullyQualifiedPolicyId(FullyQualifiedResourceId(SamResourceTypes.resourceTypeAdminName, ResourceId("kubernetes-app")), AccessPolicyName("leo-policy")) -> | ||
AccessPolicyMembershipRequest(Set(WorkbenchEmail("[email protected]")), Set.empty, Set(ResourceRoleName("support")), None, None) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters