1

I'm building an interface where I see a list of items. As an admin, I see everyone's items. This clutters up the drag and drop Pages interface. This is the query I use to list items:

sort(find('Item'), 'due')

How do I limit this to just the logged in user's items?

Rob
  • 26,989
  • 16
  • 82
  • 98
Brad Fair
  • 917
  • 1
  • 7
  • 11

1 Answers1

2

You can use something like this:

sort(find('Item', 'owner', me), 'due')

or

filter(sort(find('Item'), 'due'), eq(data.owner, me))
  • Thanks Christian; I've tried both of these, and for the admin user they still show up, though the owner for the records are other users. – Brad Fair Jun 21 '17 at 16:56
  • Can you elaborate on the context of the functions? What kind of items do you display? Does the issue come up in a repeater element, or in page tree elements? – Christian Morgner Jun 23 '17 at 09:12
  • It's a repeater I'm using to generate a list of links to the item details page. It's in a shared component. – Brad Fair Jun 26 '17 at 22:17
  • I cannot reproduce the error on my system. When I create a type `Item`, create 5 Item instances and remove my ownership of two of them, repeaters with both of the above expressions show exactly three items. Can you confirm that the owners of the items are in fact different User nodes? – Christian Morgner Jun 27 '17 at 18:17
  • In my data, I have 5 items; one is owned by a user called Test, and four are owned by a user called "Brad Fair" As 'admin' in the admin interface under Pages, I see all of the items even though 'admin' owns none of them. – Brad Fair Jun 27 '17 at 22:22
  • What is the type of these items? If they are part of the page tree, they will be displayed in the preview frame regardless of the ownership. Please click on the little eye icon that appears when you hover over the tab with the page's name to view it in a separate browser tab. At least there, the visibility should be correct. The preview frame uses a different display mode. – Christian Morgner Jun 28 '17 at 07:29