Adds Permission model and framework for testing permission manager.

This commit is contained in:
Vassyli
2016-10-31 13:28:30 +01:00
parent 94e18b8d11
commit 3bf23f3ac7
15 changed files with 549 additions and 102 deletions
Generated
+104 -101
View File
@@ -4,6 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "30e4866a38047b4a1fd9c55cf08f22ec",
"content-hash": "db8bc30537b2e353991fb5f1034910bf", "content-hash": "db8bc30537b2e353991fb5f1034910bf",
"packages": [ "packages": [
{ {
@@ -44,7 +45,7 @@
"slug", "slug",
"transliterator" "transliterator"
], ],
"time": "2015-09-28T16:26:35+00:00" "time": "2015-09-28 16:26:35"
}, },
{ {
"name": "composer/ca-bundle", "name": "composer/ca-bundle",
@@ -102,20 +103,20 @@
"ssl", "ssl",
"tls" "tls"
], ],
"time": "2016-11-02T18:11:27+00:00" "time": "2016-11-02 18:11:27"
}, },
{ {
"name": "composer/composer", "name": "composer/composer",
"version": "1.3.0", "version": "1.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/composer.git", "url": "https://github.com/composer/composer.git",
"reference": "e53f9e5381e70f76e098136343e27d92601eade7" "reference": "91dbca556764dcece45e1ba3aab14de2deaa9fec"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/composer/zipball/e53f9e5381e70f76e098136343e27d92601eade7", "url": "https://api.github.com/repos/composer/composer/zipball/91dbca556764dcece45e1ba3aab14de2deaa9fec",
"reference": "e53f9e5381e70f76e098136343e27d92601eade7", "reference": "91dbca556764dcece45e1ba3aab14de2deaa9fec",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -179,7 +180,7 @@
"dependency", "dependency",
"package" "package"
], ],
"time": "2016-12-23T23:47:04+00:00" "time": "2017-01-07 17:08:51"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
@@ -241,7 +242,7 @@
"validation", "validation",
"versioning" "versioning"
], ],
"time": "2016-08-30T16:08:34+00:00" "time": "2016-08-30 16:08:34"
}, },
{ {
"name": "composer/spdx-licenses", "name": "composer/spdx-licenses",
@@ -302,29 +303,27 @@
"spdx", "spdx",
"validator" "validator"
], ],
"time": "2016-09-28T07:17:45+00:00" "time": "2016-09-28 07:17:45"
}, },
{ {
"name": "d11wtq/boris", "name": "d11wtq/boris",
"version": "v1.0.8", "version": "v1.0.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/borisrepl/boris.git", "url": "https://github.com/borisrepl/boris.git",
"reference": "125dd4e5752639af7678a22ea597115646d89c6e" "reference": "31055b15e2d3fe47f31f6aa8e277f8f3fc7eb483"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/borisrepl/boris/zipball/125dd4e5752639af7678a22ea597115646d89c6e", "url": "https://api.github.com/repos/borisrepl/boris/zipball/31055b15e2d3fe47f31f6aa8e277f8f3fc7eb483",
"reference": "125dd4e5752639af7678a22ea597115646d89c6e", "reference": "31055b15e2d3fe47f31f6aa8e277f8f3fc7eb483",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.0"
},
"suggest": {
"ext-pcntl": "*", "ext-pcntl": "*",
"ext-posix": "*", "ext-posix": "*",
"ext-readline": "*" "ext-readline": "*",
"php": ">=5.3.0"
}, },
"bin": [ "bin": [
"bin/boris" "bin/boris"
@@ -336,7 +335,11 @@
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"time": "2014-01-17T12:21:18+00:00" "license": [
"MIT"
],
"description": "A tiny, but robust REPL (Read-Evaluate-Print-Loop) for PHP.",
"time": "2015-03-01 08:05:19"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
@@ -404,7 +407,7 @@
"docblock", "docblock",
"parser" "parser"
], ],
"time": "2016-12-30T15:59:45+00:00" "time": "2016-12-30 15:59:45"
}, },
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
@@ -474,7 +477,7 @@
"cache", "cache",
"caching" "caching"
], ],
"time": "2016-10-29T11:16:17+00:00" "time": "2016-10-29 11:16:17"
}, },
{ {
"name": "doctrine/collections", "name": "doctrine/collections",
@@ -540,20 +543,20 @@
"collections", "collections",
"iterator" "iterator"
], ],
"time": "2015-04-14T22:21:58+00:00" "time": "2015-04-14 22:21:58"
}, },
{ {
"name": "doctrine/common", "name": "doctrine/common",
"version": "v2.6.2", "version": "v2.7.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/common.git", "url": "https://github.com/doctrine/common.git",
"reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" "reference": "930297026c8009a567ac051fd545bf6124150347"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", "url": "https://api.github.com/repos/doctrine/common/zipball/930297026c8009a567ac051fd545bf6124150347",
"reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", "reference": "930297026c8009a567ac051fd545bf6124150347",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -562,10 +565,10 @@
"doctrine/collections": "1.*", "doctrine/collections": "1.*",
"doctrine/inflector": "1.*", "doctrine/inflector": "1.*",
"doctrine/lexer": "1.*", "doctrine/lexer": "1.*",
"php": "~5.5|~7.0" "php": "~5.6|~7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.8|~5.0" "phpunit/phpunit": "^5.4.6"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -613,24 +616,24 @@
"persistence", "persistence",
"spl" "spl"
], ],
"time": "2016-11-30T16:50:46+00:00" "time": "2017-01-13 14:02:13"
}, },
{ {
"name": "doctrine/dbal", "name": "doctrine/dbal",
"version": "v2.5.5", "version": "v2.5.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/doctrine/dbal.git", "url": "https://github.com/doctrine/dbal.git",
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9" "reference": "6314d55f60f85f0295c90688397b75c13faf9f0e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", "url": "https://api.github.com/repos/doctrine/dbal/zipball/6314d55f60f85f0295c90688397b75c13faf9f0e",
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", "reference": "6314d55f60f85f0295c90688397b75c13faf9f0e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/common": ">=2.4,<2.7-dev", "doctrine/common": ">=2.4,<2.8-dev",
"php": ">=5.3.2" "php": ">=5.3.2"
}, },
"require-dev": { "require-dev": {
@@ -684,7 +687,7 @@
"persistence", "persistence",
"queryobject" "queryobject"
], ],
"time": "2016-09-09T19:13:33+00:00" "time": "2017-01-17 17:48:38"
}, },
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
@@ -751,7 +754,7 @@
"singularize", "singularize",
"string" "string"
], ],
"time": "2015-11-06T14:35:42+00:00" "time": "2015-11-06 14:35:42"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@@ -805,7 +808,7 @@
"constructor", "constructor",
"instantiate" "instantiate"
], ],
"time": "2015-06-14T21:17:01+00:00" "time": "2015-06-14 21:17:01"
}, },
{ {
"name": "doctrine/lexer", "name": "doctrine/lexer",
@@ -859,7 +862,7 @@
"lexer", "lexer",
"parser" "parser"
], ],
"time": "2014-09-09T13:34:57+00:00" "time": "2014-09-09 13:34:57"
}, },
{ {
"name": "doctrine/orm", "name": "doctrine/orm",
@@ -935,7 +938,7 @@
"database", "database",
"orm" "orm"
], ],
"time": "2016-12-18T15:42:34+00:00" "time": "2016-12-18 15:42:34"
}, },
{ {
"name": "gedmo/doctrine-extensions", "name": "gedmo/doctrine-extensions",
@@ -1014,7 +1017,7 @@
"tree", "tree",
"uploadable" "uploadable"
], ],
"time": "2016-12-21T13:46:54+00:00" "time": "2016-12-21 13:46:54"
}, },
{ {
"name": "justinrainbow/json-schema", "name": "justinrainbow/json-schema",
@@ -1080,7 +1083,7 @@
"json", "json",
"schema" "schema"
], ],
"time": "2016-12-22T16:43:46+00:00" "time": "2016-12-22 16:43:46"
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
@@ -1158,7 +1161,7 @@
"logging", "logging",
"psr-3" "psr-3"
], ],
"time": "2016-11-26T00:15:39+00:00" "time": "2016-11-26 00:15:39"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@@ -1205,7 +1208,7 @@
"psr", "psr",
"psr-3" "psr-3"
], ],
"time": "2016-10-10T12:19:37+00:00" "time": "2016-10-10 12:19:37"
}, },
{ {
"name": "seld/cli-prompt", "name": "seld/cli-prompt",
@@ -1253,7 +1256,7 @@
"input", "input",
"prompt" "prompt"
], ],
"time": "2016-04-18T09:31:41+00:00" "time": "2016-04-18 09:31:41"
}, },
{ {
"name": "seld/jsonlint", "name": "seld/jsonlint",
@@ -1299,7 +1302,7 @@
"parser", "parser",
"validator" "validator"
], ],
"time": "2016-11-14T17:59:58+00:00" "time": "2016-11-14 17:59:58"
}, },
{ {
"name": "seld/phar-utils", "name": "seld/phar-utils",
@@ -1343,20 +1346,20 @@
"keywords": [ "keywords": [
"phra" "phra"
], ],
"time": "2015-10-13T18:44:15+00:00" "time": "2015-10-13 18:44:15"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "d12aa9ca20f4db83ec58410978dab6afcb9d6aaa" "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/d12aa9ca20f4db83ec58410978dab6afcb9d6aaa", "url": "https://api.github.com/repos/symfony/console/zipball/4f9e449e76996adf310498a8ca955c6deebe29dd",
"reference": "d12aa9ca20f4db83ec58410978dab6afcb9d6aaa", "reference": "4f9e449e76996adf310498a8ca955c6deebe29dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1406,20 +1409,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-12-11T14:34:22+00:00" "time": "2017-01-08 20:47:33"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "9f923e68d524a3095c5a2ae5fc7220c7cbc12231" "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/9f923e68d524a3095c5a2ae5fc7220c7cbc12231", "url": "https://api.github.com/repos/symfony/debug/zipball/810ba5c1c5352a4ddb15d4719e8936751dff0b05",
"reference": "9f923e68d524a3095c5a2ae5fc7220c7cbc12231", "reference": "810ba5c1c5352a4ddb15d4719e8936751dff0b05",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1463,20 +1466,20 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-11-16T22:18:16+00:00" "time": "2017-01-02 20:32:22"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4" "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", "url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4",
"reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", "reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1512,20 +1515,20 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-11-24T00:46:43+00:00" "time": "2017-01-08 20:47:33"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b" "reference": "8c71141cae8e2957946b403cc71a67213c0380d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b", "url": "https://api.github.com/repos/symfony/finder/zipball/8c71141cae8e2957946b403cc71a67213c0380d6",
"reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b", "reference": "8c71141cae8e2957946b403cc71a67213c0380d6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1561,7 +1564,7 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-12-13T09:39:43+00:00" "time": "2017-01-02 20:32:22"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@@ -1620,20 +1623,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-11-14T01:06:16+00:00" "time": "2016-11-14 01:06:16"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "02ea84847aad71be7e32056408bb19f3a616cdd3" "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3", "url": "https://api.github.com/repos/symfony/process/zipball/350e810019fc52dd06ae844b6a6d382f8a0e8893",
"reference": "02ea84847aad71be7e32056408bb19f3a616cdd3", "reference": "350e810019fc52dd06ae844b6a6d382f8a0e8893",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1669,20 +1672,20 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-11-24T10:40:28+00:00" "time": "2017-01-02 20:32:22"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.2.1", "version": "v3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "a7095af4b97a0955f85c8989106c249fa649011f" "reference": "50eadbd7926e31842893c957eca362b21592a97d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f", "url": "https://api.github.com/repos/symfony/yaml/zipball/50eadbd7926e31842893c957eca362b21592a97d",
"reference": "a7095af4b97a0955f85c8989106c249fa649011f", "reference": "50eadbd7926e31842893c957eca362b21592a97d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1724,7 +1727,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-12-10T10:07:06+00:00" "time": "2017-01-03 13:51:32"
} }
], ],
"packages-dev": [ "packages-dev": [
@@ -1777,7 +1780,7 @@
"issues": "https://github.com/Block8/php-docblock-checker/issues", "issues": "https://github.com/Block8/php-docblock-checker/issues",
"source": "https://github.com/Block8/php-docblock-checker" "source": "https://github.com/Block8/php-docblock-checker"
}, },
"time": "2016-07-31T06:01:25+00:00" "time": "2016-07-31 06:01:25"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
@@ -1819,7 +1822,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2016-10-31T17:19:45+00:00" "time": "2016-10-31 17:19:45"
}, },
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
@@ -1873,7 +1876,7 @@
"reflection", "reflection",
"static analysis" "static analysis"
], ],
"time": "2015-12-27T11:43:31+00:00" "time": "2015-12-27 11:43:31"
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
@@ -1918,7 +1921,7 @@
} }
], ],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-09-30T07:12:33+00:00" "time": "2016-09-30 07:12:33"
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
@@ -1965,7 +1968,7 @@
"email": "me@mikevanriel.com" "email": "me@mikevanriel.com"
} }
], ],
"time": "2016-11-25T06:54:22+00:00" "time": "2016-11-25 06:54:22"
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
@@ -2028,7 +2031,7 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2016-11-21T14:58:47+00:00" "time": "2016-11-21 14:58:47"
}, },
{ {
"name": "phpunit/dbunit", "name": "phpunit/dbunit",
@@ -2083,7 +2086,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-12-02T14:39:14+00:00" "time": "2016-12-02 14:39:14"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@@ -2146,7 +2149,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-12-20T15:22:42+00:00" "time": "2016-12-20 15:22:42"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@@ -2193,7 +2196,7 @@
"filesystem", "filesystem",
"iterator" "iterator"
], ],
"time": "2016-10-03T07:40:28+00:00" "time": "2016-10-03 07:40:28"
}, },
{ {
"name": "phpunit/php-text-template", "name": "phpunit/php-text-template",
@@ -2234,7 +2237,7 @@
"keywords": [ "keywords": [
"template" "template"
], ],
"time": "2015-06-21T13:50:34+00:00" "time": "2015-06-21 13:50:34"
}, },
{ {
"name": "phpunit/php-timer", "name": "phpunit/php-timer",
@@ -2278,7 +2281,7 @@
"keywords": [ "keywords": [
"timer" "timer"
], ],
"time": "2016-05-12T18:03:57+00:00" "time": "2016-05-12 18:03:57"
}, },
{ {
"name": "phpunit/php-token-stream", "name": "phpunit/php-token-stream",
@@ -2327,7 +2330,7 @@
"keywords": [ "keywords": [
"tokenizer" "tokenizer"
], ],
"time": "2016-11-15T14:06:22+00:00" "time": "2016-11-15 14:06:22"
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
@@ -2409,7 +2412,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2016-12-28T07:18:51+00:00" "time": "2016-12-28 07:18:51"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@@ -2468,7 +2471,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2016-12-08T20:27:08+00:00" "time": "2016-12-08 20:27:08"
}, },
{ {
"name": "sebastian/code-unit-reverse-lookup", "name": "sebastian/code-unit-reverse-lookup",
@@ -2513,7 +2516,7 @@
], ],
"description": "Looks up which function or method a line of code belongs to", "description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"time": "2016-02-13T06:45:14+00:00" "time": "2016-02-13 06:45:14"
}, },
{ {
"name": "sebastian/comparator", "name": "sebastian/comparator",
@@ -2577,7 +2580,7 @@
"compare", "compare",
"equality" "equality"
], ],
"time": "2016-11-19T09:18:40+00:00" "time": "2016-11-19 09:18:40"
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
@@ -2629,7 +2632,7 @@
"keywords": [ "keywords": [
"diff" "diff"
], ],
"time": "2015-12-08T07:14:41+00:00" "time": "2015-12-08 07:14:41"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
@@ -2679,7 +2682,7 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"time": "2016-11-26T07:53:53+00:00" "time": "2016-11-26 07:53:53"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
@@ -2746,7 +2749,7 @@
"export", "export",
"exporter" "exporter"
], ],
"time": "2016-11-19T08:54:04+00:00" "time": "2016-11-19 08:54:04"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
@@ -2797,7 +2800,7 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"time": "2015-10-12T03:26:01+00:00" "time": "2015-10-12 03:26:01"
}, },
{ {
"name": "sebastian/object-enumerator", "name": "sebastian/object-enumerator",
@@ -2843,7 +2846,7 @@
], ],
"description": "Traverses array structures and object graphs to enumerate all referenced objects", "description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/", "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2016-11-19T07:35:10+00:00" "time": "2016-11-19 07:35:10"
}, },
{ {
"name": "sebastian/recursion-context", "name": "sebastian/recursion-context",
@@ -2896,7 +2899,7 @@
], ],
"description": "Provides functionality to recursively process PHP variables", "description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context", "homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"time": "2016-11-19T07:33:16+00:00" "time": "2016-11-19 07:33:16"
}, },
{ {
"name": "sebastian/resource-operations", "name": "sebastian/resource-operations",
@@ -2938,7 +2941,7 @@
], ],
"description": "Provides a list of PHP built-in functions that operate on resources", "description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations", "homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"time": "2015-07-28T20:34:47+00:00" "time": "2015-07-28 20:34:47"
}, },
{ {
"name": "sebastian/version", "name": "sebastian/version",
@@ -2981,7 +2984,7 @@
], ],
"description": "Library that helps with managing the version number of Git-hosted PHP projects", "description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version", "homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00" "time": "2016-10-03 07:35:21"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@@ -3031,7 +3034,7 @@
"check", "check",
"validate" "validate"
], ],
"time": "2016-11-23T20:04:58+00:00" "time": "2016-11-23 20:04:58"
} }
], ],
"aliases": [], "aliases": [],
+95
View File
@@ -0,0 +1,95 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Models;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use LotGD\Core\Exceptions\ArgumentException;
use LotGD\Core\Tools\Model\Creator;
use LotGD\Core\Tools\Model\Deletor;
/**
* Represents a permission.
*
* @Entity()
* @Table(name="permissions")
*/
class Permission implements CreateableInterface
{
use Creator;
use Deletor;
/** @Id @Column(type="string"); */
private $id;
/** @Column(type="string") */
private $library;
/** @Column(type="string") */
private $name;
static $fillable = [
"id",
"library",
"name"
];
/**
* Returns the id of this entity.
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* Sets this entity's id if it's not set yet.
* @param string $id
*/
public function setId(string $id)
{
if (empty($this->id)) {
$this->id = $id;
}
else {
throw new ArgumentException("Cannot reset id.");
}
}
/**
* Returns the library this permission belongs to.
* @return string
*/
public function getLibrary(): string
{
return $this->library;
}
/**
* Sets the library this permission belongs to.
* @param string $library
*/
public function setLibrary(string $library)
{
$this->library = $library;
}
/**
* Gets this entity's human readable name.
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* Sets this entity's human readable name.
* @param string $name
*/
public function setName(string $name)
{
$this->name = $name;
}
}
+15
View File
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Models;
/**
* Extend this class to provide an association between an entity and a permission.
*/
abstract class PermissionAssociation
{
/** @OneToOne(targetEntity="Permission", mappedBy="owner") */
protected $permissionId;
/** @Column(type="int") */
protected $permissionState;
}
+24
View File
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Models;
/**
* Implement this interface if an entity has associates permissions.
*/
interface PermissionableInterface
{
/**
* Returns true if objects has a entry related to a given permission.
* @param string $permissionId
* @return bool
*/
public function hasPermission(string $permissionId): bool;
/**
* Returns the permission
* @param string $permissionId
* @return Permission
*/
public function getPermission(string $permissionId): Permission;
}
+79
View File
@@ -0,0 +1,79 @@
<?php
declare(strict_types=1);
namespace LotGD\Core;
/**
* Permissions can be managed with the PermissionManager.
*
* The PermissionManager class provides methods to work with permissions. It can
* be used to create or delete permissions, to remove, allow or deny permissions
* to actors and to check whether an actor has a certain permission or if it is
* explicitely denied from him.
*
* The wording used in this class is:
* - allowed, the actor has a certain permission in the allowed state.
* - denied, the actor has a certain permission in the denied state.
*
* To make this more clear, the following table summarizes how different methods
* react.
*
* Method
* State: | Unset | Allowed | Denied
* -------------------+-------+---------+---------
* isAllowed | False | True | False
* isDenied | False | False | True
* hasPermissionSet | False | True | True
*/
class PermissionManager
{
const Allowed = 1;
const Denied = -1;
const Superuser = "lotgd/core/superuser";
const AddScenes = "lotgd/core/scene/add";
const EditScenes = "lotgd/core/scene/edit";
const DeleteScenes = "lotgd/core/scene/delete";
const AddCharacters = "lotgd/core/characters/add";
const EditCharacters = "lotgd/core/characters/edit";
const DeleteCharacters = "lotgd/core/characters/delete";
/**
* Checks if an actor has a permission set. No assumption can be made if it's allowed or denied.
* @param \LotGD\Core\PermissionableInterface $actor
* @param string $permissionId
* @return bool True if the permission has been set, be it allowed or denied.
*/
public function hasPermissionSet(
PermissionableInterface $actor,
string $permissionId
): bool {
}
/**
* Checks if an actor is allowed a given permission.
* @param \LotGD\Core\PermissionableInterface $actor
* @param string $permissionId
* @return bool True if the actor has the permission set and it's state is allowed.
*/
public function isAllowed(
PermissionableInterface $actor,
string $permissionId
): bool {
}
/**
* Checks if an actor is denied a given permission.
* @param \LotGD\Core\PermissionableInterface $actor
* @param string $permissionId
* @return bool True if the actor has the permission set and it's state is denied.
*/
public function isDenied(
PermissionableInterface $actor,
string $permissionId
): bool {
}
}
@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tools\Model;
use LotGD\Core\Models\Permission;
/**
* Tools to work with a permission type field.
*/
trait PermissionAssociationable
{
/**
* @ManyToOne(targetEntity="LotGD\Core\Models\Permission", inversedBy="permission")
* @JoinColumn(name="permission_id", referencedColumnName="id")
*/
protected $permission;
/** @Column(type="integer") */
protected $permissionState;
}
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tools\Model;
use LotGD\Core\Models\Permission;
/**
* Tools to work with a permission type field.
*/
trait Permissionable
{
/** @var array Associations between permission-id and PermissionAssociation entity. */
private $_permissions = [];
protected function loadPermissions()
{
if (empty($this->_permissions)) {
foreach ($this->permissions as $permission) {
$this->_permissions[$permission->getId()] = $permission;
}
}
}
public function hasPermission(string $permissionId): bool
{
$this->loadPermissions();
return isset($this->_permissions[$permissionId]);
}
public function getPermission(string $permissionId): Permission
{
$this->loadPermissions();
return $this->_permissions[$permissionId];
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/bash -ex #!/bin/bash -ex
phpunit phpunit --stop-on-failure
./vendor/bin/phpdoccheck -d src --no-ansi ./vendor/bin/phpdoccheck -d src --no-ansi
+26
View File
@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tests\Managers;
use LotGD\Core\Models\PermissionableInterface;
use LotGD\Core\Models\PermissionAssociation;
use LotGD\Core\Tools\Model\Permissionable;
use LotGD\Core\Tests\CoreModelTestCase;
use LotGD\Core\Tests\Ressources\Models\User;
use LotGD\Core\Tests\Ressources\Models\UserPermissionAssociation;
/**
* Description of PermissionManagerTest
*/
class PermissionManagerTest extends CoreModelTestCase
{
protected $dataset = "permission-manager";
public function testSomething()
{
$this->assertTrue(True);
}
}
+1
View File
@@ -47,6 +47,7 @@ abstract class ModelTestCase extends \PHPUnit_Extensions_Database_TestCase
$libraryConfigurationManager = new LibraryConfigurationManager($composerManager, getcwd()); $libraryConfigurationManager = new LibraryConfigurationManager($composerManager, getcwd());
$directories = $libraryConfigurationManager->getEntityDirectories(); $directories = $libraryConfigurationManager->getEntityDirectories();
$directories[] = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'src', 'Models']); $directories[] = implode(DIRECTORY_SEPARATOR, [__DIR__, '..', 'src', 'Models']);
$directories[] = implode(DIRECTORY_SEPARATOR, [__DIR__, 'Ressources', 'TestModels']);
// Read db annotations from model files // Read db annotations from model files
$configuration = Setup::createAnnotationMetadataConfiguration($directories, true); $configuration = Setup::createAnnotationMetadataConfiguration($directories, true);
+60
View File
@@ -0,0 +1,60 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tests\Models;
use LotGD\Core\Exceptions\ArgumentException;
use LotGD\Core\Models\Permission;
use LotGD\Core\Tests\CoreModelTestCase;
/**
* Tests the Permission model.
*/
class PermissionModelTest extends CoreModelTestCase
{
/** @var string default data set */
protected $dataset = "permission";
public function testIfPermissionsCanBeFetched()
{
$em = $this->getEntityManager();
$permission = $em->getRepository(Permission::class)->find("lotgd/core/superuser");
$this->assertInstanceOf(Permission::class, $permission);
$this->assertEquals("lotgd/core/superuser", $permission->getId());
$this->assertEquals("lotgd/core", $permission->getLibrary());
$this->assertEquals("Superuser. Superseeds all flags.", $permission->getName());
}
public function testIfPermissionsCanBeCreated()
{
$permission = Permission::create([
"id" => "test/core/testpermission",
"library" => "test/core",
"name"=> "A permission for testing."
]);
$this->assertInstanceOf(Permission::class, $permission);
$em = $this->getEntityManager();
$permission->save($em);
$em->clear();
$permission = $em->getRepository(Permission::class)->find("test/core/testpermission");
$this->assertInstanceOf(Permission::class, $permission);
$this->assertEquals("test/core/testpermission", $permission->getId());
$this->assertEquals("test/core", $permission->getLibrary());
$this->assertEquals("A permission for testing.", $permission->getName());
}
public function testIfIdCannotBeChanged()
{
$em = $this->getEntityManager();
$permission = $em->getRepository(Permission::class)->find("lotgd/core/superuser");
$this->expectException(ArgumentException::class);
$permission->setId("another id.");
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tests\Ressources\TestModels;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use LotGD\Core\Models\PermissionableInterface;
use LotGD\Core\Tools\Model\Permissionable;
/**
* @Entity
* @Table("TestUsers")
*/
class User implements PermissionableInterface {
use Permissionable;
/** @Id @Column(type="integer") @GeneratedValue */
private $id;
/** @Column(type="string", length=50); */
private $name;
/** @OneToMany(targetEntity="UserPermissionAssociation", mappedBy="owner", cascade={"persist", "remove"}) */
private $permissions;
public function getId(): int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name)
{
$this->name = $name;
}
}
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace LotGD\Core\Tests\Ressources\TestModels;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Table;
use LotGD\Core\Models\PermissionAssociation;
use LotGD\Core\Tools\Model\PermissionAssociationable;
/**
* @Entity
* @Table("TestUserAssociations")
*/
class UserPermissionAssociation {
use PermissionAssociationable;
/**
* @Id @ManyToOne(targetEntity="User", inversedBy="permissions")
*/
private $owner;
}
+16
View File
@@ -0,0 +1,16 @@
## YAML Template.
testUsers:
-
id: 1
name: "Test User 1"
testUserAssociations:
-
owner_id: 1
permission_id: "lotgd/core/superuser"
permissionState: 1
permissions:
-
id: "lotgd/core/superuser"
library: "lotgd/core"
name: "Superuser. Superseeds all flags."
+6
View File
@@ -0,0 +1,6 @@
## YAML Template.
permissions:
-
id: "lotgd/core/superuser"
library: "lotgd/core"
name: "Superuser. Superseeds all flags."