Skip to content

Commit

Permalink
feat(pencil): add Bouncer authentication option
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickcurl committed Sep 4, 2022
1 parent cec9d9c commit 89a3787
Show file tree
Hide file tree
Showing 32 changed files with 424 additions and 673 deletions.
18 changes: 1 addition & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [2.2.0](https://github.com/phpsa/filament-authentication/compare/v2.1.2...v2.2.0) (2022-08-11)

# [2.2.0](https://github.com/phpsa/filament-authentication/compare/v2.1.2...v2.2.0) (2022-08-11)

### Features

Expand All @@ -13,107 +13,91 @@

## [2.1.2](https://github.com/phpsa/filament-authentication/compare/v2.1.1...v2.1.2) (2022-06-16)


### Bug Fixes

* tableActions removed ([91b1526](https://github.com/phpsa/filament-authentication/commit/91b152674ef6f7a0b1d658d5efc40bd08546cd61))

## [2.1.1](https://github.com/phpsa/filament-authentication/compare/v2.1.0...v2.1.1) (2022-06-06)


### Bug Fixes

* added ability to set sort order of the LatestUsers widget ([7198cff](https://github.com/phpsa/filament-authentication/commit/7198cfffbc37e788f46cde363709cf2d91332bc1))

# [2.1.0](https://github.com/phpsa/filament-authentication/compare/v2.0.0...v2.1.0) (2022-06-02)


### Bug Fixes

* mount not static ([3b9e4cc](https://github.com/phpsa/filament-authentication/commit/3b9e4cc0fe9ca259135b5eee15ebfdccbe05d22e))
* use Terniary Filter ([9d9a07a](https://github.com/phpsa/filament-authentication/commit/9d9a07ad9672739c96b3128bc80649614536e824))
* use user name by default on edit ([b3d4a90](https://github.com/phpsa/filament-authentication/commit/b3d4a90356622901ff71bf3c95381fe9df07fc8b))


### Features

* added event triggers for create and update ([59dd8ef](https://github.com/phpsa/filament-authentication/commit/59dd8ef6f62591b2e6a8f89e425e5f54e340df71))

# [2.1.0-beta.2](https://github.com/phpsa/filament-authentication/compare/v2.1.0-beta.1...v2.1.0-beta.2) (2022-05-31)


### Bug Fixes

* use Terniary Filter ([9d9a07a](https://github.com/phpsa/filament-authentication/commit/9d9a07ad9672739c96b3128bc80649614536e824))
* use user name by default on edit ([b3d4a90](https://github.com/phpsa/filament-authentication/commit/b3d4a90356622901ff71bf3c95381fe9df07fc8b))

# [2.1.0-beta.1](https://github.com/phpsa/filament-authentication/compare/v2.0.0...v2.1.0-beta.1) (2022-05-30)


### Bug Fixes

* mount not static ([3b9e4cc](https://github.com/phpsa/filament-authentication/commit/3b9e4cc0fe9ca259135b5eee15ebfdccbe05d22e))


### Features

* added event triggers for create and update ([59dd8ef](https://github.com/phpsa/filament-authentication/commit/59dd8ef6f62591b2e6a8f89e425e5f54e340df71))

# [2.0.0](https://github.com/phpsa/filament-authentication/compare/v1.1.2...v2.0.0) (2022-05-27)


### Bug Fixes

* use Filament::makeTableAction for table action ([864610a](https://github.com/phpsa/filament-authentication/commit/864610acaf9d05498d4c430c51deb50027bc1fc1))


### Features

* Timezone display set to use Filament Core system ([f5d5507](https://github.com/phpsa/filament-authentication/commit/f5d550710ff63b018c660a6b5be3262de469318b))


### BREAKING CHANGES

* Visual display of dates will need to be updated

## [1.1.2](https://github.com/phpsa/filament-authentication/compare/v1.1.1...v1.1.2) (2022-05-06)


### Bug Fixes

* spelling issue in config file ([4160da9](https://github.com/phpsa/filament-authentication/commit/4160da954fa0163653560abd3824904a8a426d06))

## [1.1.1](https://github.com/phpsa/filament-authentication/compare/v1.1.0...v1.1.1) (2022-05-03)


### Bug Fixes

* code quality updates ([ce9c8d1](https://github.com/phpsa/filament-authentication/commit/ce9c8d113ab1c3769d63b59b544813bb107c2f1c))
* user Widget laravel 8 compatability ([f9dd25f](https://github.com/phpsa/filament-authentication/commit/f9dd25f5eff7d110367cf61c666752b49ba60c20))

# [1.1.0](https://github.com/phpsa/filament-authentication/compare/v1.0.1...v1.1.0) (2022-04-23)


### Features

* allow enable / disable / config of user widget ([74329cb](https://github.com/phpsa/filament-authentication/commit/74329cb4ff4db269796a9bb8750f8d39a9452dfa))
* User Impersonation ([fb30d9e](https://github.com/phpsa/filament-authentication/commit/fb30d9e2b47d5a8f04a5ac12fa22782b51c0556e))

## [1.0.1](https://github.com/phpsa/filament-authentication/compare/v1.0.0...v1.0.1) (2022-04-22)


### Bug Fixes

* set page resources to use config value for resource ([f239ca9](https://github.com/phpsa/filament-authentication/commit/f239ca9ab732895147e1cc606780870ce8bf58df))

# 1.0.0 (2022-04-20)


### Bug Fixes

* remove pagination on widget ([b8a5e99](https://github.com/phpsa/filament-authentication/commit/b8a5e9947d666715c8f82637d6b363bdbfacfca4))


### Features

* Initial Commit ([a5b7299](https://github.com/phpsa/filament-authentication/commit/a5b72991624e1049369c3ff453c14449aa391885))
56 changes: 34 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
[![Latest Version on Packagist](https://img.shields.io/packagist/v/phpsa/filament-authentication.svg?style=flat-square)](https://packagist.org/packages/phpsa/filament-authentication)
[![Semantic Release](https://github.com/phpsa/filament-authentication/actions/workflows/release.yml/badge.svg)](https://github.com/phpsa/filament-authentication/actions/workflows/release.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/phpsa/filament-authentication.svg?style=flat-square)](https://packagist.org/packages/phpsa/filament-authentication)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/zvive/filament-auth.svg?style=flat-square)](https://packagist.org/packages/zvive/filament-auth)
[![Semantic Release](https://github.com/zvive/filament-auth/actions/workflows/release.yml/badge.svg)](https://github.com/zvive/filament-auth/actions/workflows/release.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/zvive/filament-auth.svg?style=flat-square)](https://packagist.org/packages/zvive/filament-auth)

# Filament User Authentication

User Resource For Filament Admin along with Roles & Permissions using Spatie

## Installation


You can install the package via composer:

```bash
composer require phpsa/filament-authentication
composer require zvive/filament-auth
```

and now clear cache
Expand All @@ -22,18 +21,22 @@ php artisan optimize:clear
```

and publish config

```bash
php artisan vendor:publish --tag=filament-authentication-config
php artisan vendor:publish --tag=filament-auth-config
```

and optionally views / translations

```bash
artisan vendor:publish --tag=filament-authentication-views
artisan vendor:publish --tag=filament-authentication-translations
artisan vendor:publish --tag=filament-auth-views
artisan vendor:publish --tag=filament-auth-translations
```

## Additional Resources:
## Additional Resources

### Spatie Roles & Permissions

If you have not yet configured this package it is automatically added by this installer, run the following steps:

1. You should publish the migration and the config/permission.php config file with:
Expand All @@ -47,18 +50,21 @@ php artisan migrate

3. Add Roles & Permissions as required

For more see: https://spatie.be/docs/laravel-permission/v5/introduction
For more see: <https://spatie.be/docs/laravel-permission/v5/introduction>

### Bouncer Roles / Permissions

Implemented, but docs coming soon.

### Laravel Impersonate

If you have not configured this package it is automatically added by this install, run the following steps:

1. Add the trait `Lab404\Impersonate\Models\Impersonate` to your User model.
2. Setup your permissions: https://github.com/404labfr/laravel-impersonate#defining-impersonation-authorization

2. Setup your permissions: <https://github.com/404labfr/laravel-impersonate#defining-impersonation-authorization>

## Security

Roles & Permissions can be secured using Laravel Policies,
create your policies and register then in the AuthServiceProvider

Expand All @@ -72,11 +78,13 @@ create your policies and register then in the AuthServiceProvider
];
```

We have a Custom Page Trait: `Phpsa\FilamentAuthentication\Traits\PagePolicyTrait` and a Spatie Settings Page Trait `Phpsa\FilamentAuthentication\Traits\SettingsPage\PolicyTrait` that you can add to your pages / settings pages.
We have a Custom Page Trait: `FilamentAuth\Traits\PagePolicyTrait` and a Spatie Settings Page Trait `FilamentAuth\Traits\SettingsPage\PolicyTrait` that you can add to your pages / settings pages.
By defining a model and mapping it with a `viewAny($user)` method you can define per policies whether or not to show the page in navigation.

## Widgets
`LatestUsersWidget` is by default published to your dashboard, this can be configured / disabled by editing the config in the filament-authentication config file:

`LatestUsersWidget` is by default published to your dashboard, this can be configured / disabled by editing the config in the filament-auth config file:

```php
'Widgets' => [
'LatesetUsers' => [
Expand All @@ -91,35 +99,39 @@ Note that it is also attached to the UserPolicy::viewAny policy value if the pol
--It is planned to update the enabled to accept a callback function to allow for roles etc in the next version--

## Profile

Profile view for currently authed user

## Extending

Extend Profile:

```php
<?php

namespace App\Filament\Pages;

use Filament\Pages\Page;
use Phpsa\FilamentAuthentication\Pages\Profile as PagesProfile;
use FilamentAuth\Pages\Profile as PagesProfile;

class Profile extends PagesProfile
{}
```
or the view: `resources/views/vendor/filament-authentication/filament/pages/profile.blade.php` (you can publish existing one)

or the view: `resources/views/vendor/filament-auth/filament/pages/profile.blade.php` (you can publish existing one)

## Events

`Phpsa\FilamentAuthentication\Events\UserCreated` is triggered when a user is created via the Resource
`FilamentAuth\Events\UserCreated` is triggered when a user is created via the Resource

`FilamentAuth\Events\UserUpdated` is triggered when a user is updated via the Resource

`Phpsa\FilamentAuthentication\Events\UserUpdated` is triggered when a user is updated via the Resource
## Intergration with other packages

## Intergration with other packages:
** Comming soon **
**Comming soon**

- https://filamentphp.com/plugins/socialite
- https://filamentphp.com/plugins/2fa
- <https://filamentphp.com/plugins/socialite>
- <https://filamentphp.com/plugins/2fa>

## Changelog

Expand Down
24 changes: 15 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phpsa/filament-authentication",
"description": "User & Role (via Spatie Roles/Permissions) Manager Resource For Filament Admin",
"name": "zvive/filament-auth",
"description": "User & Role (via Spatie Roles/Permissions) Manager Resource For Filament Admin, forked from forked from phpsa/filament-authentication - added Bouncer as an option for permissions as well.",
"keywords": [
"laravel",
"user",
Expand All @@ -9,17 +9,20 @@
"ui",
"filament"
],
"homepage": "https://cgs4k.nz",
"homepage": "https://zvive.com",
"license": "MIT",
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Phpsa\\FilamentAuthentication\\": "src/"
"FilamentAuth\\": "src/"
}
},
"authors": [
{
"name": "Craig G Smith",
"email": "vxdhost@gmail.com"
"name": "Patrick Curl",
"email": "patrickwcurl@gmail.com"
}
],
"minimum-stability": "dev",
Expand All @@ -28,17 +31,20 @@
"filament/filament": "^2.12.18",
"lab404/laravel-impersonate": "^1.7",
"spatie/laravel-package-tools": "^1.10",
"spatie/laravel-permission": "^5.4"
"laravel/framework": "^9.0"
},
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Phpsa\\FilamentAuthentication\\FilamentAuthenticationProvider"
"FilamentAuth\\FilamentAuthProvider"
]
}
},
"prefer-stable": true
"prefer-stable": true,
"require-dev": {
"zvive/fixer": "^9.0"
}
}
30 changes: 0 additions & 30 deletions config/filament-authentication.php

This file was deleted.

52 changes: 0 additions & 52 deletions resources/lang/en/filament-authentication.php

This file was deleted.

Loading

0 comments on commit 89a3787

Please sign in to comment.