Skip to content

Commit

Permalink
Shared Services connect
Browse files Browse the repository at this point in the history
  • Loading branch information
lenisha committed Sep 7, 2022
1 parent 9ad95a9 commit 10dd703
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion api_app/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.25"
__version__ = "0.4.26"
4 changes: 4 additions & 0 deletions api_app/models/domain/restricted_resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from multiprocessing import connection
from typing import Optional
"""from unicodedata import category"""
from pydantic import Field
from models.domain.resource import ResourceType
from models.domain.azuretremodel import AzureTREModel
Expand All @@ -8,6 +10,8 @@ class RestrictedProperties(AzureTREModel):
display_name: str = ""
description: str = ""
overview: str = ""
connection_uri: str = ""
category: str = ""


class RestrictedResource(AzureTREModel):
Expand Down
12 changes: 12 additions & 0 deletions api_app/schemas/shared_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@
"title": "Shared Service Overview",
"description": "Long form description of the shared service, in markdown syntax",
"updateable": true
},
"connection_uri": {
"type": "string",
"title": "Shared Service Connection URL",
"description": "Connection URL of the shared service",
"updateable": true
},
"category": {
"type": "string",
"title": "Shared Service category",
"description": "Category of the shared service",
"updateable": false
}
}
}
4 changes: 2 additions & 2 deletions templates/workspace_services/azureml/terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ output "azureml_storage_account_id" {
}

output "connection_uri" {
value = var.is_exposed_externally ? "https://ml.azure.com/?wsid=${azapi_resource.aml_workspace.id}%26tid=${var.arm_tenant_id}" : ""
value = var.is_exposed_externally ? "https://ml.azure.com/?wsid=${azapi_resource.aml_workspace.id}&tid=${var.arm_tenant_id}" : ""
}

output "internal_connection_uri" {
value = var.is_exposed_externally ? "" : "https://ml.azure.com/?wsid=${azapi_resource.aml_workspace.id}%26tid=${var.arm_tenant_id}"
value = var.is_exposed_externally ? "" : "https://ml.azure.com/?wsid=${azapi_resource.aml_workspace.id}&tid=${var.arm_tenant_id}"
}

output "workspace_services_subnet_address_prefix" {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/src/components/root/RootLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { LoadingState } from '../../models/loadingState';
import { SharedServices } from '../shared/SharedServices';
import { SharedServiceItem } from '../shared/SharedServiceItem';
import { SecuredByRole } from '../shared/SecuredByRole';
import { RoleName } from '../../models/roleNames';
import { RoleName, WorkspaceRoleName } from '../../models/roleNames';

export const RootLayout: React.FunctionComponent = () => {
const [workspaces, setWorkspaces] = useState([] as Array<Workspace>);
Expand Down Expand Up @@ -73,8 +73,8 @@ export const RootLayout: React.FunctionComponent = () => {
<Route path="/admin" element={<Admin />} />
<Route path="/shared-services/*" element={
<Routes>
<Route path="/" element={<SecuredByRole element={<SharedServices />} allowedRoles={[RoleName.TREAdmin]} errorString={"You must be a TRE Admin to access this area"}/>} />
<Route path=":sharedServiceId" element={<SecuredByRole element={<SharedServiceItem />} allowedRoles={[RoleName.TREAdmin]} errorString={"You must be a TRE Admin to access this area"}/>} />
<Route path="/" element={<SecuredByRole element={<SharedServices readonly={false}/>} allowedRoles={[RoleName.TREAdmin,WorkspaceRoleName.WorkspaceOwner]} errorString={"You must be a TRE Admin to access this area"}/>} />
<Route path=":sharedServiceId" element={<SecuredByRole element={<SharedServiceItem readonly={false}/>} allowedRoles={[RoleName.TREAdmin,WorkspaceRoleName.WorkspaceOwner]} errorString={"You must be a TRE Admin to access this area"}/>} />
</Routes>
} />
</Routes>
Expand Down
4 changes: 2 additions & 2 deletions ui/app/src/components/shared/SharedServices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SharedService } from '../../models/sharedService';
import { HttpMethod, useAuthApiCall } from '../../hooks/useAuthApiCall';
import { ApiEndpoint } from '../../models/apiEndpoints';
import { CreateUpdateResourceContext } from '../../contexts/CreateUpdateResourceContext';
import { RoleName } from '../../models/roleNames';
import { RoleName, WorkspaceRoleName } from '../../models/roleNames';
import { SecuredByRole } from './SecuredByRole';

interface SharedServiceProps{
Expand Down Expand Up @@ -55,7 +55,7 @@ export const SharedServices: React.FunctionComponent<SharedServiceProps> = (prop
<h1>Shared Services</h1>
{
!props.readonly &&
<SecuredByRole allowedRoles={[RoleName.TREAdmin]} workspaceAuth={false} element={
<SecuredByRole allowedRoles={[RoleName.TREAdmin, WorkspaceRoleName.WorkspaceOwner]} workspaceAuth={false} element={
<PrimaryButton iconProps={{ iconName: 'Add' }} text="Create new" onClick={() => {
createFormCtx.openCreateForm({
resourceType: ResourceType.SharedService,
Expand Down
9 changes: 7 additions & 2 deletions ui/app/src/components/workspaces/WorkspaceProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import { SharedService } from '../../models/sharedService';
import { SharedServices } from '../shared/SharedServices';
import { SharedServiceItem } from '../shared/SharedServiceItem';
import { Airlock } from '../shared/airlock/Airlock';
import { SecuredByRole } from '../shared/SecuredByRole';
import { RoleName, WorkspaceRoleName } from '../../models/roleNames';


export const WorkspaceProvider: React.FunctionComponent = () => {
const apiCall = useAuthApiCall();
Expand Down Expand Up @@ -127,11 +130,13 @@ export const WorkspaceProvider: React.FunctionComponent = () => {
removeWorkspaceService={(ws: WorkspaceService) => removeWorkspaceService(ws)} />
} />
<Route path="shared-services" element={
<SharedServices readonly={true} />
<SecuredByRole element={<SharedServices />} allowedRoles={[RoleName.TREAdmin,WorkspaceRoleName.WorkspaceOwner]} errorString={"You must be a TRE Admin to access this area"}/>
} />

<Route path="shared-services/:sharedServiceId/*" element={
<SharedServiceItem readonly={true} />
<SecuredByRole element={<SharedServiceItem />} allowedRoles={[RoleName.TREAdmin,WorkspaceRoleName.WorkspaceOwner]} errorString={"You must be a TRE Admin to access this area"}/>
} />

<Route path="requests/*" element={
<Airlock/>
} />
Expand Down

0 comments on commit 10dd703

Please sign in to comment.