database - Android setReadAccess for Parse ADMIN error -
i use parse database. have access simple users , admin user. each user see his/her own data admin user see of users' data.
i create parseuser, , if current user equal it, should known admin user. following error:
java.lang.illegalargumentexception: cannot setreadaccess user null id
i think mistakes if function (never become true) , this: acl.setreadaccess(admin,true);
could suggest something?
parseuser admin = new parseuser(); admin.setusername("admin3"); admin.setpassword("a"); // create post. anywallpost post = new anywallpost(); // set location current user's location post.setlocation(geopoint); post.settext(text); post.setuser(parseuser.getcurrentuser()); parseacl acl = new parseacl(); // give read accesses if (parseuser.getcurrentuser() == admin) { acl.setreadaccess(parseuser.getcurrentuser(), true); } else { acl.setreadaccess(parseuser.getcurrentuser(),true); acl.setreadaccess(admin,true); } post.setacl(acl); // save post post.saveinbackground(new savecallback() { @override public void done(parseexception e) { dialog.dismiss(); finish(); } });
Comments
Post a Comment