-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/cls2 1231 one list permission changes (#5942)
Allow Account manager to change one list tier and core team members for "their" companies. --------- Co-authored-by: Claudia Gonzalez-Casales <[email protected]>
- Loading branch information
1 parent
5f13a7d
commit 7c487a6
Showing
5 changed files
with
184 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from rest_framework.permissions import BasePermission | ||
|
||
from datahub.company.models import CompanyPermission | ||
|
||
|
||
class IsAccountManagerOnCompany(BasePermission): | ||
""" | ||
Allows users: | ||
- that have change_company and change_one_list_tier_and_global_account_manager permissions | ||
- or that are one_list_account_owners (account managers/ITA Leads) for the current record. | ||
""" | ||
|
||
def has_object_permission(self, request, view, obj): | ||
return request.user.has_perms([ | ||
f'company.{CompanyPermission.change_company}', | ||
f'company.{CompanyPermission.change_one_list_tier_and_global_account_manager}', | ||
]) or (obj.one_list_account_owner == request.user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters