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

[bug] API endpoints are failing with "Organization not found, organization_field not implemented correctly." #105

Open
nemesifier opened this issue May 17, 2021 · 2 comments
Labels
enhancement New feature or request Hacktoberfest Easy issues for attracting Hacktoberfest participants.

Comments

@nemesifier
Copy link
Member

nemesifier commented May 17, 2021

The following API endpoints:

  • /api/v1/ip-address/<id>/
  • /api/v1/subnet/<id>/

Are failing when using the latest version of openwisp-users, with the error:

Organization not found, `organization_field` not implemented correctly.

However, the bug is not showing in tests, so I'm puzzled by this and I would like to know if anyone can confirm this.

@nemesifier nemesifier added the enhancement New feature or request label May 17, 2021
@nemesifier nemesifier added this to To do (general) in OpenWISP Contributor's Board via automation May 17, 2021
@nemesifier nemesifier moved this from To do (general) to To do (Python & Django) in OpenWISP Contributor's Board May 17, 2021
@nemesifier nemesifier added the Hacktoberfest Easy issues for attracting Hacktoberfest participants. label Oct 1, 2021
@pandafy pandafy added this to Backlog in OpenWISP Priorities for next releases via automation Jan 26, 2022
@pandafy pandafy moved this from Backlog to To do in OpenWISP Priorities for next releases Jan 26, 2022
@pandafy pandafy added this to the Release 0.3.0 milestone Jan 26, 2022
@aagman945
Copy link

aagman945 commented Feb 14, 2022

These end points have changed to :
/api/v1/ipam/ip-address/<id>/
/api/v1/ipam/subnet/<id>/

and I am unable to replicate this error

@DavidMeu
Copy link

DavidMeu commented Mar 6, 2022

Reproduced in my end:
Created a subnet with empty organization field (null).
curl -X POST "<URL>/api/v1/ipam/subnet/" -H "Authorization: Bearer some token" -d "subnet=10.0.0.0/24&organization="
And tried deleting it:
curl -X DELETE "<URL>/api/v1/ipam/subnet/6d003f5a-df3d-4a57-b136-78f97a3e48b3/" -H "Authorization: Bearer some token"

And got:
AttributeError: Organization not found, organization_field not implemented correctly.

*master branch
*When applying the creation+deletion via the admin site it is ok

Trace:

  File "\venv\lib\site-packages\openwisp_users\api\permiss
ions.py", line 13, in has_object_permission
    organization = self.get_object_organization(view, obj)
  File "\venv\lib\site-packages\openwisp_users\api\permiss
ions.py", line 26, in get_object_organization
    raise AttributeError(

Exception Type: AttributeError at /api/v1/ipam/subnet/98781c63-c6dd-4375-a783-1609a90740df/
Exception Value: Organization not found, `organization_field` not implemented correctly.

@aagman945 on what version you tried replicate this issue?

@nemesifier nemesifier moved this from To do to In progress in OpenWISP Priorities for next releases Apr 20, 2022
@nemesifier nemesifier moved this from In progress to To do in OpenWISP Priorities for next releases Apr 20, 2022
@nemesifier nemesifier removed this from the Release 1.0.0 milestone Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest Easy issues for attracting Hacktoberfest participants.
Projects
OpenWISP Contributor's Board
  
To do (Python & Django)
Development

No branches or pull requests

4 participants