{"action":"created","issue":{"url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/736","repository_url":"https://api.github.com/repos/userfrosting/UserFrosting","labels_url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/736/labels{/name}","comments_url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/736/comments","events_url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/736/events","html_url":"https://github.com/userfrosting/UserFrosting/issues/736","id":235091318,"node_id":"MDU6SXNzdWUyMzUwOTEzMTg=","number":736,"title":"TWIG function checkAccess fails when not logged in","user":{"login":"alani1","id":3892818,"node_id":"MDQ6VXNlcjM4OTI4MTg=","avatar_url":"https://avatars3.githubusercontent.com/u/3892818?v=4","gravatar_id":"","url":"https://api.github.com/users/alani1","html_url":"https://github.com/alani1","followers_url":"https://api.github.com/users/alani1/followers","following_url":"https://api.github.com/users/alani1/following{/other_user}","gists_url":"https://api.github.com/users/alani1/gists{/gist_id}","starred_url":"https://api.github.com/users/alani1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alani1/subscriptions","organizations_url":"https://api.github.com/users/alani1/orgs","repos_url":"https://api.github.com/users/alani1/repos","events_url":"https://api.github.com/users/alani1/events{/privacy}","received_events_url":"https://api.github.com/users/alani1/received_events","type":"User","site_admin":false},"labels":[{"id":99588709,"node_id":"MDU6TGFiZWw5OTU4ODcwOQ==","url":"https://api.github.com/repos/userfrosting/UserFrosting/labels/access%20control","name":"access control","color":"ff9933","default":false}],"state":"open","locked":false,"assignee":{"login":"lcharette","id":2566513,"node_id":"MDQ6VXNlcjI1NjY1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2566513?v=4","gravatar_id":"","url":"https://api.github.com/users/lcharette","html_url":"https://github.com/lcharette","followers_url":"https://api.github.com/users/lcharette/followers","following_url":"https://api.github.com/users/lcharette/following{/other_user}","gists_url":"https://api.github.com/users/lcharette/gists{/gist_id}","starred_url":"https://api.github.com/users/lcharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcharette/subscriptions","organizations_url":"https://api.github.com/users/lcharette/orgs","repos_url":"https://api.github.com/users/lcharette/repos","events_url":"https://api.github.com/users/lcharette/events{/privacy}","received_events_url":"https://api.github.com/users/lcharette/received_events","type":"User","site_admin":false},"assignees":[{"login":"lcharette","id":2566513,"node_id":"MDQ6VXNlcjI1NjY1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2566513?v=4","gravatar_id":"","url":"https://api.github.com/users/lcharette","html_url":"https://github.com/lcharette","followers_url":"https://api.github.com/users/lcharette/followers","following_url":"https://api.github.com/users/lcharette/following{/other_user}","gists_url":"https://api.github.com/users/lcharette/gists{/gist_id}","starred_url":"https://api.github.com/users/lcharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcharette/subscriptions","organizations_url":"https://api.github.com/users/lcharette/orgs","repos_url":"https://api.github.com/users/lcharette/repos","events_url":"https://api.github.com/users/lcharette/events{/privacy}","received_events_url":"https://api.github.com/users/lcharette/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/userfrosting/UserFrosting/milestones/11","html_url":"https://github.com/userfrosting/UserFrosting/milestone/11","labels_url":"https://api.github.com/repos/userfrosting/UserFrosting/milestones/11/labels","id":2585606,"node_id":"MDk6TWlsZXN0b25lMjU4NTYwNg==","number":11,"title":"4.2.0","description":"https://github.com/userfrosting/UserFrosting/wiki/Roadmap-for-UserFrosting-4.2\r\n","creator":{"login":"alexweissman","id":5004534,"node_id":"MDQ6VXNlcjUwMDQ1MzQ=","avatar_url":"https://avatars2.githubusercontent.com/u/5004534?v=4","gravatar_id":"","url":"https://api.github.com/users/alexweissman","html_url":"https://github.com/alexweissman","followers_url":"https://api.github.com/users/alexweissman/followers","following_url":"https://api.github.com/users/alexweissman/following{/other_user}","gists_url":"https://api.github.com/users/alexweissman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexweissman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexweissman/subscriptions","organizations_url":"https://api.github.com/users/alexweissman/orgs","repos_url":"https://api.github.com/users/alexweissman/repos","events_url":"https://api.github.com/users/alexweissman/events{/privacy}","received_events_url":"https://api.github.com/users/alexweissman/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":18,"state":"open","created_at":"2017-06-15T17:48:34Z","updated_at":"2018-10-28T21:15:17Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2017-06-11T20:59:49Z","updated_at":"2018-11-03T01:51:19Z","closed_at":null,"author_association":"NONE","body":"I check for certain roles in FE using the Twig Function checkAccess (defined in sprinkles/account/src/Twig/AccountExtension.php (line 42). When User is not logged in, the result is below error message.\r\n\r\nSlim Application Error:\\nType: TypeError\\nMessage: Argument 1 passed to UserFrosting\\\\Sprinkle\\\\Account\\\\Authorize\\\\AuthorizationManager::checkAccess() must be an instance of UserFrosting\\\\Sprinkle\\\\Account\\\\Model\\\\User, null given\r\n\r\ncan we add an additional check if currentUser is not null ? With this I could avoid an additional if block calling checkAuthenticated. E.g. in checkAccess simply use:\r\n\r\n    if ( $currentUser ) {\r\n       return $authorizer->checkAccess($currentUser, $slug, $params);\r\n    } else {\r\n       return false;\r\n    }"},"comment":{"url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/comments/435551690","html_url":"https://github.com/userfrosting/UserFrosting/issues/736#issuecomment-435551690","issue_url":"https://api.github.com/repos/userfrosting/UserFrosting/issues/736","id":435551690,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNTU1MTY5MA==","user":{"login":"lcharette","id":2566513,"node_id":"MDQ6VXNlcjI1NjY1MTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2566513?v=4","gravatar_id":"","url":"https://api.github.com/users/lcharette","html_url":"https://github.com/lcharette","followers_url":"https://api.github.com/users/lcharette/followers","following_url":"https://api.github.com/users/lcharette/following{/other_user}","gists_url":"https://api.github.com/users/lcharette/gists{/gist_id}","starred_url":"https://api.github.com/users/lcharette/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lcharette/subscriptions","organizations_url":"https://api.github.com/users/lcharette/orgs","repos_url":"https://api.github.com/users/lcharette/repos","events_url":"https://api.github.com/users/lcharette/events{/privacy}","received_events_url":"https://api.github.com/users/lcharette/received_events","type":"User","site_admin":false},"created_at":"2018-11-03T01:51:19Z","updated_at":"2018-11-03T01:51:19Z","author_association":"MEMBER","body":"RE @alexweissman comment right above, testing is the user is a guest in `checkAccess` doesn't make sense at all. \r\n\r\nSince the user tested in `checkaccess` is the one passed in argument, it doesn't matter if it's a guest or not. Sure, 90% of the time, we test the `currentUser`, which can be a guest, but we also might want to test another user. By doing so, `User A` is testing to see if `User B` has permissions to do whatever. `User B` will always be a \"guest\" in the eyes of `User A`, and the guest status will always be checked against the `User A` in the above code. \r\n\r\nLong story short, as long as `checkaccess` check the user in the argument, we don't need to check if said user is a guest or not. This should be handled in `currentUser`... or `checkaccess` should always use `currentUser` and not accept any `user` arguments. "}}
{"actor":{"display_login":"lcharette"}}