Download the PHP package greggilbert/redoubt without Composer

On this page you can find all versions of the php package greggilbert/redoubt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package redoubt

NOT MAINTAINED.

This is an L4 package and won't be updated for L5, or at any point in the future. If you're looking for a more up to date package, try BeatSwitch/lock.

Redoubt

A resource-level ACL for Laravel 4. Based on and inspired by lukaszb/django-guardian, an excellent Django library.

Note: this in active development. The interfaces won't change, but there will be more functionality added in within the next few months.

Installation

Add the following line to the require section of composer.json:

Setup

  1. Add Greggilbert\Redoubt\RedoubtServiceProvider to the service provider list in app/config/app.php.
  2. Add 'Redoubt' => 'Greggilbert\Redoubt\Facades\Redoubt', to the list of aliases in app/config/app.php.
  3. If you're using Eloquent, run php artisan migrate --package=greggilbert/redoubt.
  4. OPTIONAL: If you plan to override any of the base classes (e.g. User), run php artisan config:publish greggilbert/redoubt.

Usage

Redoubt offers two levels of permissions: users and groups. Users and groups can be given access to resources, and users can be associated to groups. Each resouce must have permission defined on it.

Redoubt uses Laravel's built-in polymorphic relations to handle its associations, so all you have to do is pass in the actual model.

On resources

Resources need to implement Greggilbert\Redoubt\Permission\PermissibleInterface, which defines one method, getPermissions(). The method needs to return an array where the key is the permission, and the value is the description:

This MUST be defined for each method; trying to associate a permission on a resource where the permission is not already defined will throw an error.

To create a group:

To create an admin group, add 'is_admin' => true, into the create() statement.

To associate a user to a resource:

allowUser() has a third parameter for a user; if it's not defined, it will default to the current one used by Laravel's Auth.

To deassociate a user to a resource:

To associate a group to a resource:

To deassociate a group to a resource:

To associate a user to a group:

If you're using the default configuration, Users and Groups are Eloquent models, so you would do:

To check if a user has access:

Redoubt::userCan() checks if the user has access or if they're in any groups that have that access. This function will return true for user who is in any admin groups.

To get all permissions that a user has:

getPermissions() can take three parameters: a user, an object, and a permission. All of these parameters are optional. If the first parameter is left as null, it will use the current user.

The following would get all the permissions the current user has for Articles.

Similarly, this would get all the permissions the current user has for editing Articles.

You can pass in an Article object for the second parameter as well.

To get users who have permissions to an object:

Note that this will return UserObjectPermission models; you'll need to then call ->getUser() to get the user.

To get groups who have permissions to an object:

Note that this will return GroupObjectPermission models; you'll need to then call ->getGroup() to get the group.

Other functions

To check if a user is in a group:

$groups should be an array of Group objects.

To get users in a group:

This will return a collection of User objects.

Extension

Redoubt has a built-in User class, but if you want to extend it to use on your own, either extend Greggilbert\Redoubt\User\EloquentUser or implement the Greggilbert\Redoubt\User\UserInterface interface. You'll also need to publish the config for the package and change the user model listed there.


All versions of redoubt with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
illuminate/support Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package greggilbert/redoubt contains the following files

Loading the files please wait ....