Hello,
I am encountering a weird issue which I would like to get to the bottom of. I have an apostrophe-fancy page with a singleton of widgetType "files".
'brands':{
extend: 'apostrophe-snippets',
name: 'brands',
label: 'Brands',
instance: 'brand',
instanceLabel: 'Brand',
addFields:[
{
name:'brochure',
type: 'singleton',
widgetType: 'files',
options:{
limit: 1
}
}
]
},
Through a bridge I access the get method of this snippet in another module. This other module has a page loader function, and what it does is basically list all the brands with a link to the file if available.
The problem I am encountering is in the get method of the snippet. I define option.areas=true so that I can get the areas in the returned snippet document. And then I use
apos.areaFile(brand,"brochure"); //brand is the snippet
To get the path of the pdf file. It turns out that the "areaFile" method checks if the area contains an internal "_items" property.
It so happens that when I use the request "req" object for the snippets get method the area is returned properly but that "_items" property is not set. However if I use apos.getTaskReq() instead, then it all works.
I am assuming this has something to do with permissions, so I also tried the options.permissions=false, but that didn't seem to work.
To summarize, is it the best practice to use apos.getTaskReq to bypass permission constraints? Why is it that that file is bound to permissions, I mean the user is just browsing the site, there is no need for the user to be logged in to see the file.
Any insight would be great.
Best,
Fotis