{"action":"created","comment":{"url":"https://api.github.com/repos/spira/spira/pulls/comments/41721220","id":41721220,"diff_hunk":"@@ -0,0 +1,53 @@\n+<?php\n+\n+/*\n+ * This file is part of the Spira framework.\n+ *\n+ * @link https://github.com/spira/spira\n+ *\n+ * For the full copyright and license information, please view the LICENSE file that was distributed with this source code.\n+ */\n+\n+namespace Spira\\Rbac\\Storage\\File;\n+\n+abstract class AbstractStorage\n+{\n+    protected $filePath;\n+\n+    public function __construct($filePath)\n+    {\n+        $this->filePath = $filePath;\n+        $this->load();\n+    }\n+\n+    /**\n+     * Loads authorization data from persistent storage.\n+     */\n+    abstract protected function load();\n+\n+    /**\n+     * Loads the authorization data from a PHP script file.\n+     *\n+     * @param string $file the file path.\n+     * @return array the authorization data\n+     */\n+    protected function loadFromFile($file)\n+    {\n+        if (is_file($file)) {\n+            return require $file;\n+        } else {\n+            return [];\n+        }\n+    }\n+\n+    /**\n+     * Saves the authorization data to a PHP script file.\n+     *\n+     * @param array $data the authorization data\n+     * @param string $file the file path.\n+     */\n+    protected function saveToFile($data, $file)\n+    {\n+        file_put_contents($file, \"<?php\\nreturn \".var_export($data, true).\";\\n\", LOCK_EX);","path":"api/src/Rbac/Storage/File/AbstractStorage.php","position":51,"original_position":51,"commit_id":"bf521b06a237dbf779c65913d4d191f98e80150b","original_commit_id":"bf521b06a237dbf779c65913d4d191f98e80150b","user":{"login":"Redjik","id":1131017,"avatar_url":"https://avatars.githubusercontent.com/u/1131017?v=3","gravatar_id":"","url":"https://api.github.com/users/Redjik","html_url":"https://github.com/Redjik","followers_url":"https://api.github.com/users/Redjik/followers","following_url":"https://api.github.com/users/Redjik/following{/other_user}","gists_url":"https://api.github.com/users/Redjik/gists{/gist_id}","starred_url":"https://api.github.com/users/Redjik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Redjik/subscriptions","organizations_url":"https://api.github.com/users/Redjik/orgs","repos_url":"https://api.github.com/users/Redjik/repos","events_url":"https://api.github.com/users/Redjik/events{/privacy}","received_events_url":"https://api.github.com/users/Redjik/received_events","type":"User","site_admin":false},"body":"yes and no =)\r\nwe can use this, I designed it as a basic Rbac library for laravel/lumen as a whole, so permissions can be saved via api calls, in out case I suggest we should just modify permissions file.","created_at":"2015-10-12T03:40:07Z","updated_at":"2015-10-12T03:40:07Z","html_url":"https://github.com/spira/spira/pull/273#discussion_r41721220","pull_request_url":"https://api.github.com/repos/spira/spira/pulls/273","_links":{"self":{"href":"https://api.github.com/repos/spira/spira/pulls/comments/41721220"},"html":{"href":"https://github.com/spira/spira/pull/273#discussion_r41721220"},"pull_request":{"href":"https://api.github.com/repos/spira/spira/pulls/273"}}},"pull_request":{"url":"https://api.github.com/repos/spira/spira/pulls/273","id":46546644,"html_url":"https://github.com/spira/spira/pull/273","diff_url":"https://github.com/spira/spira/pull/273.diff","patch_url":"https://github.com/spira/spira/pull/273.patch","issue_url":"https://api.github.com/repos/spira/spira/issues/273","number":273,"state":"open","locked":false,"title":"Feature/permissions","user":{"login":"Redjik","id":1131017,"avatar_url":"https://avatars.githubusercontent.com/u/1131017?v=3","gravatar_id":"","url":"https://api.github.com/users/Redjik","html_url":"https://github.com/Redjik","followers_url":"https://api.github.com/users/Redjik/followers","following_url":"https://api.github.com/users/Redjik/following{/other_user}","gists_url":"https://api.github.com/users/Redjik/gists{/gist_id}","starred_url":"https://api.github.com/users/Redjik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Redjik/subscriptions","organizations_url":"https://api.github.com/users/Redjik/orgs","repos_url":"https://api.github.com/users/Redjik/repos","events_url":"https://api.github.com/users/Redjik/events{/privacy}","received_events_url":"https://api.github.com/users/Redjik/received_events","type":"User","site_admin":false},"body":"rbac permissions implementation\r\ninspired by yii2 rbac","created_at":"2015-10-01T16:34:17Z","updated_at":"2015-10-12T03:40:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"73e0e9b4c0fd9f369b0b70b510acf630111a048f","assignee":{"login":"xiphiaz","id":721513,"avatar_url":"https://avatars.githubusercontent.com/u/721513?v=3","gravatar_id":"","url":"https://api.github.com/users/xiphiaz","html_url":"https://github.com/xiphiaz","followers_url":"https://api.github.com/users/xiphiaz/followers","following_url":"https://api.github.com/users/xiphiaz/following{/other_user}","gists_url":"https://api.github.com/users/xiphiaz/gists{/gist_id}","starred_url":"https://api.github.com/users/xiphiaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiphiaz/subscriptions","organizations_url":"https://api.github.com/users/xiphiaz/orgs","repos_url":"https://api.github.com/users/xiphiaz/repos","events_url":"https://api.github.com/users/xiphiaz/events{/privacy}","received_events_url":"https://api.github.com/users/xiphiaz/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/spira/spira/pulls/273/commits","review_comments_url":"https://api.github.com/repos/spira/spira/pulls/273/comments","review_comment_url":"https://api.github.com/repos/spira/spira/pulls/comments{/number}","comments_url":"https://api.github.com/repos/spira/spira/issues/273/comments","statuses_url":"https://api.github.com/repos/spira/spira/statuses/bf521b06a237dbf779c65913d4d191f98e80150b","head":{"label":"spira:feature/permissions","ref":"feature/permissions","sha":"bf521b06a237dbf779c65913d4d191f98e80150b","user":{"login":"spira","id":12660367,"avatar_url":"https://avatars.githubusercontent.com/u/12660367?v=3","gravatar_id":"","url":"https://api.github.com/users/spira","html_url":"https://github.com/spira","followers_url":"https://api.github.com/users/spira/followers","following_url":"https://api.github.com/users/spira/following{/other_user}","gists_url":"https://api.github.com/users/spira/gists{/gist_id}","starred_url":"https://api.github.com/users/spira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spira/subscriptions","organizations_url":"https://api.github.com/users/spira/orgs","repos_url":"https://api.github.com/users/spira/repos","events_url":"https://api.github.com/users/spira/events{/privacy}","received_events_url":"https://api.github.com/users/spira/received_events","type":"Organization","site_admin":false},"repo":{"id":35469223,"name":"spira","full_name":"spira/spira","owner":{"login":"spira","id":12660367,"avatar_url":"https://avatars.githubusercontent.com/u/12660367?v=3","gravatar_id":"","url":"https://api.github.com/users/spira","html_url":"https://github.com/spira","followers_url":"https://api.github.com/users/spira/followers","following_url":"https://api.github.com/users/spira/following{/other_user}","gists_url":"https://api.github.com/users/spira/gists{/gist_id}","starred_url":"https://api.github.com/users/spira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spira/subscriptions","organizations_url":"https://api.github.com/users/spira/orgs","repos_url":"https://api.github.com/users/spira/repos","events_url":"https://api.github.com/users/spira/events{/privacy}","received_events_url":"https://api.github.com/users/spira/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spira/spira","description":"Lumen + AngularJS with Docker project seed","fork":false,"url":"https://api.github.com/repos/spira/spira","forks_url":"https://api.github.com/repos/spira/spira/forks","keys_url":"https://api.github.com/repos/spira/spira/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spira/spira/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spira/spira/teams","hooks_url":"https://api.github.com/repos/spira/spira/hooks","issue_events_url":"https://api.github.com/repos/spira/spira/issues/events{/number}","events_url":"https://api.github.com/repos/spira/spira/events","assignees_url":"https://api.github.com/repos/spira/spira/assignees{/user}","branches_url":"https://api.github.com/repos/spira/spira/branches{/branch}","tags_url":"https://api.github.com/repos/spira/spira/tags","blobs_url":"https://api.github.com/repos/spira/spira/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spira/spira/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spira/spira/git/refs{/sha}","trees_url":"https://api.github.com/repos/spira/spira/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spira/spira/statuses/{sha}","languages_url":"https://api.github.com/repos/spira/spira/languages","stargazers_url":"https://api.github.com/repos/spira/spira/stargazers","contributors_url":"https://api.github.com/repos/spira/spira/contributors","subscribers_url":"https://api.github.com/repos/spira/spira/subscribers","subscription_url":"https://api.github.com/repos/spira/spira/subscription","commits_url":"https://api.github.com/repos/spira/spira/commits{/sha}","git_commits_url":"https://api.github.com/repos/spira/spira/git/commits{/sha}","comments_url":"https://api.github.com/repos/spira/spira/comments{/number}","issue_comment_url":"https://api.github.com/repos/spira/spira/issues/comments{/number}","contents_url":"https://api.github.com/repos/spira/spira/contents/{+path}","compare_url":"https://api.github.com/repos/spira/spira/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spira/spira/merges","archive_url":"https://api.github.com/repos/spira/spira/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spira/spira/downloads","issues_url":"https://api.github.com/repos/spira/spira/issues{/number}","pulls_url":"https://api.github.com/repos/spira/spira/pulls{/number}","milestones_url":"https://api.github.com/repos/spira/spira/milestones{/number}","notifications_url":"https://api.github.com/repos/spira/spira/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spira/spira/labels{/name}","releases_url":"https://api.github.com/repos/spira/spira/releases{/id}","created_at":"2015-05-12T05:44:10Z","updated_at":"2015-09-26T11:00:25Z","pushed_at":"2015-10-12T02:56:36Z","git_url":"git://github.com/spira/spira.git","ssh_url":"git@github.com:spira/spira.git","clone_url":"https://github.com/spira/spira.git","svn_url":"https://github.com/spira/spira","homepage":"http://spira.github.io","size":5959,"stargazers_count":12,"watchers_count":12,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":8,"forks":4,"open_issues":8,"watchers":12,"default_branch":"master"}},"base":{"label":"spira:master","ref":"master","sha":"2bde2235f6f9ba4884f8b90233e0f265e24aee84","user":{"login":"spira","id":12660367,"avatar_url":"https://avatars.githubusercontent.com/u/12660367?v=3","gravatar_id":"","url":"https://api.github.com/users/spira","html_url":"https://github.com/spira","followers_url":"https://api.github.com/users/spira/followers","following_url":"https://api.github.com/users/spira/following{/other_user}","gists_url":"https://api.github.com/users/spira/gists{/gist_id}","starred_url":"https://api.github.com/users/spira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spira/subscriptions","organizations_url":"https://api.github.com/users/spira/orgs","repos_url":"https://api.github.com/users/spira/repos","events_url":"https://api.github.com/users/spira/events{/privacy}","received_events_url":"https://api.github.com/users/spira/received_events","type":"Organization","site_admin":false},"repo":{"id":35469223,"name":"spira","full_name":"spira/spira","owner":{"login":"spira","id":12660367,"avatar_url":"https://avatars.githubusercontent.com/u/12660367?v=3","gravatar_id":"","url":"https://api.github.com/users/spira","html_url":"https://github.com/spira","followers_url":"https://api.github.com/users/spira/followers","following_url":"https://api.github.com/users/spira/following{/other_user}","gists_url":"https://api.github.com/users/spira/gists{/gist_id}","starred_url":"https://api.github.com/users/spira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spira/subscriptions","organizations_url":"https://api.github.com/users/spira/orgs","repos_url":"https://api.github.com/users/spira/repos","events_url":"https://api.github.com/users/spira/events{/privacy}","received_events_url":"https://api.github.com/users/spira/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spira/spira","description":"Lumen + AngularJS with Docker project seed","fork":false,"url":"https://api.github.com/repos/spira/spira","forks_url":"https://api.github.com/repos/spira/spira/forks","keys_url":"https://api.github.com/repos/spira/spira/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spira/spira/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spira/spira/teams","hooks_url":"https://api.github.com/repos/spira/spira/hooks","issue_events_url":"https://api.github.com/repos/spira/spira/issues/events{/number}","events_url":"https://api.github.com/repos/spira/spira/events","assignees_url":"https://api.github.com/repos/spira/spira/assignees{/user}","branches_url":"https://api.github.com/repos/spira/spira/branches{/branch}","tags_url":"https://api.github.com/repos/spira/spira/tags","blobs_url":"https://api.github.com/repos/spira/spira/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spira/spira/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spira/spira/git/refs{/sha}","trees_url":"https://api.github.com/repos/spira/spira/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spira/spira/statuses/{sha}","languages_url":"https://api.github.com/repos/spira/spira/languages","stargazers_url":"https://api.github.com/repos/spira/spira/stargazers","contributors_url":"https://api.github.com/repos/spira/spira/contributors","subscribers_url":"https://api.github.com/repos/spira/spira/subscribers","subscription_url":"https://api.github.com/repos/spira/spira/subscription","commits_url":"https://api.github.com/repos/spira/spira/commits{/sha}","git_commits_url":"https://api.github.com/repos/spira/spira/git/commits{/sha}","comments_url":"https://api.github.com/repos/spira/spira/comments{/number}","issue_comment_url":"https://api.github.com/repos/spira/spira/issues/comments{/number}","contents_url":"https://api.github.com/repos/spira/spira/contents/{+path}","compare_url":"https://api.github.com/repos/spira/spira/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spira/spira/merges","archive_url":"https://api.github.com/repos/spira/spira/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spira/spira/downloads","issues_url":"https://api.github.com/repos/spira/spira/issues{/number}","pulls_url":"https://api.github.com/repos/spira/spira/pulls{/number}","milestones_url":"https://api.github.com/repos/spira/spira/milestones{/number}","notifications_url":"https://api.github.com/repos/spira/spira/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spira/spira/labels{/name}","releases_url":"https://api.github.com/repos/spira/spira/releases{/id}","created_at":"2015-05-12T05:44:10Z","updated_at":"2015-09-26T11:00:25Z","pushed_at":"2015-10-12T02:56:36Z","git_url":"git://github.com/spira/spira.git","ssh_url":"git@github.com:spira/spira.git","clone_url":"https://github.com/spira/spira.git","svn_url":"https://github.com/spira/spira","homepage":"http://spira.github.io","size":5959,"stargazers_count":12,"watchers_count":12,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":8,"forks":4,"open_issues":8,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spira/spira/pulls/273"},"html":{"href":"https://github.com/spira/spira/pull/273"},"issue":{"href":"https://api.github.com/repos/spira/spira/issues/273"},"comments":{"href":"https://api.github.com/repos/spira/spira/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/spira/spira/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/spira/spira/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/spira/spira/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/spira/spira/statuses/bf521b06a237dbf779c65913d4d191f98e80150b"}}}}