#Warning: still in final development stages, but functional. Do not use in production.
keep·er /ˈkēpər/
noun: keeper; plural noun: keepers
- a person who manages or looks after something or someone.
- an object that keeps another in place, or protects something more fragile or valuable, in particular.
- This package depends on a BaseModel, belonging to the root namespace, so that it can be referenced by
\BaseModel
. Your BaseModel class should implement your ORM of choice (by default Eloquent); we will use this to connect to the database. - You must have at least 1 (one) user in your users table.
To install bones-keeper package for Laravel 4.2.* projects (terminal):
composer require genealabs/bones-keeper:0.12.1@dev
For Laravel 5 projects:
composer require genealabs/bones-keeper:^0.13.2@dev
And then add the service provider to your app.php config file:
// 'providers' => array(
'GeneaLabs\Bones\Keeper\BonesKeeperServiceProvider',
// );
Before we can get started, we need to update the database by running the migrations and data seeders:
php artisan migrate --path=vendor/genealabs/bones-keeper/src/migrations
php artisan db:seed --class=BonesKeeperDatabaseSeeder
Now we need to make the assets available (for Laravel 4):
php artisan asset:publish genealabs/bones-keeper
Now we need to make the assets and configuration available (for Laravel 5):
php artisan vendor:publish
You will need to add two global error handlers above the existing default error handler to manage when a user fails the permissions-check in /app/start/global.php:
App::error(function(GeneaLabs\Bones\Keeper\Exceptions\InvalidAccessException $exception, $code) {
return Response::make(View::make('bones-keeper::errors.unauthorized'), 404);
});
App::error(function (Watson\Validating\ValidationException\ValidationException $exception) {
return Redirect::route('modelValidation')->withErrors($exception->getErrors());
});
The above uses the default error views that come with the package. You can customize these using your own views, of course.
Used to detect or allow access based on a "no"-access condition.
Used to detect or allow access to user's own items only. The $userId belonging to the item in question must be passed in.
Used to detect or allow access to other's items, this is basically the inverse of "own". The $userId belonging to the item in question must be passed in.
Used to detect or allow access to all items in question, ownership is not checked if the user's role is set to "any".
// tba
At this time this package requires:
- Laravel 5.x
- jQuery 1.11.x
- Bootstrap 3.x