Jake Hare7049642
Posts: 0
Joined: Sun Aug 17, 2014 10:09 pm

'List Service' functionality for uploaded files to DB?

One last question, I promise:

Now that the list works, how do I restrict access so only the user to uploaded the file can see it in their list? I assume the only way to do so would be with the ACL, but right now it is set at {"":{"read":true}. How would I make the default {"":{"read":false}, and would that work?

Thanks

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

'List Service' functionality for uploaded files to DB?

Hi Jake,

Unfortunatly currently there is no way to change ACL via file API.

You can do it with DB console http://devcenter.appery.io/documentat...

Also you can retrieve file list in server code and then filter these items with user _id criteria.

Regards.

Jake Hare7049642
Posts: 0
Joined: Sun Aug 17, 2014 10:09 pm

'List Service' functionality for uploaded files to DB?

I'm currently trying to do it using the DB Console as outlined in the link you provided. The problem is it is still listing every file for every user to read when they are logged in. I don't believe the instructions in the 'Working with the database' section for reading files is accurate. Here are my settings (see screenshot). Please tell me what I need to change in order to have users only see a list in the app of the files they themselves uploaded. The directions at the link you provided seem to cover this functionality but I don't think they are accurate.

Thanks!
Image Image Image Image Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

'List Service' functionality for uploaded files to DB?

Hi Jake,

DB console allow you to set ACL manualy(not from files API).

See details: http://prntscr.com/4iu93n/direct

So if you want to implement it without manual editing you need to choose second way(with server script).

Regards.

Jake Hare7049642
Posts: 0
Joined: Sun Aug 17, 2014 10:09 pm

'List Service' functionality for uploaded files to DB?

Hi Yurii,

Thanks for all your help on this. So I'd like to use your idea of using Server Script to change the default ACL for all files in my files DB from (""(read:true)) to (""(read:false))

What would that server script look like?

Thanks!!!

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

'List Service' functionality for uploaded files to DB?

Hi Jake,

I'm sorry but you probably didn't understand me correctly.

I din't say about "edit file" in context of server script.

So what i suggest you:

pre

1 Instead of Files "list" service you invoke your server code (for example with name "filesList").

2 In this request you have following parameters:
2.1 UserId - to filter files by this criteria.
2.2 Session token - to get whole files list.

3 In "filesList" server code you:
3.1 Get all files list.
3.2 Filter this files list with criteria you need(leave only those elements which have correct userid in ACL).
3.3. Return filtered collection.

/pre

Regards

Return to “Issues”