'Return whether the current user can access the resource.
Example::
@app.route(\'/some_url\', methods=[\'GET\', \'POST\'])
@rbac.allow([\'anonymous\'], [\'GET\'])
def a_view_func():
return Response(\'Blah Blah...\')
If you are not logged.
`rbac.has_permission(\'GET\', \'a_view_func\')` return True.
`rbac.has_permission(\'POST\', \'a_view_func\')` return False.
:param method: The method wait to check.
:param endpoint: The application endpoint.
:param user: user who you need to check. Current user by default.'

def has_permission(self, method, endpoint, user=None):

    app = self.get_app()
    _user = (user or current_user)
    roles = _user.get_roles()
    view_func = app.view_functions[endpoint]
    return self._check_permission(roles, method, view_func)
