Skip to content

Instantly share code, notes, and snippets.

@uds5501
Last active April 25, 2019 03:27
Show Gist options
  • Save uds5501/0a6bd232b62351efeaf61d88dfdea352 to your computer and use it in GitHub Desktop.
Save uds5501/0a6bd232b62351efeaf61d88dfdea352 to your computer and use it in GitHub Desktop.
api.haspermit decorator
from flask import Flask
from flask_rest_jsonapi import Api
from your_project.permission import permission_manager
app = Flask(__name__)
api = Api()
api.init_app(app)
api.permission_manager(permission_manager)
from flask_rest_jsonapi import ResourceList
from your_project.extensions import api
class PersonList(ResourceList):
disable_permission = True
@api.has_permission('custom_arg', custom_kwargs='custom_kwargs')
def get(*args, **kwargs):
return 'Hello world !'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment