Skip to content

Commit

Permalink
Merge pull request ZeroNetX#210 from zeronet-conservancy/allow_null_p…
Browse files Browse the repository at this point in the history
…ermission_rules

Allow setting permission_rules to null in content.json
  • Loading branch information
caryoscelus authored Jul 20, 2023
2 parents 24a7ba7 + 3dc2283 commit d9fea20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Content/ContentManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ def getUserContentRules(self, parent_content, inner_path, content):
for permission_pattern, permission_rules in list(user_contents["permission_rules"].items()): # Regexp rules
if not SafeRe.match(permission_pattern, user_urn):
continue # Rule is not valid for user
if permission_rules is None:
self.log.info(f'Permission rule for {permission_pattern} is null, '
'we set max_size[_optional] to zero. '
'NOTE: This is not supported by <0.7.10')
permission_rules = {'max_size': 0, 'max_size_optional': 0}
# Update rules if its better than current recorded ones
for key, val in permission_rules.items():
if key not in rules:
Expand Down

0 comments on commit d9fea20

Please sign in to comment.