diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-19 13:25:02 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-19 13:25:02 +0200 |
commit | d78d0c0136531093ad66a093d6cc0695967fc043 (patch) | |
tree | bf1b8efe583186b7177208bfce43abea8f707780 | |
parent | Check is the user is authenticated before checking if the user is authorized ... (diff) | |
download | newspipe-d78d0c0136531093ad66a093d6cc0695967fc043.tar.gz newspipe-d78d0c0136531093ad66a093d6cc0695967fc043.tar.bz2 newspipe-d78d0c0136531093ad66a093d6cc0695967fc043.zip |
Defined an url prefix for the new API.
-rw-r--r-- | src/web/views/api/v3/article.py | 3 | ||||
-rw-r--r-- | src/web/views/api/v3/common.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/web/views/api/v3/article.py b/src/web/views/api/v3/article.py index da75dc47..cc769597 100644 --- a/src/web/views/api/v3/article.py +++ b/src/web/views/api/v3/article.py @@ -1,9 +1,10 @@ from web import models from bootstrap import application, manager -from web.views.api.v3.common import auth_func, check_auth +from web.views.api.v3.common import url_prefix, auth_func, check_auth blueprint_article = manager.create_api_blueprint(models.Article, + url_prefix=url_prefix, methods=['GET', 'POST', 'PUT', 'DELETE'], preprocessors=dict(GET_SINGLE=[auth_func, check_auth])) application.register_blueprint(blueprint_article) diff --git a/src/web/views/api/v3/common.py b/src/web/views/api/v3/common.py index 8831b8ba..b4e6b62e 100644 --- a/src/web/views/api/v3/common.py +++ b/src/web/views/api/v3/common.py @@ -3,6 +3,9 @@ from flask.ext.restless import ProcessingException from web.controllers import ArticleController +url_prefix = '/api/v3' + + def is_authorized_to_modify(user, obj): return user.id == obj.user_id |