Handle cascading mark inactive in better ways as per rbac spec

specifically around Teams and Credentials
This commit is contained in:
Matthew Jones
2014-07-24 15:19:53 -04:00
parent 20d76bfc91
commit 695df551e7
4 changed files with 53 additions and 4 deletions

View File

@@ -83,6 +83,13 @@ class Team(CommonModelNameNotUnique):
def get_absolute_url(self):
return reverse('api:team_detail', args=(self.pk,))
def mark_inactive(self, save=True):
'''
When marking a team inactive we'll wipe out its credentials also
'''
for cred in self.credentials.all():
cred.mark_inactive()
super(Team, self).mark_inactive(save=save)
class Permission(CommonModelNameNotUnique):
'''