netbox-community / netbox-floorplan-plugin

NetBox Floorplan plugin
GNU Lesser General Public License v3.0
53 stars 13 forks source link

Permission denied to /plugins/floorplan/floorplans/add/ #21

Open unpeeled opened 5 months ago

unpeeled commented 5 months ago

OS: AlmaLinux 8.9 (RHEL8) Netbox-Version: 3.7.6 Plugin-Version: 0.3.6 Postgres-Version: 12.18

Hello,

i tried to make the plugin working in my netbox installation. But i got an error when browsing to a location to add a floorplan:

Forbidden (Permission denied): /plugins/floorplan/floorplans/add/
Traceback (most recent call last):
  File "/opt/netbox-3.7.6/venv/lib64/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/opt/netbox-3.7.6/venv/lib64/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox-3.7.6/venv/lib64/python3.9/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/netbox-3.7.6/venv/lib64/python3.9/site-packages/django/contrib/auth/mixins.py", line 108, in dispatch
    return self.handle_no_permission()
  File "/opt/netbox-3.7.6/venv/lib64/python3.9/site-packages/django/contrib/auth/mixins.py", line 48, in handle_no_permission
    raise PermissionDenied(self.get_permission_denied_message())
django.core.exceptions.PermissionDenied

How i installed the plugin:

source /opt/netbox/venv/bin/activate
pip install netbox-floorplan-plugin==0.3.6
# edit configuration.py (to enable the pluign)
python3 manage.py collectstatic # (in netbox folder)
python3 manage.py migrate 
systemctl restart netbox netbox-rq

Afterwords i assgined all possible permissions to the user in web frontend. But there is only one permissions that fits to the floorplan plugin. I wonder if this is correct or shall there be more permissions possible?

 curl -k -H "Authorization: Token <Token>" -H "Accept: application/json" https://<netbox url>/api/users/permissions/ | jq | grep floorplan
        "netbox_floorplan.floorplan", # used for viewing 
        "netbox_floorplan.floorplan", # used for viewing, add, change, delete

The user is part of both groups.

Does anybody has a hint what else i can do to check this or maybe knows what the error might be?

cheers unpeeled

unpeeled commented 4 months ago

I just checked the history of sources and discovered that a bug relating to permissions is already fixed in the following commit: https://github.com/netbox-community/netbox-floorplan-plugin/commit/b332f7edbe239d06c20cc7cf976bd2ff4b0996d5

I fixed this single line in my plugin. This fixed also my problem.

Unfortunately there is no release of the software, so pypi users has no chance to get a working version. So i do not change the state to close.

ashokthangaraj commented 4 months ago

@unpeeled When can we expect a new release or is there any workaround for env installed using pypi?

cruse1977 commented 3 months ago

There's a 4.x version coming which will include this fix