{"action":"created","issue":{"url":"https://api.github.com/repos/elixircnx/openmaize/issues/39","repository_url":"https://api.github.com/repos/elixircnx/openmaize","labels_url":"https://api.github.com/repos/elixircnx/openmaize/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/elixircnx/openmaize/issues/39/comments","events_url":"https://api.github.com/repos/elixircnx/openmaize/issues/39/events","html_url":"https://github.com/elixircnx/openmaize/issues/39","id":157886463,"number":39,"title":"Passing the whole User struct after authorization","user":{"login":"jaimeiniesta","id":2629,"avatar_url":"https://avatars.githubusercontent.com/u/2629?v=3","gravatar_id":"","url":"https://api.github.com/users/jaimeiniesta","html_url":"https://github.com/jaimeiniesta","followers_url":"https://api.github.com/users/jaimeiniesta/followers","following_url":"https://api.github.com/users/jaimeiniesta/following{/other_user}","gists_url":"https://api.github.com/users/jaimeiniesta/gists{/gist_id}","starred_url":"https://api.github.com/users/jaimeiniesta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaimeiniesta/subscriptions","organizations_url":"https://api.github.com/users/jaimeiniesta/orgs","repos_url":"https://api.github.com/users/jaimeiniesta/repos","events_url":"https://api.github.com/users/jaimeiniesta/events{/privacy}","received_events_url":"https://api.github.com/users/jaimeiniesta/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-01T11:43:14Z","updated_at":"2016-06-02T01:22:50Z","closed_at":null,"body":"After an action has been authorized with:\r\n\r\n```elixir\r\ndef action(conn, _), do: authorize_action conn, [\"user\"], __MODULE__\r\n```\r\n\r\nWe get the user as a third param in the actions:\r\n\r\n```elixir\r\ndef index(conn, params, user) do\r\n```\r\n\r\nHowever, we only get some of its data:\r\n\r\n```elixir \r\nIO.inspect user\r\n# %{email: \"jaimeiniesta@gmail.com\", exp: 1464787171584, id: 1, nbf: 1464779971584, role: \"user\"}\r\n```\r\n\r\nSo we then need to get the whole user from the DB in order to be able to fetch all its data, associations, etc.\r\n\r\n```elixir\r\n    current_user = Repo.get(User, user.id)\r\n```\r\n\r\nIs that the supposed way to do this? Could Openmaize instead pass the whole User instead? Or maybe a `%User{}` struct with this data, like, including the `__struct__: User` key?\r\n"},"comment":{"url":"https://api.github.com/repos/elixircnx/openmaize/issues/comments/223171580","html_url":"https://github.com/elixircnx/openmaize/issues/39#issuecomment-223171580","issue_url":"https://api.github.com/repos/elixircnx/openmaize/issues/39","id":223171580,"user":{"login":"riverrun","id":434903,"avatar_url":"https://avatars.githubusercontent.com/u/434903?v=3","gravatar_id":"","url":"https://api.github.com/users/riverrun","html_url":"https://github.com/riverrun","followers_url":"https://api.github.com/users/riverrun/followers","following_url":"https://api.github.com/users/riverrun/following{/other_user}","gists_url":"https://api.github.com/users/riverrun/gists{/gist_id}","starred_url":"https://api.github.com/users/riverrun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riverrun/subscriptions","organizations_url":"https://api.github.com/users/riverrun/orgs","repos_url":"https://api.github.com/users/riverrun/repos","events_url":"https://api.github.com/users/riverrun/events{/privacy}","received_events_url":"https://api.github.com/users/riverrun/received_events","type":"User","site_admin":false},"created_at":"2016-06-02T01:22:50Z","updated_at":"2016-06-02T01:22:50Z","body":"The `user` information depends on the information in the JSON Web Token, which is fairly basic. I want to look into making this more customizable. I'll open a separate issue about customizing this info within the next few days, and I'll provide a link on this thread."}}
{"actor":{"display_login":"riverrun"}}