{"action":"created","issue":{"url":"https://api.github.com/repos/stalniy/casl/issues/43","repository_url":"https://api.github.com/repos/stalniy/casl","labels_url":"https://api.github.com/repos/stalniy/casl/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/stalniy/casl/issues/43/comments","events_url":"https://api.github.com/repos/stalniy/casl/issues/43/events","html_url":"https://github.com/stalniy/casl/issues/43","id":304815059,"node_id":"MDU6SXNzdWUzMDQ4MTUwNTk=","number":43,"title":"Ability.merge","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},{"id":865879420,"node_id":"MDU6TGFiZWw4NjU4Nzk0MjA=","url":"https://api.github.com/repos/stalniy/casl/labels/requires%20validation","name":"requires validation","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-03-13T15:31:36Z","updated_at":"2018-07-02T09:37:27Z","closed_at":"2018-05-29T08:37:15Z","author_association":"OWNER","body":"Allows to merge 2 and more `Ability` instances into. Only `Ability` instances with the same options can be merged together, otherwise exception should be thrown.\r\n\r\nThis feature will allow to merge rules of few abilities, basically this is a helper method for doing the next thing:\r\n\r\n```js\r\nability.update(ability.rules.concat(anotherAbility.rules))\r\n```\r\n\r\nThis may be useful if you want to define some rules dynamically in the database and some statically in the code\r\n\r\n**Design**:\r\n\r\nMerged abilities are added at the end\r\n\r\n```js\r\nconst hardwareAbility = AbilityBuilder.define(can => {\r\n   ...\r\n})\r\n\r\nconst userAbility = AbilityBuilder.define(can => {\r\n  ...\r\n})\r\n\r\nconst ability = userAbility.merge(hardwareAbility)\r\n```\r\n\r\nIn this case, `hardwareAbility` may enforce/overwrite any `userAbility`. `ability` is modified and  `hardwareAbility` is not changed, `update` and `updated` events are emitted on `Ability` instance.\r\n\r\nIn case `userAbility` and `hardwareAbility` has different options for subject detection (i.e., `subjectName`) `Ability.merge` should throw an error telling that merged abilities are not compatible"},"comment":{"url":"https://api.github.com/repos/stalniy/casl/issues/comments/401735508","html_url":"https://github.com/stalniy/casl/issues/43#issuecomment-401735508","issue_url":"https://api.github.com/repos/stalniy/casl/issues/43","id":401735508,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTczNTUwOA==","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},"created_at":"2018-07-02T09:37:27Z","updated_at":"2018-07-02T09:37:27Z","author_association":"OWNER","body":":tada: This issue has been resolved in version 2.4.0 :tada:\n\nThe release is available on:\n- [npm package (@latest dist-tag)](https://www.npmjs.com/package/@casl/ability)\n- [GitHub release](https://github.com/stalniy/casl/releases/tag/%40casl/ability%402.4.0)\n\nYour **[semantic-release](https://github.com/semantic-release/semantic-release)** bot :package::rocket:"}}
{"actor":{"display_login":"stalniy"}}