Page 2 of 2

'List Service' functionality for uploaded files to DB?

Posted: Mon Sep 01, 2014 5:34 am
by Jake Hare7049642

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


'List Service' functionality for uploaded files to DB?

Posted: Mon Sep 01, 2014 11:19 pm
by Yurii Orishchuk

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.


'List Service' functionality for uploaded files to DB?

Posted: Tue Sep 02, 2014 12:28 am
by Jake Hare7049642

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


'List Service' functionality for uploaded files to DB?

Posted: Tue Sep 02, 2014 2:35 am
by Yurii Orishchuk

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.


'List Service' functionality for uploaded files to DB?

Posted: Tue Sep 02, 2014 1:25 pm
by Jake Hare7049642

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!!!


'List Service' functionality for uploaded files to DB?

Posted: Tue Sep 02, 2014 11:03 pm
by Yurii Orishchuk

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