{"action":"created","issue":{"url":"https://api.github.com/repos/Narzerus/angular-permission/issues/397","repository_url":"https://api.github.com/repos/Narzerus/angular-permission","labels_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/397/labels{/name}","comments_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/397/comments","events_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/397/events","html_url":"https://github.com/Narzerus/angular-permission/pull/397","id":216157854,"number":397,"title":"Wait for root permission to settle before evaluating child permissions","user":{"login":"joeljeske","id":5332920,"avatar_url":"https://avatars1.githubusercontent.com/u/5332920?v=3","gravatar_id":"","url":"https://api.github.com/users/joeljeske","html_url":"https://github.com/joeljeske","followers_url":"https://api.github.com/users/joeljeske/followers","following_url":"https://api.github.com/users/joeljeske/following{/other_user}","gists_url":"https://api.github.com/users/joeljeske/gists{/gist_id}","starred_url":"https://api.github.com/users/joeljeske/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeljeske/subscriptions","organizations_url":"https://api.github.com/users/joeljeske/orgs","repos_url":"https://api.github.com/users/joeljeske/repos","events_url":"https://api.github.com/users/joeljeske/events{/privacy}","received_events_url":"https://api.github.com/users/joeljeske/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-22T18:00:55Z","updated_at":"2017-04-06T20:49:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Narzerus/angular-permission/pulls/397","html_url":"https://github.com/Narzerus/angular-permission/pull/397","diff_url":"https://github.com/Narzerus/angular-permission/pull/397.diff","patch_url":"https://github.com/Narzerus/angular-permission/pull/397.patch"},"body":"Rebased and re-targeted PR. Original PR: https://github.com/Narzerus/angular-permission/pull/386\r\n\r\n** Description **\r\n\r\nWhen using Permissions UI Router, all permissions needed to enter a state are evaluated at the same time. This leads to a race condition. Example state setup: \r\n\r\n```\r\n$stateProvider\r\n  .state('list', {\r\n    ...\r\n    data: {\r\n      permissions: {\r\n        only: 'read_permission', // <-- I must be able to 'read' to enter this state\r\n        redirectTo: {\r\n          read_permission: {\r\n            state: 'permission-error', \r\n            params: {reason: 'read'}\r\n          }\r\n        }\r\n      }\r\n    }\r\n  })\r\n  .state('list.update', {\r\n    ...\r\n    data: {\r\n      permissions: {\r\n        only: 'write_permission',// <-- I must be able to 'write' (and implicitly read) to enter this state\r\n        redirectTo: {\r\n          write_permission: {\r\n            state: 'permission-error', \r\n            params: {reason: 'write'}\r\n          }\r\n        }\r\n      }\r\n    }\r\n  })\r\n```\r\n\r\n\r\nIn this example, if I try to `$state.go('list.update')` I will be prevented and will be redirected to 'permissions-error'. However, it is unknown which error reason I will receive, whether 'read' or 'write'. This may be a simple or silly example, but the problem remains: all the permissions are evaluated concurrently and there is no priority given to parent states. \r\n\r\nPresumably, it would make sense that parent states should be given priority to enter their child state tree. This ensures that parent states always have the \"right of way\" when it comes to evaluating permissions. \r\n\r\nNote: this did not affect unit tests as this behavior was previously indeterminate. \r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Narzerus/angular-permission/issues/comments/292314922","html_url":"https://github.com/Narzerus/angular-permission/pull/397#issuecomment-292314922","issue_url":"https://api.github.com/repos/Narzerus/angular-permission/issues/397","id":292314922,"user":{"login":"masterspambot","id":581121,"avatar_url":"https://avatars1.githubusercontent.com/u/581121?v=3","gravatar_id":"","url":"https://api.github.com/users/masterspambot","html_url":"https://github.com/masterspambot","followers_url":"https://api.github.com/users/masterspambot/followers","following_url":"https://api.github.com/users/masterspambot/following{/other_user}","gists_url":"https://api.github.com/users/masterspambot/gists{/gist_id}","starred_url":"https://api.github.com/users/masterspambot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masterspambot/subscriptions","organizations_url":"https://api.github.com/users/masterspambot/orgs","repos_url":"https://api.github.com/users/masterspambot/repos","events_url":"https://api.github.com/users/masterspambot/events{/privacy}","received_events_url":"https://api.github.com/users/masterspambot/received_events","type":"User","site_admin":false},"created_at":"2017-04-06T20:49:43Z","updated_at":"2017-04-06T20:49:43Z","body":"@joeljeske Any progress here? The test are still not passing...\r\n"}}
{"actor":{"display_login":"masterspambot"}}