2017 © Pedro Peláez
 

library multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

image

muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  • Wednesday, November 29, 2017
  • by muhammadsaeedparacha
  • Repository
  • 1 Watchers
  • 1 Stars
  • 35 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Laravel ACL

Latest Version on Packagist ![Software License][ico-license] ![Total Downloads][ico-downloads], (*1)

Multi Tenant Laravel ACL is a simple Multi Database Multi Tenant - user, company_user, role, permission ACL for SaaS Applications in Laravel Framework. This package was based on the great package yajra\laravel-acl but is catered to Multi-Database Multi-Tenant SaaS applications., (*2)

, (*3)

1) Installation

Via Composer, (*4)

``` bash $ composer require muhammadsaeedparacha/multi-tenant-laravel-acl, (*5)


## 2) Configuration #### [i] Register service provider: ``` php Paracha\Acl\AclServiceProvider::class

[ii] Register Middlewares: in App\Http\Kernel.php

'canAtLeast' => \Paracha\Acl\Middleware\CanAtLeastMiddleware::class,
'permission' => \Paracha\Acl\Middleware\PermissionMiddleware::class,
'role' => \Paracha\Acl\Middleware\RoleMiddleware::class,
'tenantConnection' => \Paracha\Acl\Middleware\TenantConnectionMiddleware::class,
'checkPermission' => \Paracha\Acl\Middleware\CheckPermissionsMiddleware::class,
'checkModularPermission' => \Paracha\Acl\Middleware\CheckModularPermissionsMiddleware::class,

[iii] Tenant Connection: in Config\Database to be filled on the fly based on tenant:

Note: Currently only Supports MySQL, (*6)

'tenant' => [
'driver' => 'mysql',
'host' => '',
'port' => env('DB_PORT', '3306'),
'database' => '',
'username' => '',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],

[iv] Publish assets:

$ php artisan vendor:publish --tag=multi-tenant-laravel-acl

[v: Optional] Configure your Tenant Migrations Locations: in Config\Acl. The array defines folders within Database\Migrations

``` php 'tenantMigrations' => ['/tenants'], (*7)


#### [vi] Run migrations: ```php php artisan migrate

[vii] Put User trait in App\User Model:

use Paracha\Acl\Traits\AclUser;
class Company extends Model
{
    use AclUser
}

3) Usage

[i] Middleware for route permissions. Currently only for Ajax/XHR requests in routes\api.php

Route::group(['middleware' => ['auth:api','tenantConnection']], function(){
Route::group(['middleware' => ['checkPermission']], function(){
// Regular Permissions like users.create, users.update, users.read, users.delete, users.report
Route::resource('/users', 'UsersController');
});
// Customer Permissions like users.custom, users.xyz
Route::post('/users/invite', 'UsersController@invite')->middleware('checkPermission:users.custom');
});

[ii] Migrate Tenant migrations from folders set in config('acl.tenantMigrations')

php $company = Company::find(1); $company->createTenantDatabase(); $company->migrateTenant(); This will create Database with name db_1 for Company ID 1 with username = 1, and password = 'password' (This is insecure and needs to be secured), (*8)

4) Documentation

Documentation is not written yet and the documentation of yajra\laravel-acl can be used till then since this project was based on it., (*9)

Change log

Please see CHANGELOG for more information what has changed recently., (*10)

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*11)

Security

If you discover any security related issues, please email saeedparacha13@gmail.com instead of using the issue tracker., (*12)

Credits

License

The Apache-2.0 License. Please see License File for more information., (*13)

The Versions

29/11 2017

dev-master

9999999-dev https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

23/08 2017

v1.1.3

1.1.3.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

16/08 2017

v1.1.2

1.1.2.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

15/08 2017

v1.1.1

1.1.1.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

15/08 2017

v1.1

1.1.0.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

15/08 2017

v1.0.1

1.0.1.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

13/08 2017

1.0

1.0.0.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha

10/08 2017

0.1.1

0.1.1.0 https://github.com/muhammadsaeedparacha/multi-tenant-laravel-acl

Multi Database Multi Tenant ACL for Laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Muhammad Saeed Paracha

acl user permissions role tenant tenancy multi tenant saeed paracha