geonode icon indicating copy to clipboard operation
geonode copied to clipboard

forever loading state on index site (API returns 403)

Open gannebamm opened this issue 2 years ago • 6 comments

Expected Behavior

The home catalogue screen gets displayed.

Actual Behavior

The new index site does not render and mapstore is in a forever loading state due to two errors:

GET http://localhost/api/o/v4/userinfo GET http://localhost/api/v2/resources/resource_types

both returns return a 403 permission denied

Steps to Reproduce the Problem

  1. clone geonode 4.x (7244bdc5f0404c0f7cf903bef8bae74c535c5e7d)
  2. docker-compose build
  3. docker-compose up
  4. open GeoNode site (eg. localhost)

Specifications

  • GeoNode version: geonode 4.x (7244bdc5f0404c0f7cf903bef8bae74c535c5e7d)
  • Installation method (manual, GeoNode Docker, SPCGeoNode Docker): GeoNode Docker
  • Platform: Ubuntu
  • Additional details: fresh build

Maybe a regression based on #9804 (not tested yet)

gannebamm avatar Aug 09 '22 16:08 gannebamm

reverting to 3be00eec210c31ff3934eebba70e81e92a429e34 seems to fix the issue

gannebamm avatar Aug 09 '22 17:08 gannebamm

Hi @gannebamm It may be a regression introduced by this https://github.com/GeoNode/geonode/issues/9804 The idea behind the permission class is:

  • Does the request is on a specific resource? -> Yes, so I'll check the permission on that resource that belongs to the user and its group to see if the user can do something
  • Is It a general endpoint? -> yes, I'll check if the user and its groups have those permissions on any of the resources available

This is missing:

  • It's a general endpoint and there is no resource available?

We can fix it by saying:

  • It's a general endpoint and there is no resource available? -> yes, the anonymous and the user can perform a GET request

mattiagiupponi avatar Aug 10 '22 08:08 mattiagiupponi

@gannebamm can you please try the fix in this branch?

mattiagiupponi avatar Aug 10 '22 09:08 mattiagiupponi

@mattiagiupponi yes, I will test it this afternoon and reply back. Thanks!

gannebamm avatar Aug 10 '22 10:08 gannebamm

I could replicate the error with/without the changes you have done in permissions.py Applying the WIP PR fixed the issue, and I was able to start with a fresh installation properly.

gannebamm avatar Aug 10 '22 11:08 gannebamm

I could replicate the error with/without the changes you have done in permissions.py Applying the WIP PR fixed the issue, and I was able to start with a fresh installation properly.

Great, I mark it as ready for review, I also put you as a reviewer :)

mattiagiupponi avatar Aug 10 '22 12:08 mattiagiupponi