{"action":"created","issue":{"url":"https://api.github.com/repos/HTBox/allReady/issues/105","labels_url":"https://api.github.com/repos/HTBox/allReady/issues/105/labels{/name}","comments_url":"https://api.github.com/repos/HTBox/allReady/issues/105/comments","events_url":"https://api.github.com/repos/HTBox/allReady/issues/105/events","html_url":"https://github.com/HTBox/allReady/pull/105","id":113198759,"number":105,"title":"Simplify authorization model","user":{"login":"dpaquette","id":2531875,"avatar_url":"https://avatars.githubusercontent.com/u/2531875?v=3","gravatar_id":"","url":"https://api.github.com/users/dpaquette","html_url":"https://github.com/dpaquette","followers_url":"https://api.github.com/users/dpaquette/followers","following_url":"https://api.github.com/users/dpaquette/following{/other_user}","gists_url":"https://api.github.com/users/dpaquette/gists{/gist_id}","starred_url":"https://api.github.com/users/dpaquette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpaquette/subscriptions","organizations_url":"https://api.github.com/users/dpaquette/orgs","repos_url":"https://api.github.com/users/dpaquette/repos","events_url":"https://api.github.com/users/dpaquette/events{/privacy}","received_events_url":"https://api.github.com/users/dpaquette/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-10-25T01:28:28Z","updated_at":"2015-10-27T02:38:35Z","closed_at":"2015-10-26T12:41:14Z","pull_request":{"url":"https://api.github.com/repos/HTBox/allReady/pulls/105","html_url":"https://github.com/HTBox/allReady/pull/105","diff_url":"https://github.com/HTBox/allReady/pull/105.diff","patch_url":"https://github.com/HTBox/allReady/pull/105.patch"},"body":"Would like some feedback on this approach so far. This is just a first pass and I plan to do some more work on this.\r\n\r\nGoal was to simplify the way we check authorization in terms of tenant admin / site admin users. Previously we were making a lot of unnecessary calls to the user manager. New approach is claims based and should result in much fewer calls to the database.\r\n\r\n1) Removed the ApplicationUser -> Tenant relationship in the model. Instead of this, use the the .GetTenantId() extension method to get the current users tenant id.\r\n2) Removed a lot of unnecessary checks to get the current user from the UserManager. Removed dependency on UserManager from a couple of controllers.\r\n\r\nRelated to #104 \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/HTBox/allReady/issues/comments/151350272","html_url":"https://github.com/HTBox/allReady/pull/105#issuecomment-151350272","issue_url":"https://api.github.com/repos/HTBox/allReady/issues/105","id":151350272,"user":{"login":"dpaquette","id":2531875,"avatar_url":"https://avatars.githubusercontent.com/u/2531875?v=3","gravatar_id":"","url":"https://api.github.com/users/dpaquette","html_url":"https://github.com/dpaquette","followers_url":"https://api.github.com/users/dpaquette/followers","following_url":"https://api.github.com/users/dpaquette/following{/other_user}","gists_url":"https://api.github.com/users/dpaquette/gists{/gist_id}","starred_url":"https://api.github.com/users/dpaquette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpaquette/subscriptions","organizations_url":"https://api.github.com/users/dpaquette/orgs","repos_url":"https://api.github.com/users/dpaquette/repos","events_url":"https://api.github.com/users/dpaquette/events{/privacy}","received_events_url":"https://api.github.com/users/dpaquette/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T02:38:35Z","updated_at":"2015-10-27T02:38:35Z","body":"Actually I see this can be simplified even further as the Activity itself has a tenant ID.  I am guessing we should be checking against that instead."}}