parse.com - Parse Android: update ParseObject containing an array of ParseUsers throws UserCannotBeAlteredWithoutSessionError -
im working on android app.
i have custom class has relations 2 parseusers , other fields. suggested docs, used array (with key "usersarray") store pointers 2 parseusers, because want able use "include" include users when query custom class. can create new object , save successfully.
//my custom parse class: customobject customobject = new customobject(); arraylist<parseuser> users = new arraylist<parseuser>(); users.add(parseuser.getcurrentuser()); users.add(anotheruser); customobject.put("usersarray", users); //i store other variable update later customobject.put("othervariable",false); customobject.saveinbackground();
also, can query with:
parsequery<customobject> query = customobject.getquery(); query.whereequalto("usersarray", parseuser.getcurrentuser()); query.whereequalto("usersarray", anotheruser); query.include("usersarray"); query.findinbackground( .... );
my problem when trying update 1 of customobject. after retrieving customobject previous query, if try change value of "othervariable" true , save object, getting usercannotbealteredwithoutsessionerror
or java.lang.illegalargumentexception: cannot save parseuser not authenticated
exceptions.
customobject customobject = customobject.get(0); //from query customobject.put("othervariable", true); customobject.saveinbackground(); // exception
i can see somehow related fact im trying update object contains pointer parseuser. im not modifying user, want update 1 of fields of customobject.
¿there way solve problem?
maybe late parse users have acl of public read , private write should users.isauthenticated()
check if true or false.
if false login user , retry. note: cannot edit info on 2 users @ same time without logging out , relogging in.
another thing can use roles , define admin role using acl can write on users.
Comments
Post a Comment