2017 © Pedro Peláez
 

library impersonate

Allows a user to impersonate another user.

image

christhompsontldr/impersonate

Allows a user to impersonate another user.

  • Wednesday, June 13, 2018
  • by ChrisThompsonTLDR
  • Repository
  • 1 Watchers
  • 5 Stars
  • 195 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 8 % Grown

The README.md

Impersonate

Allow a user to impersonate another user., (*1)

Installation

Composer

Require this package with composer:, (*2)

composer require christhompsontldr/impersonate

Service Provider

After updating composer, add the ServiceProvider to the providers array in config/app.php, (*3)

Laravel 5.4 or below:

Christhompsontldr\Impersonate\ImpersonateServiceProvider::class,

Laravel 5.5 or above will auto discover the needed service provider.

Setup

This will apply a trait to the user model configured in config/auth.php. setup runs both the add-trait and publish commands., (*4)

php artisan impersonate:setup

This will run two commands (which can be run independently):, (*5)

php artisan impersonate:add-trait
php artisan impersonate:publish

publish publishes the config and add-trait applies a trait to the user model., (*6)

Access Control

You must complete this step, or none of your users will have permission to impersonate., (*7)

The authorized users that can impersonate and which users they can impersonate is controlled via the trait. This can be overloaded on your user model, (*8)

In this example, the user model has an is_admin attribute that is being checked., (*9)

public function canImpersonate($id)
{
    return $this->is_admin ?: false;
}

Or if you are using Laratrust, (*10)

public function canImpersonate($id)
{
    return $this->hasRole('admin');
}

Issues

Log out will be performed on both the main user and the impersonated user., (*11)

Source

This package is based off an this example., (*12)

The Versions

13/06 2018

dev-master

9999999-dev

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

21/05 2018

v1.0.2

1.0.2.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

21/05 2018

v1.02

1.02.0.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

01/12 2017

v1.0.1

1.0.1.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

27/07 2017

v1.0.0

1.0.0.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

10/12 2016

0.0.4

0.0.4.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

07/12 2016

0.0.3

0.0.3.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

07/12 2016

0.0.2

0.0.2.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management

07/12 2016

0.0.1

0.0.1.0

Allows a user to impersonate another user.

  Sources   Download

The Requires

 

laravel user management