Skip to content

Commit

Permalink
Merge pull request #15958 from mvdbeek/dev
Browse files Browse the repository at this point in the history
Merge 23.0 into dev
  • Loading branch information
dannon committed Apr 20, 2023
2 parents da6f448 + 3d836f0 commit 6f7def1
Show file tree
Hide file tree
Showing 16 changed files with 98 additions and 17 deletions.
1 change: 0 additions & 1 deletion client/src/components/ClientError.vue
Expand Up @@ -6,7 +6,6 @@
// (AdminRequired), but could be used for other client errors that need to be
// presented to the user interrupting the normal flow and context of the app.
import { defineProps } from "vue";
import Alert from "@/components/Alert.vue";
const props = defineProps<{
Expand Down
4 changes: 3 additions & 1 deletion client/src/components/providers/UserHistories.js
Expand Up @@ -28,7 +28,9 @@ export default {
return null;
},
historyModels() {
return this.histories.map((h) => Object.assign({}, h));
return this.histories
.map((h) => Object.assign({}, h))
.filter((h) => !h.user_id || h.user_id === this.user.id);
},
},
methods: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/composables/toast.ts
Expand Up @@ -30,7 +30,7 @@ export const Toast = {
},

error(message: string, title = "Error") {
toastRef.value?.showToast(message, title, "error");
toastRef.value?.showToast(message, title, "danger");
},
};

Expand Down
41 changes: 32 additions & 9 deletions client/src/entry/analysis/router.js
Expand Up @@ -504,18 +504,41 @@ export function getRouter(Galaxy) {
],
});

