Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Lists and users and acl....

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

Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

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.

Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

I don't consider this question answered

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Lists and users and acl....

Hello! We're working on your request.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Lists and users and acl....

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

Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

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

Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Lists and users and acl....

Hello Victor,

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

Victor Fagerström
Posts: 0
Joined: Sun Dec 01, 2013 1:03 pm

Lists and users and acl....

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

Return to “Issues”