Skip to content

Commit

Permalink
Integrate role, permission, user APIs on Flask-AppBuilder into Apache…
Browse files Browse the repository at this point in the history
… Superset (apache#21050)
  • Loading branch information
jileeon88 committed Aug 16, 2022
1 parent 4f1996d commit 9b1bf50
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ def CSV_TO_HIVE_UPLOAD_DIRECTORY_FUNC( # pylint: disable=invalid-name
FAB_ADD_SECURITY_PERMISSION_VIEW = False
FAB_ADD_SECURITY_VIEW_MENU_VIEW = False
FAB_ADD_SECURITY_PERMISSION_VIEWS_VIEW = False
FAB_ADD_SECURITY_API = False

# The link to a page containing common errors and their resolutions
# It will be appended at the bottom of sql_lab errors.
Expand Down
15 changes: 15 additions & 0 deletions superset/initialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
from flask_compress import Compress
from werkzeug.middleware.proxy_fix import ProxyFix

from flask_appbuilder.security.sqla.apis import (
PermissionApi,
PermissionViewMenuApi,
RoleApi,
UserApi,
ViewMenuApi,
)
from superset.constants import CHANGE_ME_SECRET_KEY
from superset.extensions import (
_event_logger,
Expand Down Expand Up @@ -382,6 +389,14 @@ def init_views(self) -> None:
),
)
appbuilder.add_api(SecurityRestApi)

if self.config["FAB_ADD_SECURITY_API"]:
appbuilder.add_api(PermissionApi)
appbuilder.add_api(PermissionViewMenuApi)
appbuilder.add_api(RoleApi)
appbuilder.add_api(UserApi)
appbuilder.add_api(ViewMenuApi)

#
# Conditionally setup email views
#
Expand Down

0 comments on commit 9b1bf50

Please sign in to comment.