Skip to content

Commit

Permalink
fix(tableau): prevents warning in case of site admin creator role (da…
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomezvillamor authored Dec 19, 2024
1 parent 45ace13 commit acb76cd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@
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"
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}.",
Expand Down

0 comments on commit acb76cd

Please sign in to comment.