{"comment":{"url":"https://api.github.com/repos/jonespm/sakai/comments/9786327","html_url":"https://github.com/jonespm/sakai/commit/60cca128a5eb2b5f1a01385e213f34c6c6ed0b36#commitcomment-9786327","id":9786327,"user":{"login":"clhedrick","id":1907208,"avatar_url":"https://avatars.githubusercontent.com/u/1907208?v=3","gravatar_id":"","url":"https://api.github.com/users/clhedrick","html_url":"https://github.com/clhedrick","followers_url":"https://api.github.com/users/clhedrick/followers","following_url":"https://api.github.com/users/clhedrick/following{/other_user}","gists_url":"https://api.github.com/users/clhedrick/gists{/gist_id}","starred_url":"https://api.github.com/users/clhedrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clhedrick/subscriptions","organizations_url":"https://api.github.com/users/clhedrick/orgs","repos_url":"https://api.github.com/users/clhedrick/repos","events_url":"https://api.github.com/users/clhedrick/events{/privacy}","received_events_url":"https://api.github.com/users/clhedrick/received_events","type":"User","site_admin":false},"position":null,"line":null,"path":"","commit_id":"60cca128a5eb2b5f1a01385e213f34c6c6ed0b36","created_at":"2015-02-17T19:44:30Z","updated_at":"2015-02-17T19:44:30Z","body":"Looks ok except for canRead. isItemVisible doesn't check everything relevant. You want to use\r\n\r\nlessonsAccess.isItemAccessible(item.getId(), siteId, currentUserId, simplePageBean)\r\n\r\nBecause of the complexity of figuring out whether you can access something, I created the LessonsAccess class with the necessary methods. Some existing code doesn't use it, but it should be used for everything new.\r\n\r\nFor creating the bean, I'd rather not have yet another method with all that junk in it Instead use \r\n                simplePageBean = lessonsAccess.makeSimplePageBean(null, siteId, page);\r\n\r\nNote that isItemAccessible assumes that the caller has lessonbuilder.read in the realm. If that's not the case, you also want to do\r\n                if(!securityService.unlock(userId, SimplePage.PERMISSION_LESSONBUILDER_READ, siteService.siteReference(siteId))) {\r\n"}}