Filter environments for user with given project id

Previously, calling `Environment.for_user(user, project)` would return
environments a user has access to across all projects. Now, we will only
return the relevant environements. This was the cause of a visual bug
where extra environments were shown in the project list.
This commit is contained in:
Patrick Smith
2018-09-30 22:06:10 -04:00
parent 7e84382a66
commit 7b2a099ef3
3 changed files with 47 additions and 2 deletions

View File

@@ -44,7 +44,7 @@ class Environments(object):
.join(EnvironmentRole)
.join(Project)
.filter(EnvironmentRole.user_id == user.id)
.filter(Project.id == Environment.project_id)
.filter(Environment.project_id == project.id)
.all()
)