Application members should not see deleted applications.
This updates the `Portfolios.for_user` method to screen out deleted ApplicationRole entities. For extra assurance, we also mark application roles as disabled when they are deleted.
This commit is contained in:
@@ -63,6 +63,7 @@ class Applications(BaseDomainClass):
|
||||
|
||||
for role in application.roles:
|
||||
role.deleted = True
|
||||
role.status = ApplicationRoleStatus.DISABLED
|
||||
db.session.add(role)
|
||||
|
||||
db.session.add(application)
|
||||
|
||||
@@ -35,6 +35,7 @@ class PortfoliosQuery(Query):
|
||||
ApplicationRole.status
|
||||
== ApplicationRoleStatus.ACTIVE
|
||||
)
|
||||
.filter(ApplicationRole.deleted == False)
|
||||
.subquery()
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user