{"action":"created","issue":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/11237","labels_url":"https://api.github.com/repos/phalcon/cphalcon/issues/11237/labels{/name}","comments_url":"https://api.github.com/repos/phalcon/cphalcon/issues/11237/comments","events_url":"https://api.github.com/repos/phalcon/cphalcon/issues/11237/events","html_url":"https://github.com/phalcon/cphalcon/pull/11237","id":122607637,"number":11237,"title":"Implement #11235, Resourceable and Roleable, Function in allow method","user":{"login":"Jurigag","id":10086991,"avatar_url":"https://avatars.githubusercontent.com/u/10086991?v=3","gravatar_id":"","url":"https://api.github.com/users/Jurigag","html_url":"https://github.com/Jurigag","followers_url":"https://api.github.com/users/Jurigag/followers","following_url":"https://api.github.com/users/Jurigag/following{/other_user}","gists_url":"https://api.github.com/users/Jurigag/gists{/gist_id}","starred_url":"https://api.github.com/users/Jurigag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jurigag/subscriptions","organizations_url":"https://api.github.com/users/Jurigag/orgs","repos_url":"https://api.github.com/users/Jurigag/repos","events_url":"https://api.github.com/users/Jurigag/events{/privacy}","received_events_url":"https://api.github.com/users/Jurigag/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/phalcon/cphalcon/labels/Requires-Discussion","name":"Requires-Discussion","color":"c7def8"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-16T21:34:48Z","updated_at":"2015-12-17T00:15:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/phalcon/cphalcon/pulls/11237","html_url":"https://github.com/phalcon/cphalcon/pull/11237","diff_url":"https://github.com/phalcon/cphalcon/pull/11237.diff","patch_url":"https://github.com/phalcon/cphalcon/pull/11237.patch"},"body":"Add option to add function in allow method in Phalcon\\Acl\\Adapter\\Memory like this:\r\n\r\n```php\r\n$acl->allow('SomeRole','SomeResource','update',function(TestResource $user,TestModel $model){\r\n    return $user->getId() == $model->getUser();\r\n});\r\n```\r\n\r\n Where we can put class implemting Roleable as first argument, and Resourceable as second argument. Then when we do\r\n\r\n```php\r\n$acl->isAllowed($roleable,$resourcable,'update');\r\n```\r\n\r\nIt will call our defined method in allow if there is any."},"comment":{"url":"https://api.github.com/repos/phalcon/cphalcon/issues/comments/165296921","html_url":"https://github.com/phalcon/cphalcon/pull/11237#issuecomment-165296921","issue_url":"https://api.github.com/repos/phalcon/cphalcon/issues/11237","id":165296921,"user":{"login":"Jurigag","id":10086991,"avatar_url":"https://avatars.githubusercontent.com/u/10086991?v=3","gravatar_id":"","url":"https://api.github.com/users/Jurigag","html_url":"https://github.com/Jurigag","followers_url":"https://api.github.com/users/Jurigag/followers","following_url":"https://api.github.com/users/Jurigag/following{/other_user}","gists_url":"https://api.github.com/users/Jurigag/gists{/gist_id}","starred_url":"https://api.github.com/users/Jurigag/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jurigag/subscriptions","organizations_url":"https://api.github.com/users/Jurigag/orgs","repos_url":"https://api.github.com/users/Jurigag/repos","events_url":"https://api.github.com/users/Jurigag/events{/privacy}","received_events_url":"https://api.github.com/users/Jurigag/received_events","type":"User","site_admin":false},"created_at":"2015-12-17T00:15:46Z","updated_at":"2015-12-17T00:15:46Z","body":"Also should i check if func is not null before adding it to _func ? Is fetch not setting value if returned value is null ?\r\n\r\n```\r\nfetch this->_func[accessKey] = func;\r\n```\r\n\r\nSomething like this is fine ?"}}