-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tracking Pull Request to merge release-1.16.0 to master (#420) - spri…
…nt 26 (Z Cars) sprint report link on JIRA https://apps.nrs.gov.bc.ca/int/jira/secure/RapidBoard.jspa?rapidView=3304&projectKey=ZEVA&view=reporting&chart=sprintRetrospective&sprint=7704
- Loading branch information
1 parent
a02f5b6
commit c7df3ac
Showing
58 changed files
with
1,333 additions
and
293 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
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
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
60 changes: 60 additions & 0 deletions
60
backend/api/fixtures/operational/0015_add_credit_transfer_permissions.py
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,60 @@ | ||
from django.db import transaction | ||
|
||
from api.management.data_script import OperationalDataScript | ||
from api.models.permission import Permission | ||
from api.models.role import Role | ||
from api.models.role_permission import RolePermission | ||
|
||
|
||
class UpdateRolesPermissions(OperationalDataScript): | ||
""" | ||
Adds the Roles and Permissions | ||
""" | ||
is_revertable = False | ||
comment = 'Adds the view credit transfers permissions for ZEV users and ' \ | ||
'signing authorities.' | ||
|
||
def check_run_preconditions(self): | ||
return True | ||
|
||
def update_zeva_user(self): | ||
permissions_to_be_added = [ | ||
'VIEW_CREDIT_TRANSFERS', | ||
] | ||
|
||
role = Role.objects.get( | ||
role_code="ZEVA User" | ||
) | ||
|
||
for permission_code in permissions_to_be_added: | ||
permission = Permission.objects.get(permission_code=permission_code) | ||
RolePermission.objects.get_or_create( | ||
permission=permission, | ||
role=role | ||
) | ||
|
||
def update_signing_authority(self): | ||
permissions_to_be_added = [ | ||
'VIEW_CREDIT_TRANSFERS', | ||
] | ||
|
||
role = Role.objects.get( | ||
role_code="Signing Authority" | ||
) | ||
|
||
for permission_code in permissions_to_be_added: | ||
permission = Permission.objects.get(permission_code=permission_code) | ||
RolePermission.objects.get_or_create( | ||
permission=permission, | ||
role=role | ||
) | ||
|
||
@transaction.atomic | ||
def run(self): | ||
self.update_zeva_user() | ||
self.update_signing_authority() | ||
|
||
print('Updated Permissions') | ||
|
||
|
||
script_class = UpdateRolesPermissions |
45 changes: 45 additions & 0 deletions
45
backend/api/fixtures/operational/0016_update_roles_permissions.py
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,45 @@ | ||
from django.db import transaction | ||
|
||
from api.management.data_script import OperationalDataScript | ||
from api.models.permission import Permission | ||
from api.models.role import Role | ||
from api.models.role_permission import RolePermission | ||
from api.authorities import REQUIRED_AUTHORITIES | ||
|
||
|
||
class UpdateRolesPermissions(OperationalDataScript): | ||
""" | ||
Adds the Roles and Permissions | ||
""" | ||
is_revertable = False | ||
comment = 'Updates the permissions for the roles so that they make more ' \ | ||
'sense with application.' | ||
|
||
def check_run_preconditions(self): | ||
return True | ||
|
||
def update_analyst(self): | ||
|
||
role = Role.objects.get( | ||
role_code="Engineer/Analyst" | ||
) | ||
|
||
permissions_to_be_added = [ | ||
'VIEW_USERS', | ||
] | ||
|
||
for permission_code in permissions_to_be_added: | ||
permission = Permission.objects.get(permission_code=permission_code) | ||
RolePermission.objects.get_or_create( | ||
permission=permission, | ||
role=role | ||
) | ||
|
||
@transaction.atomic | ||
def run(self): | ||
self.update_analyst() | ||
|
||
print('Updated Permissions') | ||
|
||
|
||
script_class = UpdateRolesPermissions |
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
Oops, something went wrong.