{"action":"closed","issue":{"url":"https://api.github.com/repos/stalniy/casl/issues/86","repository_url":"https://api.github.com/repos/stalniy/casl","labels_url":"https://api.github.com/repos/stalniy/casl/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/stalniy/casl/issues/86/comments","events_url":"https://api.github.com/repos/stalniy/casl/issues/86/events","html_url":"https://github.com/stalniy/casl/issues/86","id":337304715,"node_id":"MDU6SXNzdWUzMzczMDQ3MTU=","number":86,"title":"Extract attributes from rule conditions","user":{"login":"stalniy","id":1159966,"node_id":"MDQ6VXNlcjExNTk5NjY=","avatar_url":"https://avatars3.githubusercontent.com/u/1159966?v=4","gravatar_id":"","url":"https://api.github.com/users/stalniy","html_url":"https://github.com/stalniy","followers_url":"https://api.github.com/users/stalniy/followers","following_url":"https://api.github.com/users/stalniy/following{/other_user}","gists_url":"https://api.github.com/users/stalniy/gists{/gist_id}","starred_url":"https://api.github.com/users/stalniy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stalniy/subscriptions","organizations_url":"https://api.github.com/users/stalniy/orgs","repos_url":"https://api.github.com/users/stalniy/repos","events_url":"https://api.github.com/users/stalniy/events{/privacy}","received_events_url":"https://api.github.com/users/stalniy/received_events","type":"User","site_admin":false},"labels":[{"id":898011024,"node_id":"MDU6TGFiZWw4OTgwMTEwMjQ=","url":"https://api.github.com/repos/stalniy/casl/labels/casl/ability","name":"casl/ability","color":"88db6f","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-01T16:47:35Z","updated_at":"2018-07-02T08:58:03Z","closed_at":"2018-07-02T08:58:03Z","author_association":"OWNER","body":"```js\r\nconst ability = AbilityBuilder.define(can => {\r\n   can('manage', 'Post', { user: 5 })\r\n   can('read', 'Post', { isDraft: false })\r\n})\r\n\r\nrulesToAttributes(ability, 'read', 'Post') // { user: 5, isDraft: false }\r\n```\r\n\r\nSo, all equality expressions need to be extracted, the rest is omitted. Also need to take into account that `cannot` rule attributes may remove some properties from the resulting object "}}
{"actor":{"display_login":"stalniy"}}