Skip to content

Preprocessors: GET_MANY doesn't works!!! #607

Open
@juranoac

Description

Documentation is ambiguous, sometimes GET_MANY and other GET_COLLECTION are used. I need to make a preprocessor to authorize. GET_SINGLE does work (return 401: forbiden), but GET_MANY or GET_COLLECTION does not (return 200: ok).

@auth_token_required
@roles_accepted('admin', 'supervisor')
def auth_func(*args, **kw):
    print('@Juan: calling auth_func...')
    pass

@auth_token_required
@roles_accepted('adminxxx', 'supervisor')
def get_many(search_params=None, **kw):
    print('@Juan: calling get_many...')
    pass
preprocessors = {'GET_SINGLE': [auth_func],
                 'GET_MANY': [get_many]}
api_manager = APIManager(app, flask_sqlalchemy_db=db)
api_manager.create_api(Person,
                       methods=['GET', 'POST', 'DELETE', 'PUT'],
                       preprocessors= preprocessors)

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions