0

I want to add a new API to superset backend(shown in the screenshot below). This new API is similar to the chart(slice) API, and all the methods are decorated with @protect.

When I use "Measure" as class_permission_name, the api call will return "message": "Forbidden". (I have already add the token to the header)

However, when I remove @protect or change the class_permission_name to "Chart", all the APIs work well.

Does anyone know how to solve this problem if I want to use @protect as decorator and also set class_permission_name to "Measure"? Highly appreciate in advance!

class MeasureRestApi(BaseSupersetModelRestApi):
    datamodel = SQLAInterface(Measure)

    resource_name = "measure"
    class_permission_name = "Measure"
    method_permission_name = MODEL_API_RW_METHOD_PERMISSION_MAP
    ...
    ...

    @expose("/", methods=["POST"])
    @protect()
    @safe
    @statsd_metrics
    @requires_json
    def post(self) -> Response:
        """Creates a new Measure
        ...
        ...

enter image description here

0 Answers0