adamsmeat/javert

There is no license information available for the latest version (dev-master) of this package.

authentication, authorization, oauth package

dev-master 2013-04-23 18:35 UTC

This package is not auto-updated.

Last update: 2025-01-27 12:46:58 UTC


README

Authentication, Authorization, OAuth package

Installation

<?php
return array(
	'providers' => 'Adamsmeat\Javert\JavertServiceProvider',
	'aliases' => array(
		'Helpers' => 'Adamsmeat\Javert\JavertFacade',
	)
);
?>

### Javert objects
- JavertResource 
	-(blog, forum, thread, user, etc.)
	-(resources will have attributes(id, ))

- JavertIntention (edit.article, update.profile, hide.page, etc.)
- JavertRestriction (restriction::(edit.article))
- JavertPrivilege (JavertPrivilege::can(edit.article))
- JavertUser ()
- JavertGroup (mod[editor, user, writer]) - collection of roles
- JavertRole (article.editor[edit, publish, unpublish])


JavertUser
	->privileges(
		// resource => array of privileges
		'article' => ['edit', 'publish', 'unpublish']	
	)


Samples:
function restrict($resource_intention) {
	Event::fire('restrict:route_access')
}

A user visits a route '/promos'.
The resource here is 'route'.
restrict(route_access)
how to bypass?
user should have privilege(sources could be User privileges, group)
function JavertUser::can('access_route', ['id'=>'1', 'route_path' => 'anasha/profile'])) {
	getPrivileges()
}