Skip to content

Instantly share code, notes, and snippets.

@enygma
Created December 21, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enygma/cc6654d8307360f16e44 to your computer and use it in GitHub Desktop.
Save enygma/cc6654d8307360f16e44 to your computer and use it in GitHub Desktop.
example of a more refined Verify syntax (powered by PropAuth)
<?php
$user = (object)[
'username' => 'ccornutt',
'password' => password_hash('test1234', PASSWORD_DEFAULT),
'permissions' => ['test1', 'test2', 'edit']
];
$subject = new \Psecio\Verify\Subject\Simple($user);
$gate = new Gateway($subject);
if ($gate->authorize($_POST['password']) && $gate->can('test1')) {
echo 'woo!';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment