Unverified Commit 42c9affa authored by Marius van den Beek's avatar Marius van den Beek Committed by GitHub
Browse files

Merge pull request #15882 from davelopez/22.05_fix_ids_on_errors

[22.05] Remove some IDs from error messages
parents d0551dda 682da9f2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ class CloudManager(sharable.SharableModelManager):
            incoming = params.__dict__
            history = trans.sa_session.query(trans.app.model.History).get(history_id)
            if not history:
                raise ObjectNotFound(f"History with ID `{trans.app.security.encode_id(history_id)}` not found.")
                raise ObjectNotFound("History with the ID provided was not found.")
            output = trans.app.toolbox.get_tool("upload1").handle_input(trans, incoming, history=history)

            job_errors = output.get("job_errors", [])
@@ -361,7 +361,7 @@ class CloudManager(sharable.SharableModelManager):

        history = trans.sa_session.query(trans.app.model.History).get(history_id)
        if not history:
            raise ObjectNotFound(f"History with ID `{trans.app.security.encode_id(history_id)}` not found.")
            raise ObjectNotFound("History with the provided ID not found.")

        sent = []
        failed = []
+2 −2
Original line number Diff line number Diff line
@@ -765,7 +765,7 @@ class DatasetCollectionManager:
            instance_id
        )
        if not collection_instance:
            raise RequestParameterInvalidException(f"History dataset collection association {id} not found")
            raise RequestParameterInvalidException("History dataset collection association not found")
        history = getattr(trans, "history", collection_instance.history)
        if check_ownership:
            self.history_manager.error_unless_owner(collection_instance.history, trans.user, current_history=history)
@@ -785,7 +785,7 @@ class DatasetCollectionManager:
            instance_id
        )
        if not collection_instance:
            raise RequestParameterInvalidException(f"Library dataset collection association {id} not found")
            raise RequestParameterInvalidException("Library dataset collection association not found")
        if check_accessible:
            if not trans.app.security_agent.can_access_library_item(
                trans.get_current_user_roles(), collection_instance, trans.user
+2 −2
Original line number Diff line number Diff line
@@ -68,14 +68,14 @@ class GroupRolesManager:
        decoded_group_id = decode_id(self._app, encoded_group_id)
        group = trans.sa_session.query(model.Group).get(decoded_group_id)
        if not group:
            raise ObjectNotFound(f"Group with id {encoded_group_id} was not found.")
            raise ObjectNotFound("Group with the id provided was not found.")
        return group

    def _get_role(self, trans: ProvidesAppContext, encoded_role_id: EncodedDatabaseIdField) -> model.Role:
        decoded_role_id = decode_id(self._app, encoded_role_id)
        role = trans.sa_session.query(model.Role).get(decoded_role_id)
        if not role:
            raise ObjectNotFound(f"Role with id {encoded_role_id} was not found.")
            raise ObjectNotFound("Role with the id provided was not found.")
        return role

    def _get_group_role(
+2 −2
Original line number Diff line number Diff line
@@ -71,14 +71,14 @@ class GroupUsersManager:
        decoded_group_id = decode_id(self._app, encoded_group_id)
        group = trans.sa_session.query(model.Group).get(decoded_group_id)
        if group is None:
            raise ObjectNotFound(f"Group with id {encoded_group_id} was not found.")
            raise ObjectNotFound("Group with the id provided was not found.")
        return group

    def _get_user(self, trans: ProvidesAppContext, encoded_user_id: EncodedDatabaseIdField) -> model.User:
        decoded_user_id = decode_id(self._app, encoded_user_id)
        user = trans.sa_session.query(model.User).get(decoded_user_id)
        if user is None:
            raise ObjectNotFound(f"User with id {encoded_user_id} was not found.")
            raise ObjectNotFound("User with the id provided was not found.")
        return user

    def _get_group_user(
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class GroupsManager:
        decoded_group_id = self._decode_id(encoded_id)
        group = trans.sa_session.query(model.Group).get(decoded_group_id)
        if group is None:
            raise ObjectNotFound(f"Group with id {encoded_id} was not found.")
            raise ObjectNotFound("Group with the provided id was not found.")
        return group

    def _get_users_by_encoded_ids(
Loading