Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Jun 14, 2024
1 parent 6f34bf4 commit c64a541
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 45 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/build-orthanc-share.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:

- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
Expand All @@ -29,14 +29,14 @@ jobs:
./sources/tests/run-tests.sh
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker (orthanc-nginx)
id: meta-orthanc-nginx
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/orthanc-nginx
labels: |
Expand All @@ -45,7 +45,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker (orthanc-auth-service)
id: meta-orthanc-auth-service
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/orthanc-auth-service
labels: |
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker (meddream-viewer)
id: meta-meddream-viewer
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/meddream-viewer
labels: |
Expand All @@ -63,7 +63,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker (meddream-token-service)
id: meta-meddream-token-service
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/meddream-token-service
labels: |
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Extract metadata (tags, labels) for Docker (orthanc-keycloak)
id: meta-orthanc-keycloak
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/orthanc-keycloak
labels: |
Expand All @@ -81,15 +81,15 @@ jobs:
- name: Extract metadata (tags, labels) for Docker (ohif-v3)
id: meta-ohif-v3
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: orthancteam/ohif-v3
labels: |
org.opencontainers.image.title=ohif-v3
org.opencontainers.image.vendor=Orthanc Team SRL
- name: Build and push orthanc-nginx Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/
file: sources/nginx/Dockerfile.orthanc-nginx
Expand All @@ -98,7 +98,7 @@ jobs:
labels: ${{ steps.meta-orthanc-nginx.outputs.labels }}

- name: Build and push orthanc-auth-service Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/
file: sources/Dockerfile.orthanc-auth-service
Expand All @@ -107,7 +107,7 @@ jobs:
labels: ${{ steps.meta-orthanc-auth-service.outputs.labels }}

- name: Build and push meddream-viewer Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/meddream/viewer
file: sources/meddream/viewer/Dockerfile.meddream-viewer
Expand All @@ -116,7 +116,7 @@ jobs:
labels: ${{ steps.meta-meddream-viewer.outputs.labels }}

- name: Build and push meddream-token-service Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/meddream/token-service
file: sources/meddream/token-service/Dockerfile.meddream-token-service
Expand All @@ -125,7 +125,7 @@ jobs:
labels: ${{ steps.meta-meddream-token-service.outputs.labels }}

- name: Build and push orthanc-keycloak Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/
file: sources/keycloak/Dockerfile.orthanc-keycloak
Expand All @@ -134,7 +134,7 @@ jobs:
labels: ${{ steps.meta-orthanc-keycloak.outputs.labels }}

- name: Build and push ohif-v3 Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: sources/ohif/
file: sources/ohif/Dockerfile.ohif-v3
Expand Down
2 changes: 1 addition & 1 deletion minimal-setup/keycloak/permissions.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"roles" : {
"admin-role": {
"permissions": ["all"],
"permissions": ["all", "admin-permissions"],
"authorized_labels": ["*"]
},
"doctor-role": {
Expand Down
2 changes: 1 addition & 1 deletion sources/orthanc_auth_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def get_settings_roles():
return roles_config


@app.post("/settings/roles", dependencies=basic_auth_dependencies)
@app.put("/settings/roles", dependencies=basic_auth_dependencies)
def set_settings_roles(roles_config_request: RolesConfigurationModel):
logging.info("set settings roles ")

Expand Down
4 changes: 3 additions & 1 deletion sources/orthanc_auth_service/shares/keycloak.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def get_user_profile_from_token(self, jwt_token: str) -> UserProfileResponse:

roles = self.get_roles_from_decoded_token(decoded_token=decoded_token)

response.permissions, response.authorized_labels = self.roles_configuration.get_role_configuration(roles)
role_config = self.roles_configuration.get_role_configuration(roles)
response.permissions = role_config.permissions
response.authorized_labels = role_config.authorized_labels

return response

Expand Down
27 changes: 0 additions & 27 deletions sources/orthanc_auth_service/shares/keycloak_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,3 @@ def get_all_roles(self) -> List[str]:

def update_roles_configuration(self, roles_configuration: RolesConfiguration):
self._roles_configuration = roles_configuration


# def get_all_roles(self) -> List[str]:

# def create_api_keys(keycloak_uri: str, keycloak_admin_uri: str, keycloak_client_secret: str, roles_configuration: RolesConfiguration):
# try:
# #validate that we can connect to keycloak and retrieve users list
# keycloak_users_url = urljoin(keycloak_admin_uri, "users")
# headers = {
# 'Authorization': 'Bearer ' + _get_keycloak_access_token(keycloak_uri, keycloak_client_secret),
# 'Content-Type': 'application/json'
# }
# response = requests.get(keycloak_users_url, headers=headers)
# if response.status_code != 200:
# logging.error(f"Unable to retrieve users list from keycloak to validate client connection " + str(response) + ", exiting...")
# exit(-1)
#
# return KeycloakAdmin(keycloak_uri=keycloak_uri,
# keycloak_admin_uri=keycloak_admin_uri,
# keycloak_client_secret=keycloak_client_secret,
# roles_configuration=roles_configuration)
#
# except Exception as ex:
# logging.exception(ex)
# logging.error(f"Unable to validate client connection with keycloak, exiting...")
# exit(-1)
#
1 change: 1 addition & 0 deletions sources/orthanc_auth_service/shares/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class UserPermissions(str, Enum):
SETTINGS = 'settings'
API_VIEW = 'api-view'
EDIT_LABELS = 'edit-labels'
ADMIN_PERMISSIONS = 'admin-permissions'

SHARE = 'share'

Expand Down
2 changes: 1 addition & 1 deletion sources/orthanc_auth_service/shares/roles_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _load_roles_configuration_from_file(self):
logging.error(f"Unable to get roles and permissions from configuration file ({self._permissions_file_path}), exiting...")
exit(-1)

def get_configured_roles(self):
def get_configured_roles(self) -> RolesConfigurationModel:
return self._configured_roles

def update_configured_roles(self, new_configuration: RolesConfigurationModel):
Expand Down

0 comments on commit c64a541

Please sign in to comment.