diff options
-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 |