PHPackages                             zofe/auth-module - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. zofe/auth-module

ActiveRapyd-module[Authentication &amp; Authorization](/categories/authentication)

zofe/auth-module
================

auth module for rapyd-livewire application

0.12.15(1y ago)15872mitPHPPHP ^8.2

Since Feb 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/zofe/auth-module)[ Packagist](https://packagist.org/packages/zofe/auth-module)[ RSS](/packages/zofe-auth-module/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (51)Used By (2)

Rapyd Admin - Auth Module
=========================

[](#rapyd-admin---auth-module)

This is the auth module of [Rapyd Admin](https://github.com/zofe/rapyd-admin), a Laravel application bootstrap for your projects

It embed:

- login, registration, two factor authentication
- role/permission management
- user management
- impersonation features.
- component permissions, and priority "role based"

Login / Registration &amp; Two factor authentication
====================================================

[](#login--registration--two-factor-authentication)

This module give you out of the box a fortify implementation with a bootstrap layout and default configuration you can customize on ./config/fortify.php

Permissions &amp; Models
========================

[](#permissions--models)

Two Models will be provided by this module:

- Role
- Permission

As you can imagine the role is a characteristic you can associate with a user, permissions are the "actions granted" for that role.

The module has a configuration file that allows you to define roles, permissions, and the relationship between them.

The editable configuration is provided in ./config/permission.php Then you need to run the provided seeder.

these features are based on the library:

Impersonation
=============

[](#impersonation)

One of the necessary features in the implementation of a backend is to impersonate other users/customers, this module has this functionality built in

This module include a trait `App\Modules\Auth\Traits\Impersonate` to check roles if user can impersonate other and to check if user can be impersonated.

By default, this trait add check if You are admin and the user you want to impersonate is not an admin (using roles).

for a custom implementation override `canImpersonate()` and `canBeImpersonated()` in your model

```
use App\Modules\Auth\Traits\Impersonate;

class User extends Model
{
  use Impersonate;
```

this features is based on the library

Component roles &amp; permissions
=================================

[](#component-roles--permissions)

Authorize trait
---------------

[](#authorize-trait)

This module include a trait `App\Modules\Auth\Traits\Authorize` to check roles or permissions before build/render/execute component actions.

you can just include the trait, then add authorize check at booted time in your components:

```
use App\Modules\Auth\Traits\Authorize;

class CompaniesEdit extends Component
{
    use Authorize;

    public function booted()
    {
        $this->authorize('admin|edit users');
    }
```

this will check if one of role or permission is applied to the logged-in user, otherwise it gives a permission error.

Limit trait
-----------

[](#limit-trait)

This module include a trait `App\Modules\Auth\Traits\Limit` to add global scopes in your application, specific for role you need to jailroot eloquent models to specific query scopes.

```
