Skip to content

Commit

Permalink
Drop old repositories, group repo functions in one module
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Sep 20, 2023
1 parent 1d8f696 commit cde5fdd
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/galaxy/managers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
)
from galaxy.model import UserQuotaUsage
from galaxy.model.base import transaction
from galaxy.model.repositories.user import (
from galaxy.model.repositories import (
get_user_by_email,
get_user_by_username,
)
Expand Down
5 changes: 2 additions & 3 deletions lib/galaxy/tool_shed/util/repository_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
web,
)
from galaxy.model.base import transaction
from galaxy.model.repositories.tool_shed_repository import ToolShedRepositoryRepository as tsr_repo
from galaxy.model.scoped_session import install_model_scoped_session
from galaxy.model.tool_shed_install import ToolShedRepository
from galaxy.tool_shed.util import basic_util
Expand Down Expand Up @@ -70,7 +69,7 @@ def check_for_updates(
message += "Unable to retrieve status from the tool shed for the following repositories:\n"
message += ", ".join(repository_names_not_updated)
else:
repository = tsr_repo(install_model_context).get(repository_id)
repository = install_model_context.get(ToolShedRepository, repository_id)
ok, updated = _check_or_update_tool_shed_status_for_installed_repository(
tool_shed_registry, install_model_context, repository
)
Expand Down Expand Up @@ -633,7 +632,7 @@ def get_tool_shed_from_clone_url(repository_clone_url):
def get_tool_shed_repository_by_id(app, repository_id) -> ToolShedRepository:
"""Return a tool shed repository database record defined by the id."""
# This method is used only in Galaxy, not the tool shed.
return tsr_repo(app.install_model.context).get(app.security.decode_id(repository_id))
return app.install_model.context.get(ToolShedRepository, app.security.decode_id(repository_id))


def get_tool_shed_status_for(tool_shed_registry: Registry, repository: ToolShedRepository):
Expand Down
5 changes: 2 additions & 3 deletions lib/galaxy/webapps/galaxy/controllers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
)
from galaxy.managers import histories
from galaxy.managers.sharable import SlugBuilder
from galaxy.model import Role
from galaxy.model.base import transaction
from galaxy.model.item_attrs import (
UsesAnnotations,
UsesItemRatings,
)
from galaxy.model.repositories.role import RoleRepository
from galaxy.structured_app import StructuredApp
from galaxy.util import (
listify,
Expand Down Expand Up @@ -576,10 +576,9 @@ def permissions(self, trans, payload=None, **kwd):
else:
self.history_manager.error_unless_mutable(history)
permissions = {}
_role_repo = RoleRepository(trans.sa_session)
for action_key, action in trans.app.model.Dataset.permitted_actions.items():
in_roles = payload.get(action_key) or []
in_roles = [_role_repo.get(trans.security.decode_id(x)) for x in in_roles]
in_roles = [trans.sa_session.get(Role, trans.security.decode_id(x)) for x in in_roles]
permissions[trans.app.security_agent.get_action(action.action)] = in_roles
trans.app.security_agent.history_set_default_permissions(history, permissions)
return {"message": "Default history '%s' dataset permissions have been changed." % history.name}
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)
from galaxy.exceptions import Conflict
from galaxy.managers import users
from galaxy.model.repositories.user import get_user_by_email
from galaxy.model.repositories import get_user_by_email
from galaxy.security.validate_user_input import (
validate_email,
validate_publicname,
Expand Down
2 changes: 1 addition & 1 deletion lib/tool_shed/test/base/test_db_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import galaxy.model
import galaxy.model.tool_shed_install
import tool_shed.webapp.model as model
from galaxy.model.repositories.user import get_user_by_username
from galaxy.model.repositories import get_user_by_username

log = logging.getLogger("test.tool_shed.test_db_util")

Expand Down
2 changes: 1 addition & 1 deletion lib/tool_shed/webapp/controllers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
web,
)
from galaxy.model.base import transaction
from galaxy.model.repositories.user import get_user_by_username
from galaxy.model.repositories import get_user_by_username
from galaxy.tool_shed.util import dependency_display
from galaxy.tools.repositories import ValidationContext
from galaxy.web.form_builder import (
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_user_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
put,
)

from galaxy.model.repositories.user import get_user_by_email
from galaxy.model.repositories import get_user_by_email
from galaxy_test.driver import integration_util

TEST_USER_EMAIL = "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_vault_extra_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
put,
)

from galaxy.model.repositories.user import get_user_by_email
from galaxy.model.repositories import get_user_by_email
from galaxy_test.driver import integration_util

TEST_USER_EMAIL = "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_vault_file_source.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import tempfile

from galaxy.model.repositories.user import get_user_by_email
from galaxy.model.repositories import get_user_by_email
from galaxy.security.vault import UserVaultWrapper
from galaxy_test.base import api_asserts
from galaxy_test.base.populators import DatasetPopulator
Expand Down

0 comments on commit cde5fdd

Please sign in to comment.