From 65daf4fe3a66ea28d244c484fce86129faf4d6a6 Mon Sep 17 00:00:00 2001 From: Megan Henning <meganhenning@flywheel.io> Date: Tue, 3 Jan 2017 17:19:50 -0600 Subject: [PATCH] Minor changes to archived functionality --- api/auth/containerauth.py | 2 -- api/handlers/collectionshandler.py | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/auth/containerauth.py b/api/auth/containerauth.py index d7f53fee..430558b6 100644 --- a/api/auth/containerauth.py +++ b/api/auth/containerauth.py @@ -42,8 +42,6 @@ def default_container(handler, container=None, target_parent_container=None): ) elif method == 'PUT' and target_parent_container is None: required_perm = 'rw' - if set(['archived','public']).intersection(payload.keys()): - required_perm = 'admin' has_access = _get_access(handler.uid, handler.user_site, container) >= INTEGER_ROLES[required_perm] else: has_access = False diff --git a/api/handlers/collectionshandler.py b/api/handlers/collectionshandler.py index c4f8b9c5..2cede707 100644 --- a/api/handlers/collectionshandler.py +++ b/api/handlers/collectionshandler.py @@ -140,6 +140,8 @@ class CollectionsHandler(ContainerHandler): {'$group': {'_id': '$session'}}, ]) query = {'_id': {'$in': [ar['_id'] for ar in agg_res]}} + if not self.is_true('archived'): + query['archived'] = {'$ne': True} projection = self.container_handler_configurations['sessions']['list_projection'] log.debug(query) log.debug(projection) @@ -159,6 +161,8 @@ class CollectionsHandler(ContainerHandler): if not self.storage.dbc.find_one({'_id': _id}): self.abort(404, 'no such Collection') query = {'collections': _id} + if not self.is_true('archived'): + query['archived'] = {'$ne': True} sid = self.get_param('session', '') if bson.ObjectId.is_valid(sid): query['session'] = bson.ObjectId(sid) -- GitLab