-
Notifications
You must be signed in to change notification settings - Fork 48
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
[api] Implement multitenancy in API #61 #76
[api] Implement multitenancy in API #61 #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest you to write some tests first, you can take a look in other modules (eg: firmware-upgrader, openwisp-users).
e6128c3
to
8f36d31
Compare
8f36d31
to
743c37b
Compare
743c37b
to
3d6ae27
Compare
3d6ae27
to
5b6c3a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I started to check manually to see the reason why you needed the mixin but it doesn't seem to work.
Try this out:
- Create a subnet with org1
- Create an org1 user who is not a superuser, only staff operator user with all subnet permissions.
- Login from this user
- Go to subnets, your device would be missing!
Have you tested this manually as well? Do you need help with testing manually? 😄
@atb00ker I did some testing manually but didn't notice this. This is the bug on the master branch. I found a similar bug here: #77 |
Also I'd like to mention, this is only a problem in the admin interface. The api still shows all subnets in |
That's odd, I'll have to dedicate more time to this in that case, please investigate further if possible, thanks! 😄
You are talking about testing this in master, right? |
Sure 😄
@atb00ker Yes, the bugs that I mentioned are on master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pay attention, if I'm not mistaken, most of the API action should only be available to managers (not members).
The difference is that a member could be an user who signs up for public wifi or another derivative service offered via openwisp to end users, while a manager is a user who manages their network via the openwisp administration interface but is not a super user.
See also my comments below.
Sorry, I am not able to test it because of the bug mentioned above, I'll need to find time to checkout that issue, it's 4th on my list presently, so I would take a while for me to come here! 😄 |
@atb00ker by all means, take your time. BTW, please use tools like postman other than the admin interface, to test the API, as the admin interface can behave differently! (The bugs mentioned earlier, I found these in the admin interface only and not on the API itself) |
At least for openwisp, you shouldn't need postman, if you open API links on browser itself, the DRF page should work just fine, if it doesn't it's a bug (because we are not following the DRF docs in that case)! 😄 |
5928ace
to
29ae7f5
Compare
c5890b7
to
a4fb43f
Compare
@nemesisdesign I have made many changes in the last 4 commits.
This was fixed. ☝️ (c000861)
This was also fixed ☝️ (8632f20) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @purhan! Did a quick test and I'm delighted to see that the DRF browsable API issue is solved. We'll be reusing that solution also in other modules! Added a note to openwisp/openwisp-users#210.
I left some comments below, I will need more time to test it deeper, but it's almost ready! 👍 👍
21783be
to
f88f335
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @purhan! Thank you so much! 👍 👍
Before merging, can you move the filter mixins to openwisp-users as initially discussed please?
openwisp/openwisp-users#210
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a conflict to resolve.
Can you make the openwisp-user dependency point to your branch here?
openwisp/openwisp-users#217 (here's how we do it for openwisp-radius: https://github.com/openwisp/openwisp-radius/blob/ee5220f9aebc81508582fb1d6fa5f5338dd51c90/requirements.txt#L7-L9)
And change the code so use the openwisp-users mixins please?
0eace3a
to
609c7ed
Compare
@nemesisdesign Done, resolved the conflicts and replaced the code to use mixins from openwisp/openwisp-users#217 . Please take a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to merge @purhan, I took a closer look at the tests and noticed something, read my comment below.
39586d4
to
c318f67
Compare
Ready for review 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @purhan! 👍 👍
Closes #61