Skip to content

Commit

Permalink
feat: FF the dashboard CRUD view with the DASHBOARD_RBAC
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmiran137 committed Jan 30, 2021
1 parent 594e9f2 commit 80c26ae
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions superset/views/dashboard/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@
# under the License.
from flask_babel import lazy_gettext as _

from ... import is_feature_enabled
from ...dashboards.filters import DashboardFilter
from ..base import check_ownership

roles_edit = []
roles_description = {}
roles_label = {}
if is_feature_enabled("DASHBOARD_RBAC"):
roles_edit = "roles"
roles_description = {
"roles": _(
"Roles is a list which defines access to the dashboard. "
"These roles are always applied in addition to restrictions on dataset "
"level access. "
"If no roles defined then the dashboard is available to all roles."
)
}
roles_label = {"roles": _("Roles")}

class DashboardMixin: # pylint: disable=too-few-public-methods

class DashboardMixin: # pylint: disable=too-few-public-methods
list_title = _("Dashboards")
show_title = _("Show Dashboard")
add_title = _("Add Dashboard")
Expand All @@ -33,7 +48,7 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
"dashboard_title",
"slug",
"owners",
"roles",
roles_edit,
"position_json",
"css",
"json_metadata",
Expand Down Expand Up @@ -63,12 +78,7 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
"want to alter specific parameters."
),
"owners": _("Owners is a list of users who can alter the dashboard."),
"roles": _(
"Roles is a list which defines access to the dashboard. "
"These roles are always applied in addition to restrictions on dataset "
"level access. "
"If no roles defined then the dashboard is available to all roles."
),
**roles_description,
"published": _(
"Determines whether or not this dashboard is "
"visible in the list of all dashboards"
Expand All @@ -81,7 +91,7 @@ class DashboardMixin: # pylint: disable=too-few-public-methods
"slug": _("Slug"),
"charts": _("Charts"),
"owners": _("Owners"),
"roles": _("Roles"),
**roles_label,
"published": _("Published"),
"creator": _("Creator"),
"modified": _("Modified"),
Expand Down

0 comments on commit 80c26ae

Please sign in to comment.