Start a new topic

request.body.userid or getAuthenticatedUserID()?

On BL there are 2 ways to get the username of the user that sent the request, but no way to get its _id.



The username is stored in request.body.username

and is also given by calling modules.backendContext.getAuthenticatedUsername().



"user" though is the only collection that doesn't use "_id" as default key, but "username".

This makes it a bit hard to standardize functions and I often have to write selections statements like "if(obj._id) ... else if (obj.username) ..."



Would it be possible to get the user "_id" rather than the username only?

I proposed request.body.userid or getAuthenticatedUserID() just so have something similar to what already exists, but it could also be something else :wink:



Otherwise, is there already a way to get the user id without querying the "user" collection?



Thank you :)

cool! :) :) :) looking fwd to it.
Davide, I don't have information on how the final implementation will look at this time, but this feature is already being worked on as we speak. You should expect to see this being rolled out sometime by early - mid next week. Thanks,
Login or Signup to post a comment