All Projects → OctopyID → LaraPersonate

OctopyID / LaraPersonate

Licence: MIT license
Login as a different user quickly

Programming Languages

PHP
23972 projects - #3 most used programming language
SCSS
7915 projects
javascript
184084 projects - #8 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to LaraPersonate

eloquent-repository
Repository pattern for Eloquent ORM with focus in cache.
Stars: ✭ 30 (-75.21%)
Mutual labels:  eloquent, laravel-package
Laravel Schedulable
Schedule and unschedule eloquent models elegantly without cron jobs
Stars: ✭ 78 (-35.54%)
Mutual labels:  eloquent, laravel-package
Simple Cache
An easy to use Caching trait for Laravel's Eloquent Models.
Stars: ✭ 19 (-84.3%)
Mutual labels:  eloquent, laravel-package
Eloquent Approval
Approval process for Laravel Eloquent models
Stars: ✭ 79 (-34.71%)
Mutual labels:  eloquent, laravel-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+63.64%)
Mutual labels:  eloquent, laravel-package
Laravel-Auto-Hard-Deleter
Laravel and Lumen Auto Hard Deleter
Stars: ✭ 34 (-71.9%)
Mutual labels:  eloquent, laravel-package
Eloquent Ldap
A Laravel 5.1 package that first tries to log the user against the internal database if that fails, it tries against the configured LDAP/AD server.
Stars: ✭ 19 (-84.3%)
Mutual labels:  eloquent, laravel-package
Eloquent Relativity
Allows you to decouple your eloquent models from one another.
Stars: ✭ 112 (-7.44%)
Mutual labels:  eloquent, laravel-package
Laravel Deletable
👾 Gracefully restrict deletion of Laravel Eloquent models
Stars: ✭ 137 (+13.22%)
Mutual labels:  eloquent, laravel-package
laravel-sybase
Connection and Laravel Eloquent driver for Sybase
Stars: ✭ 29 (-76.03%)
Mutual labels:  eloquent, laravel-package
query-filter
Define filters for your Eloquent models based on your request
Stars: ✭ 20 (-83.47%)
Mutual labels:  eloquent, laravel-package
laravel-twig
Twig for Laravel Framework
Stars: ✭ 16 (-86.78%)
Mutual labels:  laravel-package
laravel-vatvalidator
Package to validate a vat id via the api of the european union (vies)
Stars: ✭ 15 (-87.6%)
Mutual labels:  laravel-package
laravel-ovh
Wrapper for OVH Object Storage integration with laravel
Stars: ✭ 30 (-75.21%)
Mutual labels:  laravel-package
laravel-arangodb
ArangoDB driver for Laravel
Stars: ✭ 43 (-64.46%)
Mutual labels:  eloquent
canvas
Code Generators for Laravel Applications and Packages
Stars: ✭ 139 (+14.88%)
Mutual labels:  laravel-package
qqmap-region
腾讯位置服务中国标准行政区划数据 SDK
Stars: ✭ 22 (-81.82%)
Mutual labels:  laravel-package
laravel-php-k8s
Just a simple port of renoki-co/php-k8s for easier access in Laravel
Stars: ✭ 71 (-41.32%)
Mutual labels:  laravel-package
laravel-json-api
Integrate JSON:API resources on Laravel
Stars: ✭ 17 (-85.95%)
Mutual labels:  laravel-package
laravel-mass-update
Update multiple Laravel Model records, each with its own set of values, sending a single query to your database!
Stars: ✭ 65 (-46.28%)
Mutual labels:  eloquent

Demo

Tests Version Downloads License

Lara Personate

Is a user impersonate for the Laravel framework. This package makes it easier for users who have access rights such as super admin to take over other user accounts.

Installation

To install the package, simply follow the steps below.

Install the package using Composer:

composer require octopyid/laravel-impersonate:^2
php artisan vendor:publish --provider="Octopy\LaraPersonate\ImpersonateServiceProvider"

Sometimes some users experience the problem of layout after upgrading the package, this can be solved by deleting the public/vendor/octopyid/impersonate folder then republish the assets.

Add the trait Octopy\LaraPersonate\Models\Impersonate to your User model.

<?php

namespace App\Models;

use Octopy\LaraPersonate\Models\Impersonate;
use Illuminate\Foundation\Auth\User as Authenticatable;

/**
 * Class User
 * @package App\Models
 */
class User extends Authenticatable
{
    use Impersonate;
}

Usage

By default, the user can impersonate and who is can be impersonated, but this causes security issues.

Defining Authorization

To limit the users who can impersonate. Add canImpersonate() to the User model.

/**
* @return bool
*/
public function canImpersonate() : bool
{
    // example usage with laratrust package
    return $this->hasRole('super-admin');
}

To limit which users can be impersonated by other users, for example super admin permissions cannot be impersonated by others, add canBeImpersonated() to the User model.

/**
* @return bool
*/
public function canBeImpersonated() : bool
{
    // example usage with laratrust package
    return $this->hasRole([
        'merchant', 'other-role' 
    ]);
}

Disclaimer

This package can pose a serious security issue if used incorrectly, as anybody will be able to take control of any user's account.

By using this package, you agree that Octopy ID and the contributors of this package cannot be held responsible for any damages caused by using this package.

Security

If you discover any security related issues, please email [email protected] or [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].