# HG changeset patch # User Goffi # Date 1596290561 -7200 # Node ID 83f25da66beca0c113e89688cd080136619bd1b5 # Parent 5369ce5bcecf512c549b0d28e78b20e976d1238d 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. diff -r 5369ce5bcecf -r 83f25da66bec sat/memory/memory.py --- a/sat/memory/memory.py Sat Aug 01 15:59:49 2020 +0200 +++ b/sat/memory/memory.py Sat Aug 01 16:02:41 2020 +0200 @@ -1222,7 +1222,15 @@ perm_data = file_data["access"][perm] perm_type = perm_data["type"] except KeyError: - raise exceptions.PermissionError() + # No permission is set. + # If we are in a root file/directory, we deny access + # otherwise, we use public permission, as the parent directory will + # block anyway, this avoid to have to recursively change permissions for + # all sub directories/files when modifying a permission + if not file_data.get('parent'): + raise exceptions.PermissionError() + else: + perm_type == C.ACCESS_TYPE_PUBLIC if perm_type == C.ACCESS_TYPE_PUBLIC: continue elif perm_type == C.ACCESS_TYPE_WHITELIST: diff -r 5369ce5bcecf -r 83f25da66bec sat/memory/sqlite.py --- a/sat/memory/sqlite.py Sat Aug 01 15:59:49 2020 +0200 +++ b/sat/memory/sqlite.py Sat Aug 01 16:02:41 2020 +0200 @@ -1426,7 +1426,7 @@ ) statements.extend([ f"INSERT INTO files({cols}) SELECT {old_cols} FROM files_old", - f"DROP TABLE files_old", + "DROP TABLE files_old", ]) statements.extend(Updater.indexData2Raw(index)) return statements