Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - Virtual Connection default permissions #1525

Open
TrimPeachu opened this issue Nov 8, 2024 · 1 comment
Open

Bug - Virtual Connection default permissions #1525

TrimPeachu opened this issue Nov 8, 2024 · 1 comment

Comments

@TrimPeachu
Copy link
Contributor

Describe the bug
In #1463 I've added support for virtual connection project permissions. I've now realized that they don't work.

Default virtualconnection permissions have been defined in project_item as follows:

self._default_virtualconnection_permissions = None
......
@property
def default_virtualconnection_permissions(self):
    if self._default_virtualconnection_permissions is None:
        raise UnpopulatedPropertyError(self.ERROR_MSG)
    return self._default_virtualconnection_permissions()

While populating permissions, we use Resource.VirtualConection referencing models/tableau_types

@api(version="3.23")
def populate_virtualconnection_default_permissions(self, item: ProjectItem) -> None:
    self._default_permissions.populate_default_permissions(item, Resource.VirtualConnection)
class Resource:
    ...
    VirtualConnection = "virtualConnection"

Issue occurs while populating the permissions, as _set_default_permissions function tries to set the attribute _default_virtualConnection_permissions instead of _default_virtualconnection_permissions

def _set_default_permissions(self, permissions, content_type):
    attr = f"_default_{content_type}_permissions"
    setattr(
        self,
        attr,
        permissions,
    )

Possible solutions:

  1. Change virtualConnection definition in models/tableau_types.py to virtualconnection - could this be a breaking change for sth?
  2. Change default_virtualconnection_permissions to default_virtualConnection_permissions - snake case / camel case hybrid? not a good look
  3. Change attr = f"_default_{content_type}_permissions" so it uses only lowercase

I've created the issue instead of directly raising a PR as I am not sure which one of these changes would be prefered

@jorwoods
Copy link
Contributor

My opinion is option 3. I agree that mixing camel and snake case is visually unappealing, inconsistent, and possibly confusing later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants