feat(row-level-security): add hook for customizing form dropdowns (#10683)
This commit is contained in:
parent
a6101f72c9
commit
4251b4e294
|
|
@ -869,6 +869,16 @@ TALISMAN_CONFIG = {
|
|||
# a custom security config could potentially give access to setting filters on
|
||||
# tables that users do not have access to.
|
||||
ENABLE_ROW_LEVEL_SECURITY = False
|
||||
# It is possible to customize which tables and roles are featured in the RLS
|
||||
# dropdown. When set, this dict is assigned to `add_form_query_rel_fields` and
|
||||
# `edit_form_query_rel_fields` on `RowLevelSecurityFiltersModelView`. Example:
|
||||
#
|
||||
# from flask_appbuilder.models.sqla import filters
|
||||
# RLS_FORM_QUERY_REL_FIELDS = {
|
||||
# "roles": [["name", filters.FilterStartsWith, "RlsRole"]]
|
||||
# "tables": [["table_name", filters.FilterContains, "rls"]]
|
||||
# }
|
||||
RLS_FORM_QUERY_REL_FIELDS: Optional[Dict[str, List[List[Any]]]] = None
|
||||
|
||||
#
|
||||
# Flask session cookie options
|
||||
|
|
|
|||
|
|
@ -274,6 +274,9 @@ class RowLevelSecurityFiltersModelView( # pylint: disable=too-many-ancestors
|
|||
"creator": _("Creator"),
|
||||
"modified": _("Modified"),
|
||||
}
|
||||
if app.config["RLS_FORM_QUERY_REL_FIELDS"]:
|
||||
add_form_query_rel_fields = app.config["RLS_FORM_QUERY_REL_FIELDS"]
|
||||
edit_form_query_rel_fields = add_form_query_rel_fields
|
||||
|
||||
|
||||
class TableModelView( # pylint: disable=too-many-ancestors
|
||||
|
|
|
|||
Loading…
Reference in New Issue