{"action":"created","issue":{"url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/290","repository_url":"https://api.github.com/repos/mdmsoft/yii2-admin","labels_url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/290/labels{/name}","comments_url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/290/comments","events_url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/290/events","html_url":"https://github.com/mdmsoft/yii2-admin/issues/290","id":169376585,"number":290,"title":"problem with updateOwnPost ","user":{"login":"fullflash","id":19576508,"avatar_url":"https://avatars.githubusercontent.com/u/19576508?v=3","gravatar_id":"","url":"https://api.github.com/users/fullflash","html_url":"https://github.com/fullflash","followers_url":"https://api.github.com/users/fullflash/followers","following_url":"https://api.github.com/users/fullflash/following{/other_user}","gists_url":"https://api.github.com/users/fullflash/gists{/gist_id}","starred_url":"https://api.github.com/users/fullflash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fullflash/subscriptions","organizations_url":"https://api.github.com/users/fullflash/orgs","repos_url":"https://api.github.com/users/fullflash/repos","events_url":"https://api.github.com/users/fullflash/events{/privacy}","received_events_url":"https://api.github.com/users/fullflash/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-04T13:39:26Z","updated_at":"2016-08-04T14:39:31Z","closed_at":"2016-08-04T14:26:42Z","body":"Hi,\r\ni have created AuthorRule under backend\\rules with namescape backend\\rules\r\nwith public $name=\"authorRule\"; inside class and overriding execute as described in official guide.\r\n\r\nin yii2 admin create a rule with name: **authorRule**  and classname: **backend\\rules\\AuthorRule**\r\n\r\nadded this rule to permission **updateOwnNews**\r\nupdateOwnNews is a parent of **updateNews** permission as described in official docs.\r\nupdatePost permission has route _/news/update_\r\n\r\nthere is a role **author** with updateOwnNews permission\r\n\r\nbut user with this author role update post that not created by him.\r\n On debugmode breakpoint in _execute_ method just don't triggered.\r\nRule class just not executed.\r\nwhat is wrong ?\r\n\r\n![adminlte updatenews](https://cloud.githubusercontent.com/assets/19576508/17403769/3becd898-5a6a-11e6-8925-932389ef3b3b.png)\r\n![adminlte authorrule](https://cloud.githubusercontent.com/assets/19576508/17403772/3bfded90-5a6a-11e6-86f0-21cad8668591.png)\r\n![adminlte author](https://cloud.githubusercontent.com/assets/19576508/17403771/3bf9fadc-5a6a-11e6-8ef2-c74f1559e56a.png)\r\n![adminlte updateownnews](https://cloud.githubusercontent.com/assets/19576508/17403770/3bf13438-5a6a-11e6-947c-532f7d949c0c.png)\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/comments/237573455","html_url":"https://github.com/mdmsoft/yii2-admin/issues/290#issuecomment-237573455","issue_url":"https://api.github.com/repos/mdmsoft/yii2-admin/issues/290","id":237573455,"user":{"login":"fullflash","id":19576508,"avatar_url":"https://avatars.githubusercontent.com/u/19576508?v=3","gravatar_id":"","url":"https://api.github.com/users/fullflash","html_url":"https://github.com/fullflash","followers_url":"https://api.github.com/users/fullflash/followers","following_url":"https://api.github.com/users/fullflash/following{/other_user}","gists_url":"https://api.github.com/users/fullflash/gists{/gist_id}","starred_url":"https://api.github.com/users/fullflash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fullflash/subscriptions","organizations_url":"https://api.github.com/users/fullflash/orgs","repos_url":"https://api.github.com/users/fullflash/repos","events_url":"https://api.github.com/users/fullflash/events{/privacy}","received_events_url":"https://api.github.com/users/fullflash/received_events","type":"User","site_admin":false},"created_at":"2016-08-04T14:39:31Z","updated_at":"2016-08-04T14:39:31Z","body":"changed rule now it works model id passed by **$params** function argument is enough )\r\n```\r\npublic function execute($user, $item, $params)\r\n    {\r\n        $news_id = $params[\"id\"];\r\n        $data = News::find()->select(\"created_by\")->where([\"id\"=>$news_id])->limit(1)->asArray()->one();\r\n        return isset($data) ?  $user==$data[\"created_by\"] : false;\r\n    }\r\n```"}}
{"actor":{"display_login":"fullflash"}}