comparison sat/memory/memory.py @ 3317:83f25da66bec

core (memory): files are now public by default except for those in root directory: using public permissions by default makes permissions change more easy as we don't have to recursively change all permissions of sub files when changing directory. Root directories are private by default.
author Goffi <goffi@goffi.org>
date Sat, 01 Aug 2020 16:02:41 +0200
parents 624c60293deb
children 460606155bec
comparison
equal deleted inserted replaced
3316:5369ce5bcecf 3317:83f25da66bec
1220 # we must never return here, we only return after the loop if nothing was blocking the access 1220 # we must never return here, we only return after the loop if nothing was blocking the access
1221 try: 1221 try:
1222 perm_data = file_data["access"][perm] 1222 perm_data = file_data["access"][perm]
1223 perm_type = perm_data["type"] 1223 perm_type = perm_data["type"]
1224 except KeyError: 1224 except KeyError:
1225 raise exceptions.PermissionError() 1225 # No permission is set.
1226 # If we are in a root file/directory, we deny access
1227 # otherwise, we use public permission, as the parent directory will
1228 # block anyway, this avoid to have to recursively change permissions for
1229 # all sub directories/files when modifying a permission
1230 if not file_data.get('parent'):
1231 raise exceptions.PermissionError()
1232 else:
1233 perm_type == C.ACCESS_TYPE_PUBLIC
1226 if perm_type == C.ACCESS_TYPE_PUBLIC: 1234 if perm_type == C.ACCESS_TYPE_PUBLIC:
1227 continue 1235 continue
1228 elif perm_type == C.ACCESS_TYPE_WHITELIST: 1236 elif perm_type == C.ACCESS_TYPE_WHITELIST:
1229 try: 1237 try:
1230 jids = perm_data["jids"] 1238 jids = perm_data["jids"]