Download the PHP package democracyapps/member-org without Composer

On this page you can find all versions of the php package democracyapps/member-org. 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 member-org

member-org

Laravel application support for multiple org types, each with own users with multiple permission levels. Organization and OrganizationMember present an interface, while EloquentMemberOrganization and EloquentOrganizationMember are traits that provide a full implementation when added to an Eloquent model.

The package is quite simple. It's most useful when a platform must support multiple types of organizations and organization members at the same time.

Important: If you are thinking of using this package, please contact me via Twitter (@ejaxon). I am considering adding functionality around user invites, user management, migrations, etc.

Instructions For Use

Installation

Begin by installing this package through Composer.

Add the service provider to app.php

(note that the service provider is currently only needed if you wish to publish the configuration file in order to change the defaults.

The only requirement right now is that the user class obey Laravel's Authenticable contract.

Note that the EloquentOrganizationMember train only has stubs for the OrganizationMember interface (unlike EloquentMemberOrganization). I am holding off until I better understand requirements for it (if any).

Applying to an Organization

Let's assume that you have a Company class to which you wish to apply this package and that Company is a subclass of Eloquent Model:

Change the class to implement the Organization interface and make use of the EloquentOrganization trait:

In addition, create a CompanyMember class (NOTE: the 'Member' part of the name is required. An option in the configuration file will allow it to be set to something different.):

and create a migration for it. It is required to have three columns:

None of the columns may be null. Note that the second column must be named with the snake_case version of your organization class with '_id" appended.

Configuration Parameters

There are three main parameters and a few auxiliary ones. If you wish to change the defaults, add the service provider, run

php artisan vendor:publish

and edit 'config/member-org.php'.

max_permission_level (default: 9)

Permissions are simple - each organization member is assigned an access level between 0 and max_permission_level. Pages and resources in your application can be assigned required access levels and users with access below the required level will fail the userHasAccess test.

I typically begin by assigning only two levels, 0 for no privileges and 9 for administrators, leaving intermediate values available for later use.

user_implements_superuser (default: false)

If set to true, the package expects the user table to contain a boolean column which, if true, makes the user a "superuser" who always has access to any resource or page. By default, the column name is assumed to be 'superuser', but this can be changed in the configuration file.

user_implements_confirmation (default: false)

If set to true, the package expects that the application requires users to verify their accounts in some way and that they should not gain full privileges until they do. Their status should be indicated in a boolean column in the user table (by default the column name is assumed to be 'confirmed', but this can be changed in the configuration file).

The user_confirmation_required_threshold (default:0) specifies the maximum privilege level they may have before verifying their accounts. Thus, a full administrator (access=9) would remain restricted to access level 0 by default until verification is completed.

Basic Use

So far I am making use of the package in two simple ways. First, I use the Organization's addMember method to create organization users (this creates the entry in the database). Second, I use the Organization's userHasAccess method in route middleware to restrict access to organization pages (generally admin pages).

Here is a concrete example of a middleware class for company admin pages. In the route, the company ID is in the 2nd route segment.

Problems and Plans

This module is being used for a couple products in active development and will probably evolve. If you find bugs or have requests for features, create an issue here, find me on Twitter (@ejaxon) or submit a pull request.


All versions of member-org with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~5.0
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 democracyapps/member-org contains the following files

Loading the files please wait ....