openlibhums / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
177 stars 65 forks source link

v.1.4.3-RC-4: /manager/user/enroll excpetion (Role matching quesry does not exist). #3205

Open cederom opened 2 years ago

cederom commented 2 years ago

Describe the bug

Janeway version v.1.4.3-RC-4

To Reproduce Steps to reproduce the behavior:

  1. Go to Journal Manager.
  2. Click on Enroll Users.
  3. See error

Expected behavior No error? :-)

Logs

Environment:

Request Method: GET
Request URL: https://new.e-health.pl/advances/manager/user/enrol/

Django Version: 1.11.29
Python Version: 3.6.9
Installed Applications:
['modeltranslation',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'django.contrib.postgres',
 'cms',
 'core',
 'copyediting',
 'cron',
 'discussion',
 'events',
 'identifiers',
 'journal',
 'metrics',
 'comms',
 'press',
 'production',
 'proofing',
 'review',
 'repository',
 'reports',
 'security',
 'submission',
 'transform',
 'utils',
 'install',
 'workflow',
 'mozilla_django_oidc',
 'django_summernote',
 'markdown_deux',
 'raven.contrib.django.raven_compat',
 'bootstrap4',
 'rest_framework',
 'foundationform',
 'materialize',
 'snowpenguin.django.recaptcha2',
 'simplemathcaptcha',
 'hijack',
 'compat',
 'hcaptcha',
 'django.forms',
 'core.homepage_elements.about',
 'core.homepage_elements.carousel',
 'core.homepage_elements.featured',
 'core.homepage_elements.html',
 'core.homepage_elements.issue',
 'core.homepage_elements.journals',
 'core.homepage_elements.journals_and_html',
 'core.homepage_elements.news',
 'core.homepage_elements.popular',
 'core.homepage_elements.preprints',
 'core.homepage_elements.search_bar']
Installed Middleware:
('raven.contrib.django.middleware.SentryMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'core.middleware.TimezoneMiddleware',
 'core.middleware.SiteSettingsMiddleware',
 'core.middleware.MaintenanceModeMiddleware',
 'cron.middleware.CronMiddleware',
 'core.middleware.CounterCookieMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'core.middleware.PressMiddleware',
 'core.middleware.GlobalRequestMiddleware',
 'django.middleware.gzip.GZipMiddleware',
 'journal.middleware.LanguageMiddleware')

Traceback:

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/XXX/www/new.e-health.pl/janeway/security/decorators.py" in wrapper
  64.             return func(request, *args, **kwargs)

File "/home/XXX/www/new.e-health.pl/janeway/security/decorators.py" in wrapper
  190.             return func(request, *args, **kwargs)

File "/home/XXX/www/new.e-health.pl/janeway/core/views.py" in enrol_users
  1242.         'reader': models.Role.objects.get(slug='reader'),

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/db/models/manager.py" in manager_method
  85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/home/XXX/.local/venv3.6janeway/lib/python3.6/site-packages/django/db/models/query.py" in get
  380.                 self.model._meta.object_name

Exception Type: DoesNotExist at /manager/user/enrol/
Exception Value: Role matching query does not exist.

Server (please complete the following information):

ajrbyers commented 2 years ago

Do you know which role it’s complaining about? We introduced a new Reader role so it might be this one.

cederom commented 2 years ago

Thanks @ajrbyers, not sure, I am just exploring features.. the exception occurs right after clicking the "Enrol Users" so there is nothing really to select to give you a hint, sorry..

cederom commented 2 years ago

Okay, so I have created an example article. Now it needs to be reviewed. In order to do that I need to Enroll existing user to become a Reviewer. This cannot be done as "Enroll Users" interface causes exception mentioned above. I can view the users in Reviewer group though.

cederom commented 2 years ago

Also I can see "Become a Reviewer" at the top menu of a Journal page.. but when I click that I get this message "You are already a reviewer".. both for superadmin and manager account.. but still I am not on the Reviewers list.

cederom commented 2 years ago

The same with Editor role o_O

cederom commented 2 years ago

Allright, I have found a way to add users to a Role.. on the users list in the "Enrolled Users" screen it is possible to mark users and from the top drop down box it is possible to select a role that can be then assigned with "Add Users to Role" button :-)

Is this also the purpose of "Enroll Users" screen @ajrbyers ? :-)