Page 1 of 2

Lists and users and acl....

Posted: Tue Jan 21, 2014 2:21 am
by Victor Fagerström

I've managed to make it possible for a user to post something that all users can read/write. { "*" : { "read" : true, "write" : true } }. But how can I make a post read/writable to user and only readable to everybody else.

I've found this, but I don't know how to replace the examples userId with the actually logged in user:

{ "5278cafce4b01085e4b7945a": { "read": true, "write": true },
"*" : { "read" : true } }

I'm thinking something like this (added javascript in acl of service added to page), but with this code I don't know how to make it readable to all users instead:

var acl = {};
acl[value]= { "read": true, "write": true };
return acl;

I already have a localStorage var of current users id, if that's for any help.

Also; I want to, in another page, list posts from this collection, but only those who were posted by the user. Solution?

Thanks. V


Lists and users and acl....

Posted: Tue Jan 21, 2014 2:42 am
by maxkatz

This tutorial shows how to do it: http://docs.appery.io/tutorials/build...


Lists and users and acl....

Posted: Tue Jan 21, 2014 2:53 am
by Victor Fagerström

Almost... It doesn't show how I make an item read:true for all users.

I get it that that code gives the current user read:true write:true. Please, just tell me how to also make it read:true for all users while read:true write:true for current user.


Lists and users and acl....

Posted: Tue Jan 21, 2014 11:46 am
by Victor Fagerström

I don't consider this question answered


Lists and users and acl....

Posted: Tue Jan 21, 2014 11:58 am
by Maryna Brodina

Hello! We're working on your request.


Lists and users and acl....

Posted: Tue Jan 21, 2014 1:39 pm
by Maryna Brodina

You need to do mapping from your variable in localStorage to acl field in save request and add the following JS in mapping: prevar acl = {};
acl[value] = { "read": true, "write": true };
acl[ "*" ] = { "read" : true };

return acl;/pre


Lists and users and acl....

Posted: Tue Jan 21, 2014 1:45 pm
by Victor Fagerström

Thank you Maryna, that's the answer I was looking for!


Lists and users and acl....

Posted: Wed Jan 22, 2014 12:18 am
by Victor Fagerström

As to my second question: Maryna's code worked and now I want to list only the logged in users posts, in other words only posts of this kind that was created by the currently logged in user. Like on a page "Your posts".

I'm thinking maybe a query service passing userId localStorage variable into "where" param and coding something like:

var where = {};
where = {"_id" : [value]};
return where;

and then mapping response to the list. But It doens't do it... any thoughts?

Thanks, V


Lists and users and acl....

Posted: Wed Jan 22, 2014 4:05 am
by Alena Prykhodko

Hello Victor,

Please check if this post can help https://getsatisfaction.com/apperyio/...


Lists and users and acl....

Posted: Wed Jan 22, 2014 6:38 am
by Victor Fagerström

Hi and thank you, but I still cannot figure out the right way..