Skip to content

Commit

Permalink
Disable UI components on ReadOnly systems
Browse files Browse the repository at this point in the history
  • Loading branch information
amazy committed Oct 1, 2024
1 parent 6dbd47e commit f64c1f8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Plugin/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Json::Value pluginsConfiguration_;
bool hasUserProfile_ = false;
bool openInOhifV3IsExplicitelyDisabled = false;
bool enableShares_ = false;
bool isReadOnly_ = false;
std::string customCssPath_;
std::string theme_ = "light";
std::string customLogoPath_;
Expand Down Expand Up @@ -343,6 +344,8 @@ void ReadConfiguration()
}

enableShares_ = pluginJsonConfiguration_["UiOptions"]["EnableShares"].asBool(); // we are sure that the value exists since it is in the default configuration file

isReadOnly_ = orthancFullConfiguration_->GetBooleanValue("ReadOnly", false);
}

bool GetPluginConfiguration(Json::Value& jsonPluginConfiguration, const std::string& sectionName)
Expand Down Expand Up @@ -690,6 +693,18 @@ void GetOE2Configuration(OrthancPluginRestOutput* output,

}

// disable operations on read only systems
if (isReadOnly_)
{
uiOptions["EnableUpload"] = false;
uiOptions["EnableAddSeries"] = false;
uiOptions["EnableDeleteResources"] = false;
uiOptions["EnableModification"] = false;
uiOptions["EnableAnonymization"] = false;
uiOptions["EnableEditLabels"] = false;
uiOptions["EnablePermissionsEdition"] = false;
}


oe2Configuration["Keycloak"] = GetKeycloakConfiguration();
std::string answer = oe2Configuration.toStyledString();
Expand Down
4 changes: 4 additions & 0 deletions WebApplication/src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ export default {
<th scope="row" class="header">{{ $t('settings.storage_compression') }}</th>
<td class="value">{{ system.StorageCompression }}</td>
</tr>
<tr>
<th scope="row" class="header">{{ $t('settings.read_only') }}</th>
<td class="value">{{ system.ReadOnly }}</td>
</tr>
</tbody>
</table>
</div>
Expand Down
1 change: 1 addition & 0 deletions WebApplication/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"permissions_clear_selection": "Clear selection",
"permissions_global_instructions_html": "Edit the permissions below and click <strong>Save</strong> to apply your modifications.<br>For each role, select the labels whose access is allowed and the allowed permissions.",
"permissions_instructions": "The permissions are statically defined in the authorization-plugin configuration.",
"read_only": "Read only system",
"select_all_label_permissions": "Select all label permissions",
"select_all_global_permissions": "Select all global permissions",
"plugins_not_enabled": "Plugins that are loaded but not enabled or not configured correctly are ",
Expand Down
1 change: 1 addition & 0 deletions WebApplication/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"permissions_global_instructions_html": "Éditer les permissions ci-dessous et cliquez sur <strong>Enregistrer</strong> pour appliquer les modifications. <br>Pour chaque rôle, sélectionnez les étiquettes qui seront accessibles et les actions autorisées sur ces examens.",
"permissions_instructions": "La liste de permission ne peut être modifiée; elle est définie dans le plugin authorization.",
"plugins_not_enabled": "Les plugins qui sont chargés mais non-activés ou configurés correctement sont ",
"read_only": "Système en lecture seule",
"roles_title": "Rôles",
"roles_description_html": "Les rôles sont créés et modifiés dans Keycloak",
"select_all_label_permissions": "Sélectionner toutes les permissions basées sur les étiquettes",
Expand Down
2 changes: 2 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Pending changes in the mainline

Changes:
- Optimized loading of "most-recent" studies when the Orthanc DB supports "ExtendedChanges"
- Disable UI components on ReadOnly systems.


1.6.2 (2024-09-23)
==================
Expand Down

0 comments on commit f64c1f8

Please sign in to comment.