Limit django rest framework api according to payment plans
up vote
0
down vote
favorite
I have some dynamically added features performed by an admin user, which i will associate with certain endpoints.
What would be a good approach to solve this problem?
The problem is how can i do this association?
python django api permissions django-rest-framework
add a comment |
up vote
0
down vote
favorite
I have some dynamically added features performed by an admin user, which i will associate with certain endpoints.
What would be a good approach to solve this problem?
The problem is how can i do this association?
python django api permissions django-rest-framework
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have some dynamically added features performed by an admin user, which i will associate with certain endpoints.
What would be a good approach to solve this problem?
The problem is how can i do this association?
python django api permissions django-rest-framework
I have some dynamically added features performed by an admin user, which i will associate with certain endpoints.
What would be a good approach to solve this problem?
The problem is how can i do this association?
python django api permissions django-rest-framework
python django api permissions django-rest-framework
edited Nov 10 at 18:57
Shakil
4391313
4391313
asked Nov 10 at 18:23
Juan Ignacio Sánchez
305111
305111
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26
add a comment |
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I did the following:
1) Stablish some constants strings representing what I know as 'features'. i.e:
- feat1 = 'f1'
- feat2 = 'f2'
2) Used this to create FEATURE_CHOICES into a Feature model. (This one would be created dynamically by admin users. Such users will associate the corresponding choice, and add additional representative metadata, useful for user-agents.
FEATURE_CHOICES = ((feat1, 'Awesome feature'), (feat2, 'Just a regular feature'))
3) On my views, added the corresponding value as a class variable: api_feature = feat1
4) Created a custom DRF Permission Class that implements a has_feature function which checks if the user's plan has such requested feature.
This is the solution that i've implemented for now. All constants were managed by django-decouple.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I did the following:
1) Stablish some constants strings representing what I know as 'features'. i.e:
- feat1 = 'f1'
- feat2 = 'f2'
2) Used this to create FEATURE_CHOICES into a Feature model. (This one would be created dynamically by admin users. Such users will associate the corresponding choice, and add additional representative metadata, useful for user-agents.
FEATURE_CHOICES = ((feat1, 'Awesome feature'), (feat2, 'Just a regular feature'))
3) On my views, added the corresponding value as a class variable: api_feature = feat1
4) Created a custom DRF Permission Class that implements a has_feature function which checks if the user's plan has such requested feature.
This is the solution that i've implemented for now. All constants were managed by django-decouple.
add a comment |
up vote
0
down vote
I did the following:
1) Stablish some constants strings representing what I know as 'features'. i.e:
- feat1 = 'f1'
- feat2 = 'f2'
2) Used this to create FEATURE_CHOICES into a Feature model. (This one would be created dynamically by admin users. Such users will associate the corresponding choice, and add additional representative metadata, useful for user-agents.
FEATURE_CHOICES = ((feat1, 'Awesome feature'), (feat2, 'Just a regular feature'))
3) On my views, added the corresponding value as a class variable: api_feature = feat1
4) Created a custom DRF Permission Class that implements a has_feature function which checks if the user's plan has such requested feature.
This is the solution that i've implemented for now. All constants were managed by django-decouple.
add a comment |
up vote
0
down vote
up vote
0
down vote
I did the following:
1) Stablish some constants strings representing what I know as 'features'. i.e:
- feat1 = 'f1'
- feat2 = 'f2'
2) Used this to create FEATURE_CHOICES into a Feature model. (This one would be created dynamically by admin users. Such users will associate the corresponding choice, and add additional representative metadata, useful for user-agents.
FEATURE_CHOICES = ((feat1, 'Awesome feature'), (feat2, 'Just a regular feature'))
3) On my views, added the corresponding value as a class variable: api_feature = feat1
4) Created a custom DRF Permission Class that implements a has_feature function which checks if the user's plan has such requested feature.
This is the solution that i've implemented for now. All constants were managed by django-decouple.
I did the following:
1) Stablish some constants strings representing what I know as 'features'. i.e:
- feat1 = 'f1'
- feat2 = 'f2'
2) Used this to create FEATURE_CHOICES into a Feature model. (This one would be created dynamically by admin users. Such users will associate the corresponding choice, and add additional representative metadata, useful for user-agents.
FEATURE_CHOICES = ((feat1, 'Awesome feature'), (feat2, 'Just a regular feature'))
3) On my views, added the corresponding value as a class variable: api_feature = feat1
4) Created a custom DRF Permission Class that implements a has_feature function which checks if the user's plan has such requested feature.
This is the solution that i've implemented for now. All constants were managed by django-decouple.
answered Nov 12 at 5:24
Juan Ignacio Sánchez
305111
305111
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242074%2flimit-django-rest-framework-api-according-to-payment-plans%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you looked at django-rest-framework.org/api-guide/permissions? Until you've got a more concrete question/problem I'm not sure what anyone can advise here except to read through the permissions system and see if it fits what you're after/can be used for whatever it is you're after. (If that doesn't quite fit - then github.com/allisson/django-rest-framework-role-filters sounds like it might be feasible)
– Jon Clements♦
Nov 10 at 18:29
I will try to give more details
– Juan Ignacio Sánchez
Nov 10 at 18:34
i found out a posible solution, now i want to know how good it is.
– Juan Ignacio Sánchez
Nov 12 at 5:26