mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat(annotations): security permissions simplification (#12014)
* Changed security permissions for annotations and annotation layers * Updated permissions in annotation layers list * Created test for retrieving premissions info. Updated uris from f-strings to strings * Updated annotations in security_tests and added annotations to NEW_SECURITY_CONVERGE_VIEWS * Added migration for annotations security converge * Updated current revision after rebase master * Updated migration name to annotations security converge * Updated annotations permissions names in AnnotationLayersList and updated test since 'can_write' has wider permissions * Updated annotations migration to current
This commit is contained in:
@@ -24,7 +24,7 @@ from flask_babel import lazy_gettext as _
|
||||
from wtforms.validators import StopValidation
|
||||
|
||||
from superset import is_feature_enabled
|
||||
from superset.constants import RouteMethod
|
||||
from superset.constants import MODEL_VIEW_RW_METHOD_PERMISSION_MAP, RouteMethod
|
||||
from superset.models.annotations import Annotation, AnnotationLayer
|
||||
from superset.typing import FlaskResponse
|
||||
from superset.views.base import SupersetModelView
|
||||
@@ -54,6 +54,9 @@ class AnnotationModelView(
|
||||
datamodel = SQLAInterface(Annotation)
|
||||
include_route_methods = RouteMethod.CRUD_SET | {"annotation"}
|
||||
|
||||
class_permission_name = "Annotation"
|
||||
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP
|
||||
|
||||
list_title = _("Annotations")
|
||||
show_title = _("Show Annotation")
|
||||
add_title = _("Add Annotation")
|
||||
@@ -109,6 +112,10 @@ class AnnotationLayerModelView(SupersetModelView): # pylint: disable=too-many-a
|
||||
datamodel = SQLAInterface(AnnotationLayer)
|
||||
include_route_methods = RouteMethod.CRUD_SET | {RouteMethod.API_READ}
|
||||
related_views = [AnnotationModelView]
|
||||
|
||||
class_permission_name = "Annotation"
|
||||
method_permission_name = MODEL_VIEW_RW_METHOD_PERMISSION_MAP
|
||||
|
||||
list_title = _("Annotation Layers")
|
||||
show_title = _("Show Annotation Layer")
|
||||
add_title = _("Add Annotation Layer")
|
||||
|
||||
Reference in New Issue
Block a user