mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Fix library restriction not fully case-insensitive
This commit is contained in:
parent
fd9b16ece2
commit
12c8f8f29c
@ -147,7 +147,7 @@ class TestAuth(BaseTest):
|
||||
self.assertRaises(HTTPForbidden, get_library, 'xxx')
|
||||
um.add_user('a', 'a')
|
||||
self.assertEqual(library_info('a')[0], {'l%d'%i:'l%d'%i for i in range(1, 4)})
|
||||
um.update_user_restrictions('a', {'blocked_library_names': ['l2']})
|
||||
um.update_user_restrictions('a', {'blocked_library_names': ['L2']})
|
||||
self.assertEqual(library_info('a')[0], {'l%d'%i:'l%d'%i for i in range(1, 4) if i != 2})
|
||||
um.update_user_restrictions('a', {'allowed_library_names': ['l3']})
|
||||
self.assertEqual(library_info('a')[0], {'l%d'%i:'l%d'%i for i in range(1, 4) if i == 3})
|
||||
|
@ -28,8 +28,8 @@ def parse_restriction(raw):
|
||||
r = load_json(raw)
|
||||
if not isinstance(r, dict):
|
||||
r = {}
|
||||
r['allowed_library_names'] = frozenset(r.get('allowed_library_names', ()))
|
||||
r['blocked_library_names'] = frozenset(r.get('blocked_library_names', ()))
|
||||
r['allowed_library_names'] = frozenset(map(lambda x: x.lower(), r.get('allowed_library_names', ())))
|
||||
r['blocked_library_names'] = frozenset(map(lambda x: x.lower(), r.get('blocked_library_names', ())))
|
||||
return r
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user