router.beforeEach(async (to, from, next) => {
// TODO: merge anon redirect functionality here for more standard handling

function checkAdminAccessRequired(to) {
// Check parent route hierarchy to see if we require admin access here.
// Access is required if *any* component in the hierarchy requires it.
if (to.matched.some((record) => record.meta.requiresAdmin === true)) {
const isAdmin = getGalaxyInstance()?.user?.isAdmin() || false;
if (!isAdmin) {
const error = new Error(`Administrator Access Required for '${to.path}'.`);
error.name = "AdminRequired";
next(error);
}
const isAdmin = getGalaxyInstance()?.user?.isAdmin();
return !isAdmin;
}
return false;
}

function checkRegisteredUserAccessRequired(to) {
// Check parent route hierarchy to see if we require registered user access here.
// Access is required if *any* component in the hierarchy requires it.
if (to.matched.some((record) => record.meta.requiresRegisteredUser === true)) {
const isAnonymous = getGalaxyInstance()?.user?.isAnonymous();
return isAnonymous;
}
return false;
}

router.beforeEach(async (to, from, next) => {
// TODO: merge anon redirect functionality here for more standard handling

const isAdminAccessRequired = checkAdminAccessRequired(to);
if (isAdminAccessRequired) {
const error = new Error(`Admin access required for '${to.path}'.`);
error.name = "AdminRequired";
next(error);
}

const isRegisteredUserAccessRequired = checkRegisteredUserAccessRequired(to);
if (isRegisteredUserAccessRequired) {
const error = new Error(`Registered user access required for '${to.path}'.`);
error.name = "RegisteredUserRequired";
next(error);
}
next();
});
Expand Down
1 change: 1 addition & 0 deletions client/src/entry/analysis/routes/storageDashboardRoutes.ts
Expand Up @@ -6,6 +6,7 @@ export default [
{
path: "/storage",
component: Base,
meta: { requiresRegisteredUser: true },
children: [
{
path: "",
Expand Down
4 changes: 2 additions & 2 deletions client/src/store/historyStore/historyStore.js
Expand Up @@ -16,7 +16,7 @@ import {
const state = {
// selected history
currentHistoryId: null,
// histories for current user
// histories for current user, can also have other user histories loaded for HistoryView
histories: {},
historiesLoading: false,
};
Expand Down Expand Up @@ -98,7 +98,7 @@ let isLoadingHistories = false;
const actions = {
async copyHistory({ dispatch }, { history, name, copyAll }) {
const newHistory = await cloneHistory(history, name, copyAll);
return dispatch("selectHistory", newHistory);
return dispatch("setCurrentHistory", newHistory.id);
},
async createNewHistory({ dispatch }) {
// create history, then select it as current at the same time
Expand Down
12 changes: 12 additions & 0 deletions doc/source/admin/galaxy_options.rst
Expand Up @@ -2915,6 +2915,18 @@
:Type: float


~~~~~~~~~~~~~~~~~~~
``sentry_ca_certs``
~~~~~~~~~~~~~~~~~~~

:Description:
Use this option to provide the path to location of the CA
(Certificate Authority) certificate file if the sentry server uses
a self-signed certificate.
:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~
``statsd_host``
~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/app.py
Expand Up @@ -202,6 +202,7 @@ def configure_sentry_client(self):
release=f"{self.config.version_major}.{self.config.version_minor}",
integrations=[sentry_logging],
traces_sample_rate=self.config.sentry_traces_sample_rate,
ca_certs=self.config.sentry_ca_certs,
)


Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/config/sample/galaxy.yml.sample
Expand Up @@ -1670,6 +1670,11 @@ galaxy:
# to Sentry. A value higher than 0 is required to analyze performance.
#sentry_traces_sample_rate: 0.0

# Use this option to provide the path to location of the CA
# (Certificate Authority) certificate file if the sentry server uses a
# self-signed certificate.
#sentry_ca_certs: null

# Log to statsd Statsd is an external statistics aggregator
# (https://github.com/etsy/statsd) Enabling the following options will
# cause galaxy to log request timing and other statistics to the
Expand Down
5 changes: 5 additions & 0 deletions lib/galaxy/config/sample/tool_shed.yml.sample
Expand Up @@ -316,6 +316,11 @@ tool_shed:
# to Sentry. A value higher than 0 is required to analyze performance.
#sentry_traces_sample_rate: 0.0

# Use this option to provide the path to location of the CA
# (Certificate Authority) certificate file if the sentry server uses a
# self-signed certificate.
#sentry_ca_certs: null

# Galaxy Session Timeout This provides a timeout (in minutes) after
# which a user will have to log back in. A duration of 0 disables this
# feature.
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/config/schemas/config_schema.yml
Expand Up @@ -2108,6 +2108,13 @@ mapping:
will have that percentage chance of being sent to Sentry. A value higher than 0
is required to analyze performance.
sentry_ca_certs:
type: str
required: False
desc: |
Use this option to provide the path to location of the CA (Certificate Authority)
certificate file if the sentry server uses a self-signed certificate.
statsd_host:
type: str
required: false
Expand Down
7 changes: 7 additions & 0 deletions lib/galaxy/config/schemas/tool_shed_config_schema.yml
Expand Up @@ -566,6 +566,13 @@ mapping:
will have that percentage chance of being sent to Sentry. A value higher than 0
is required to analyze performance.
sentry_ca_certs:
type: str
required: False
desc: |
Use this option to provide the path to location of the CA (Certificate Authority)
certificate file if the sentry server uses a self-signed certificate.
session_duration:
type: int
default: 0
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/dependencies/pinned-requirements.txt
Expand Up @@ -73,7 +73,7 @@ fsspec==2023.1.0 ; python_version >= "3.7" and python_version < "3.12"
future==0.18.3 ; python_version >= "3.7" and python_version < "3.12"
galaxy-sequence-utils==1.1.5 ; python_version >= "3.7" and python_version < "3.12"
galaxy2cwl==0.1.4 ; python_version >= "3.7" and python_version < "3.12"
gravity==1.0.2 ; python_version >= "3.7" and python_version < "3.12"
gravity==1.0.3 ; python_version >= "3.7" and python_version < "3.12"
greenlet==2.0.2 ; python_version >= "3.7" and platform_machine == "aarch64" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "ppc64le" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "x86_64" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "amd64" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "AMD64" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "win32" and python_version < "3.12" or python_version >= "3.7" and platform_machine == "WIN32" and python_version < "3.12"
gunicorn==20.1.0 ; python_version >= "3.7" and python_version < "3.12"
gxformat2==0.17.0 ; python_version >= "3.7" and python_version < "3.12"
Expand Down
3 changes: 2 additions & 1 deletion lib/galaxy/jobs/runners/__init__.py
Expand Up @@ -36,6 +36,7 @@
)
from galaxy.tool_util.output_checker import DETECTED_JOB_STATE
from galaxy.util import (
asbool,
DATABASE_MAX_STRING_SIZE,
ExecutionTimer,
in_directory,
Expand Down Expand Up @@ -342,7 +343,7 @@ def get_work_dir_outputs(
output_paths = {}
for dataset_path in job_wrapper.job_io.get_output_fnames():
path = dataset_path.real_path
if job_wrapper.get_destination_configuration("outputs_to_working_directory", False):
if asbool(job_wrapper.get_destination_configuration("outputs_to_working_directory", False)):
path = dataset_path.false_path
output_paths[dataset_path.dataset_id] = path

Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/model/security.py
Expand Up @@ -1536,7 +1536,6 @@ def check_folder_contents(self, user, roles, folder, hidden_folder_ids=""):
return True, ""
action = self.permitted_actions.DATASET_ACCESS

raise
lddas = (
self.sa_session.query(self.model.LibraryDatasetDatasetAssociation)
.join("library_dataset")
Expand Down
19 changes: 19 additions & 0 deletions lib/galaxy_test/api/test_folders.py
Expand Up @@ -19,6 +19,20 @@ def setUp(self):
def test_create(self):
folder = self._create_folder("Test Create Folder")
self._assert_valid_folder(folder)
# assert that listing items in folder works.
# this is a regression test
response = self._get(f"libraries/{folder['parent_library_id']}/contents")
response.raise_for_status()

@requires_new_library
def test_list_library(self):
library, _ = self.library_populator.fetch_single_url_to_folder()
library = self._list_library(library["id"])
assert len(library) == 2
folders = [folder for folder in library if folder["type"] == "folder"]
assert len(folders) == 1
files = [file for file in library if file["type"] == "file"]
assert len(files) == 1

@requires_new_library
def test_create_without_name_raises_400(self):
Expand Down Expand Up @@ -117,6 +131,11 @@ def test_update_deleted_raise_403(self):
put_response = self._put(f"folders/{folder_id}", data=data, admin=True, json=True)
self._assert_status_code_is(put_response, 403)

def _list_library(self, library_id):
response = self._get(f"libraries/{library_id}/contents")
response.raise_for_status()
return response.json()

def _create_folder(self, name: str):
root_folder_id = self.library["root_folder_id"]
data = {
Expand Down

0 comments on commit 6f7def1

Please sign in to comment.