java - Using the User API with Google Cloud Endpoint -


i created google cloud endpoint backend module android app , able write, read , delete entites.but have 1 problem, want users of app uniquely identified , store individual entities independent of other.for example, when user a logs in, , saves entity, should independent of user b saves. each user being able perform crud operations on independent data in datastore without affecting other's. know can possible of user class google's user's api have clue on how implement it.

right now, how making insert request:

/**  * inserts new {@code todo}.  */ @apimethod(         name = "insert",         path = "todo",         httpmethod = apimethod.httpmethod.post) public todo insert(todo todo) {      ofy().save().entity(todo).now();     logger.info("created todo id: " + todo.getempid());      return ofy().load().entity(todo).now(); } 

when stores todo, should available them.my app authenticates users using google+ login

in order user user api add parameter of type com.google.appengine.api.users.user , , gae inject corresponding user fetched using users api (or null if not logged in ) can read more info here.

it seems want implement multitenancy app using different namespaces different users, check this documentation explains how set namespace each user , therefore prevent users accesing each other's data.


Comments