Cancel job if the service is inactive.

Update the PermissionsDao.get_permissions_by_user_id to only return permissions for active services,
this will make the admin app return a 403 if someone (otherthan platform admin) tries to look at an inactive service.
Removed the active flag in sample_service the dao_create_service overiddes this attribute.
This commit is contained in:
Rebecca Law
2017-02-02 11:34:00 +00:00
parent dab89969cc
commit f56824adde
5 changed files with 56 additions and 8 deletions

View File

@@ -59,7 +59,8 @@ class PermissionDAO(DAOClass):
db.session.commit()
def get_permissions_by_user_id(self, user_id):
return self.Meta.model.query.filter_by(user_id=user_id).all()
return self.Meta.model.query.filter_by(user_id=user_id)\
.join(Permission.service).filter_by(active=True).all()
permission_dao = PermissionDAO()