From dd9e5d3bdc2905b88c1ea2e4a1bbd3192e5db343 Mon Sep 17 00:00:00 2001 From: alejandromumo Date: Wed, 9 Aug 2023 16:01:20 +0200 Subject: [PATCH] moderation: refactor role name to id. --- invenio_requests/services/user_moderation/service.py | 4 ++-- tests/conftest.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/invenio_requests/services/user_moderation/service.py b/invenio_requests/services/user_moderation/service.py index 8a8ecf14..e9400d88 100644 --- a/invenio_requests/services/user_moderation/service.py +++ b/invenio_requests/services/user_moderation/service.py @@ -41,8 +41,8 @@ def request_moderation(self, identity, user_id, data=None, uow=None, **kwargs): topic = {"user": str(user_id)} # Receiver can be configured, by default send the request to users with moderation role - receiver = {"group": role.name} # TODO to be changed to role id - creator = {"group": role.name} # TODO to be changed to role id + receiver = {"group": role.id} + creator = {"group": role.id} request_item = self.requests_service.create( identity, diff --git a/tests/conftest.py b/tests/conftest.py index c470e815..c7fa6692 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -294,7 +294,7 @@ def superuser_role(database): def moderator_role(app, database): """Moderator role.""" REQUESTS_MODERATION_ROLE = app.config["REQUESTS_MODERATION_ROLE"] - mod_role = Role(name=REQUESTS_MODERATION_ROLE) + mod_role = Role(id=REQUESTS_MODERATION_ROLE, name=REQUESTS_MODERATION_ROLE) database.session.add(mod_role) action_role = ActionRoles.create(action=user_management_action, role=mod_role)