apostrophe-headless icon indicating copy to clipboard operation
apostrophe-headless copied to clipboard

Get the currently logged in user

Open brecht-vermeersch opened this issue 4 years ago • 5 comments

How can I get the currently logged in user (piece)?

brecht-vermeersch avatar Nov 24 '20 13:11 brecht-vermeersch

Are you looking for all users currently logged in? There could be many. Regardless, I don't think there's a REST API for that as it's not a property on the user document.

abea avatar Nov 24 '20 15:11 abea

I probably worded my question poorly. When i am using the api as a logged in user, i would like to get all information about that user (the apostrophe-user piece). Thanks in advance!

brecht-vermeersch avatar Nov 24 '20 15:11 brecht-vermeersch

In a view on the website i can get that information from data.user

brecht-vermeersch avatar Nov 24 '20 15:11 brecht-vermeersch

Hmm. For security reasons we don't currently give users any default read access to the user piece type at all. I can see how an option to grant some access to some safe properties of "yourself" would make sense and the door could also get propped open to profile editing and so on, but we haven't done that so far.

On Tue, Nov 24, 2020 at 10:21 AM Brecht Vermeersch [email protected] wrote:

In a view on the website i can get that information from data.user

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-headless/issues/61#issuecomment-733043053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27PKPICNHE4UQX2XSLDSRPFN5ANCNFSM4UA4BKOQ .

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

boutell avatar Nov 24 '20 16:11 boutell

(Of course if the user is an admin they can get everything they want about users, but this is probably not your use case.)

On Tue, Nov 24, 2020 at 11:00 AM Tom Boutell [email protected] wrote:

Hmm. For security reasons we don't currently give users any default read access to the user piece type at all. I can see how an option to grant some access to some safe properties of "yourself" would make sense and the door could also get propped open to profile editing and so on, but we haven't done that so far.

On Tue, Nov 24, 2020 at 10:21 AM Brecht Vermeersch < [email protected]> wrote:

In a view on the website i can get that information from data.user

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/apostrophecms/apostrophe-headless/issues/61#issuecomment-733043053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAH27PKPICNHE4UQX2XSLDSRPFN5ANCNFSM4UA4BKOQ .

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

--

THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER APOSTROPHECMS | apostrophecms.com | he/him/his

boutell avatar Nov 24 '20 16:11 boutell