Use application_role_id on environment_roles.
In the future, an `application_invitation1 will not refer to a `user` until someone accepts the invitation; they'll only reference an `application_role`. When a user is invited to an application, the inviter can specify the environments the invitee should have access to. For this to be possible, an `environment_role` should reference an `application_role`, because no `user` entity will be known at that time. In addition to updating all the models and domain methods necessary for this change, this commit deletes unused code and tests that were dependent on `environment_roles` having a `user_id` foreign key.
This commit is contained in:
@@ -225,7 +225,7 @@ def add_applications_to_portfolio(portfolio):
|
||||
last_name=user_data["last_name"],
|
||||
)
|
||||
|
||||
ApplicationRoles.create(
|
||||
app_role = ApplicationRoles.create(
|
||||
user=user,
|
||||
application=application,
|
||||
permission_set_names=[PermissionSets.EDIT_APPLICATION_TEAM],
|
||||
@@ -237,7 +237,9 @@ def add_applications_to_portfolio(portfolio):
|
||||
)
|
||||
for env in user_environments:
|
||||
role = random.choice([e.value for e in CSPRole])
|
||||
EnvironmentRoles.create(user=user, environment=env, role=role)
|
||||
EnvironmentRoles.create(
|
||||
application_role=app_role, environment=env, role=role
|
||||
)
|
||||
|
||||
|
||||
def create_demo_portfolio(name, data):
|
||||
|
Reference in New Issue
Block a user