Skip to content

Commit 0e19af2

Browse files
committed
Fix security checks for individual properties
1 parent 78363ff commit 0e19af2

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

roundup/rest.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -636,9 +636,7 @@ def get_collection(self, class_name, input):
636636

637637
uid = self.db.getuid()
638638

639-
if not self.db.security.hasPermission(
640-
'View', uid, class_name
641-
):
639+
if not self.db.security.hasPermission('View', uid, class_name):
642640
raise Unauthorised('Permission to view %s denied' % class_name)
643641

644642
class_obj = self.db.getclass(class_name)
@@ -730,14 +728,19 @@ def get_collection(self, class_name, input):
730728
result={}
731729
result['collection']=[]
732730
for item_id in obj_list:
731+
r = {}
733732
if self.db.security.hasPermission(
734-
'View', uid, class_name, itemid=item_id):
733+
'View', uid, class_name, itemid=item_id, property='id'
734+
):
735735
r = {'id': item_id, 'link': class_path + item_id}
736-
if display_props:
737-
r.update(self.format_item(class_obj.getnode(item_id),
738-
item_id,
739-
props=display_props,
740-
verbose=verbose))
736+
if display_props :
737+
for p in display_props:
738+
if self.db.security.hasPermission(
739+
'View', uid, class_name, itemid=item_id, property=p
740+
):
741+
r.update(self.format_item(class_obj.getnode(item_id),
742+
item_id, props=display_props, verbose=verbose))
743+
if r:
741744
result['collection'].append(r)
742745

743746
result_len = len(result['collection'])

0 commit comments

Comments
 (0)