https://github.com/tomzx/policy-evaluator
Policy evaluator based on AWS AMI Policies.
https://github.com/tomzx/policy-evaluator
aws policies policy policy-evaluator
Last synced: 8 months ago
JSON representation
Policy evaluator based on AWS AMI Policies.
- Host: GitHub
- URL: https://github.com/tomzx/policy-evaluator
- Owner: tomzx
- License: mit
- Created: 2017-02-09T15:21:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-19T23:16:44.000Z (over 7 years ago)
- Last Synced: 2025-01-30T15:25:55.518Z (8 months ago)
- Topics: aws, policies, policy, policy-evaluator
- Language: PHP
- Size: 22.5 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Policy Evaluator
[](https://packagist.org/packages/tomzx/policy-evaluator)
[](https://packagist.org/packages/tomzx/policy-evaluator)
[](https://packagist.org/packages/tomzx/policy-evaluator)
[](https://travis-ci.org/tomzx/policy-evaluator)
[](https://scrutinizer-ci.com/g/tomzx/policy-evaluator/code-structure)
[](https://scrutinizer-ci.com/g/tomzx/policy-evaluator)
[](https://packagist.org/packages/tomzx/policy-evaluator)`Policy Evaluator` is a simple system based on AWS Policies. Given a set of statements, `Policy Evaluator` will then be able to answers to queries about whether this set of policies is allowed (or not) to perform a given action on a given resource.
## Getting started
`php composer.phar require tomzx/policy-evaluator`## Example
```php
use tomzx\PolicyEvaluator\Evaluator;
use tomzx\PolicyEvaluator\Resource;Resource::$prefix = 'arn';
$evaluator = new Evaluator([
'Statement' => [
[
'Action' => 'service:*',
'Resource' => 'arn:aws:*',
'Effect' => 'Allow',
],
[
'Action' => 's3:*',
'Resource' => 'arn:aws:s3:::my-bucket/*',
'Effect' => 'Allow',
],
],
]);$evaluator->canExecuteActionOnResource('service:test', 'arn:aws:test');
$evaluator->canExecuteActionOnResource('s3:GetObject', 'arn:aws:s3:::my-bucket/some-file');
```### Variables support
```php
use tomzx\PolicyEvaluator\Evaluator;
use tomzx\PolicyEvaluator\Resource;Resource::$prefix = 'arn';
$evaluator = new Evaluator([
'Statement' => [
[
'Action' => 'service:*',
'Resource' => 'arn:aws:${aws:username}',
'Effect' => 'Allow',
],
],
]);$evaluator->canExecuteActionOnResource('service:test', 'arn:aws:test', [
'aws:username' => 'someUsername',
]);
```## License
The code is licensed under the [MIT license](http://choosealicense.com/licenses/mit/). See [LICENSE](LICENSE).