-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current Member data + related data example #49
Comments
So each log has a has_one to a Member, so a MemberID attribute? So when you login you get the current member ID (here 9) and attributes. So a GET request like You might also be able to get it via |
Sure that could work. But I want an authenticated member to only be able to access their own logs... I assume that if I opened that up as above they could edit the url and access any peoples logs... |
That would be done through your normal If you set With the token auth, the Member that sends the api request gets logged in, so canView can act on it accordingly. Does that make sense? |
Hi, sure, seems to, I'll have a go. Cheers! |
@jonshutt I'm having the exact same use-case in my current app. So maybe my extension can be useful to you: https://gist.github.com/bummzack/2a6c5a3109a4ada75b1c |
thanks - didn't progress this for a long while, but i'll check out your extension. cheers |
I'm trying to do similar and can't get this to work. Seems like canView, etc - relate to the class of object not the specific object itself or am I missing something? For example if I call $this->ID inside the canView function I get null. |
@tscole the Sometimes very early when handling the API request where the ID isn't known yet, in those case the For example, a Hope that makes sense :) |
Ah, that makes sense. Thanks for responding! I will amend my code and see how I get on. |
I'm wondering if there are examples of retrieving data that relates to the currently authenticated member (via log in then using token). For my app I want to get list of all the 'logs' link to a member via a has_many relationship.
The text was updated successfully, but these errors were encountered: