Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set/unset batch permissions on groups raise an error #10525

Closed
mattiagiupponi opened this issue Jan 13, 2023 · 0 comments
Closed

set/unset batch permissions on groups raise an error #10525

mattiagiupponi opened this issue Jan 13, 2023 · 0 comments
Assignees
Labels
4.1.x major A high priority issue which might affect a lot of people or large parts of the codebase master

Comments

@mattiagiupponi
Copy link
Contributor

Expected Behavior

When set/unset batch permissions on a group the flow should successfully finish

Actual Behavior

The BE raises the following log:

Fixup GIS Backend Security Rules Accordingly on resource geonode:san_andres_y_providencia_natural10 True
Internal Server Error: /groups/dataset/permission/
Traceback (most recent call last):
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/autoretry.py", line 34, in run
    return task._orig_run(*args, **kwargs)
  File "/opt/geonode/geonode/tasks/tasks.py", line 204, in set_permissions
    set_datasets_permissions(
  File "/opt/geonode/geonode/layers/utils.py", line 494, in set_datasets_permissions
    final_perms_payload["groups"] = {
  File "/opt/geonode/geonode/layers/utils.py", line 497, in <dictcomp>
    if _user not in copy_compact_perms.extended["groups"]
NameError: free variable '_user' referenced before assignment in enclosing scope

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/opt/geonode/geonode/groups/views.py", line 61, in post
    return user_and_group_permission(request, 'groupprofile')
  File "/opt/geonode/geonode/base/views.py", line 134, in user_and_group_permission
    set_permissions.apply_async(
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/task.py", line 572, in apply_async
    return self.apply(args, kwargs, task_id=task_id or uuid(),
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/task.py", line 793, in apply
    ret = tracer(task_id, args, kwargs, request)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/trace.py", line 464, in trace_task
    I, R, state, retval = on_error(
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/autoretry.py", line 54, in run
    ret = task.retry(exc=exc, **retry_kwargs)
  File "/home/marthamareal/.virtualenvs/geonode/lib/python3.8/site-packages/celery/app/task.py", line 730, in retry
    raise ret
celery.exceptions.Retry: Retry in 3s: NameError("free variable '_user' referenced before assignment in enclosing scope")
"POST /groups/dataset/permission/ HTTP/1.1" 500 275904
Fixup GIS Backend Security Rules Accordingly on resource geonode:san_andres_y_providencia_natural10 True

Steps to Reproduce the Problem

  1. go to the GroupProfile page
  2. select batch permissions change
  3. click save and check the logs

Specifications

  • GeoNode version: master, 4.1.x
  • Installation type (vanilla, geonode-project):
  • Installation method (manual, docker):
  • Platform:
  • Additional details:
@mattiagiupponi mattiagiupponi self-assigned this Jan 17, 2023
@afabiani afabiani added major A high priority issue which might affect a lot of people or large parts of the codebase master 4.1.x labels Jan 17, 2023
github-actions bot pushed a commit that referenced this issue Jan 17, 2023
…10526)

* [Fixes #10525] set/unset batch permissions on groups raise an error

* [Fixes #10525] set/unset batch permissions on groups raise an error

(cherry picked from commit 648dd10)
afabiani pushed a commit that referenced this issue Jan 17, 2023
…10526) (#10549)

* [Fixes #10525] set/unset batch permissions on groups raise an error

* [Fixes #10525] set/unset batch permissions on groups raise an error

(cherry picked from commit 648dd10)

Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.1.x major A high priority issue which might affect a lot of people or large parts of the codebase master
Projects
None yet
Development

No branches or pull requests

2 participants