mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-27 00:40:06 +00:00
fix(tableau): prevents warning in case of site admin creator role (#12175)
This commit is contained in:
parent
45ace13fe2
commit
acb76cd97c
@ -645,7 +645,7 @@ def report_user_role(report: TableauSourceReport, server: Server) -> None:
|
||||
# the site-role might be different on another site
|
||||
logged_in_user: UserInfo = UserInfo.from_server(server=server)
|
||||
|
||||
if not logged_in_user.is_site_administrator_explorer():
|
||||
if not logged_in_user.has_site_administrator_explorer_privileges():
|
||||
report.warning(
|
||||
title=title,
|
||||
message=message,
|
||||
|
||||
@ -82,4 +82,6 @@ PROJECT = "Project"
|
||||
SITE = "Site"
|
||||
IS_UNSUPPORTED_CUSTOM_SQL = "isUnsupportedCustomSql"
|
||||
SITE_PERMISSION = "sitePermission"
|
||||
SITE_ROLE = "SiteAdministratorExplorer"
|
||||
ROLE_SITE_ADMIN_EXPLORER = "SiteAdministratorExplorer"
|
||||
ROLE_SITE_ADMIN_CREATOR = "SiteAdministratorCreator"
|
||||
ROLE_SERVER_ADMIN = "ServerAdministrator"
|
||||
|
||||
@ -11,8 +11,12 @@ class UserInfo:
|
||||
site_role: str
|
||||
site_id: str
|
||||
|
||||
def is_site_administrator_explorer(self):
|
||||
return self.site_role == c.SITE_ROLE
|
||||
def has_site_administrator_explorer_privileges(self):
|
||||
return self.site_role in [
|
||||
c.ROLE_SITE_ADMIN_EXPLORER,
|
||||
c.ROLE_SITE_ADMIN_CREATOR,
|
||||
c.ROLE_SERVER_ADMIN,
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def from_server(server: Server) -> "UserInfo":
|
||||
|
||||
@ -28,7 +28,7 @@ def check_user_role(
|
||||
|
||||
try:
|
||||
# TODO: Add check for `Enable Derived Permissions`
|
||||
if not logged_in_user.is_site_administrator_explorer():
|
||||
if not logged_in_user.has_site_administrator_explorer_privileges():
|
||||
capability_dict[c.SITE_PERMISSION] = CapabilityReport(
|
||||
capable=False,
|
||||
failure_reason=f"{failure_reason} Their current role is {logged_in_user.site_role}.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user