mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add recursive option to apply rights in the SAS
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user