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

Hiding importance filter from clients that have restricted coverage information [STTNHUB-327] #900

Merged
merged 6 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions newsroom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,14 @@ def get_groups(company: Optional[Company], groups: List[Group]) -> List[Group]:
"""
filter agenda groups based on restrict_coverage_info permission
"""
if company and company.get("restrict_coverage_info"):
return [group for group in groups if "restrict_coverage_info" not in group.get("permissions", [])]
return groups
return [group for group in groups if has_permissions(group, company)]


def has_permissions(group: Group, company: Optional[Company]) -> bool:
group_permissions = group.get("permissions", [])
if group_permissions:
for permission in group_permissions:
if company and company.get(permission):
return False
devketanpro marked this conversation as resolved.
Show resolved Hide resolved
return True
return True
Loading