Add recursive option to apply rights in the SAS

This commit is contained in:
Skia
2016-12-18 19:08:25 +01:00
parent dd2be2a31e
commit 352b8f0b4f
2 changed files with 17 additions and 1 deletions

View File

@ -612,6 +612,15 @@ class SithFile(models.Model):
if copy_rights:
self.copy_rights()
def apply_rights_recursively(self, only_folders=False):
print(self)
children = self.children.all()
if only_folders:
children = children.filter(is_folder=True)
for c in children:
c.copy_rights()
c.apply_rights_recursively(only_folders)
def copy_rights(self):
"""Copy, if possible, the rights of the parent folder"""
if self.parent is not None: