-
-
Notifications
You must be signed in to change notification settings - Fork 303
6009: add organizations to invitation querysets and sync #6039
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
base: unstable
Are you sure you want to change the base?
Changes from all commits
cf2a01e
2045c38
475ba8e
adf1830
bd756fe
683d1ca
22b1f51
eb4a8b6
4f4a2b9
1400e4a
fbaf00e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1895,6 +1895,40 @@ class Meta: | |
| def __str__(self): | ||
| return self.name | ||
|
|
||
| @classmethod | ||
| def filter_edit_queryset(cls, queryset, user): | ||
| if user.is_anonymous: | ||
| return queryset.none() | ||
|
|
||
| if user.is_admin: | ||
| return queryset | ||
|
|
||
| return queryset.filter( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise: Checking |
||
| user_roles__user=user, | ||
| user_roles__role=ORGANIZATION_ADMIN, | ||
| user_roles__status=ORGANIZATION_ROLE_STATUS_ACTIVE, | ||
| deleted=False, | ||
| ).distinct() | ||
|
|
||
| @classmethod | ||
| def filter_view_queryset(cls, queryset, user): | ||
| if user.is_anonymous: | ||
| return queryset.none() | ||
|
|
||
| if user.is_admin: | ||
| return queryset | ||
|
|
||
| return queryset.filter( | ||
| user_roles__user=user, | ||
| user_roles__role__in=[ | ||
| ORGANIZATION_ADMIN, | ||
| ORGANIZATION_EDITOR, | ||
| ORGANIZATION_VIEWER, | ||
| ], | ||
| user_roles__status=ORGANIZATION_ROLE_STATUS_ACTIVE, | ||
| deleted=False, | ||
| ).distinct() | ||
|
|
||
|
|
||
| class OrganizationRole(models.Model): | ||
| """ | ||
|
|
@@ -3807,7 +3841,14 @@ def filter_edit_queryset(cls, queryset, user): | |
| return queryset | ||
|
|
||
| return queryset.filter( | ||
|
yasinelmi marked this conversation as resolved.
|
||
| Q(email__iexact=user.email) | Q(sender=user) | Q(channel__editors=user) | ||
| Q(email__iexact=user.email) | ||
| | Q(sender=user) | ||
| | Q(channel__editors=user) | ||
| | Q( | ||
| organization__user_roles__user=user, | ||
| organization__user_roles__role=ORGANIZATION_ADMIN, | ||
| organization__user_roles__status=ORGANIZATION_ROLE_STATUS_ACTIVE, | ||
| ) | ||
| ).distinct() | ||
|
|
||
| @classmethod | ||
|
|
@@ -3822,6 +3863,15 @@ def filter_view_queryset(cls, queryset, user): | |
| | Q(sender=user) | ||
| | Q(channel__editors=user) | ||
| | Q(channel__viewers=user) | ||
| | Q( | ||
| organization__user_roles__user=user, | ||
| organization__user_roles__role__in=[ | ||
| ORGANIZATION_ADMIN, | ||
| ORGANIZATION_EDITOR, | ||
| ORGANIZATION_VIEWER, | ||
| ], | ||
| organization__user_roles__status=ORGANIZATION_ROLE_STATUS_ACTIVE, | ||
| ) | ||
| ).distinct() | ||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.