Skip to content

Commit 8bf0dcc

Browse files
committed
Merge branch 'development'
2 parents 886fd7b + 916f2f9 commit 8bf0dcc

File tree

144 files changed

+2321
-1508
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+2321
-1508
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
5858
# Application
5959

6060
# Access
61+
ADMIN_REQUIRES_2FA=true
6162
CHANGE_EMAIL=false
6263
ENABLE_REGISTRATION=true
6364
PASSWORD_HISTORY=3

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,52 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [7.1.0] - 2020-07-07
7+
8+
This release completely changes the way the previous authentication system worked. I probably went through 5 different iterations of a multi auth/guard architecture, but it became too messy and there are too many variables when dealing with different user tables and multiple different sessions. The solution I came up with I think serves the same purpose without the complexities. There is a new `type` column on the users table that is a predefined list of user types that your system supports, and a middleware to lock parts down to different types. The roles and permissions also have a corresponding `type` column to organize what roles and permissions are available to what user types, and the backend will only let you choose from the correct ones. For example: Any user of type `admin` can access the admin area, but they cannot do anything without a corresponding role or permission to a given section. This will let you structure your applications better if the use multiple different user types that have access to different areas, without using different guards, all with one users table and one login form.
9+
10+
## Added
11+
12+
- Add user type check middleware
13+
- User accounts no longer require roles
14+
- The roles and permissions a user can have are now constrained by their type
15+
- Change isAdmin to hasAllAccess, because isAdmin now repurposed to check type
16+
- Update UserService to reflect type, no longer assign default role to users
17+
- Delete view backend permission as all users of admin type can view the backend.
18+
- Add type column to user/role tables
19+
- Update the global gate to check hasAllAccess instead of isAdmin, since now an admin may not have all access
20+
- Remove redirect and default user role from boilerplate config
21+
- Update factories and seeders
22+
- When creating a user from the backend, a new type dropdown is available, and will show the correct roles/permissions for that type to be able to choose from and validate on the backend
23+
- Update all old instances of isAdmin to hasAllAccess, and use new isAdmin where applicable
24+
- Frontend user dashboard now limited to user type
25+
- When creating/editing a role, only the permissions related to the type will be available to choose from
26+
- Add spatie/activitylog
27+
- Add events for roles and users
28+
- Add role event subscriber
29+
- Boolean for whether or not 2FA is required for admin
30+
- Added Terms & Conditions checkbox with validation to registration
31+
- Added dummy Terms & Conditions page
32+
- Added UUID trait back if needed
33+
- Added ability to only allow users to be assigned roles from the backend and not additional permissions
34+
35+
## Changed
36+
37+
- Change password histories to be polymorphic
38+
- Make alert banners shorter vertically
39+
- Refactor system to use user types to define who can view certain areas, then use roles and permissions from there to narrow down further.
40+
- Update all tests
41+
- Require 2FA to be enabled to access admin
42+
- Change 2FA restricted redirect to enable 2FA page
43+
- Automatically load roles and permissions for users and permissions for role models
44+
- Move user event namespace
45+
- Move HomeController out of auth domain
46+
- Change account tabs from vertical to normal because they respond better
47+
48+
## Removed
49+
50+
- Removed accountant package
51+
652
## [7.0.3] - 2020-07-01
753

854
## Changed

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Kernel extends ConsoleKernel
2727
*/
2828
protected function schedule(Schedule $schedule)
2929
{
30-
// $schedule->command('inspire')->hourly();
30+
// $schedule->command('activitylog:clean')->daily();
3131
}
3232

3333
/**

app/Domains/Announcement/Models/Announcement.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,23 @@
33
namespace App\Domains\Announcement\Models;
44

55
use App\Domains\Announcement\Models\Traits\Scope\AnnouncementScope;
6-
use App\Models\RecordingModel;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Spatie\Activitylog\Traits\LogsActivity;
78

89
/**
910
* Class Announcement.
1011
*/
11-
class Announcement extends RecordingModel
12+
class Announcement extends Model
1213
{
13-
use AnnouncementScope;
14+
use AnnouncementScope,
15+
LogsActivity;
1416

1517
public const TYPE_FRONTEND = 'frontend';
1618
public const TYPE_BACKEND = 'backend';
1719

20+
protected static $logFillable = true;
21+
protected static $logOnlyDirty = true;
22+
1823
/**
1924
* @var string[]
2025
*/
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\Role;
4+
5+
use App\Domains\Auth\Models\Role;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class RoleCreated.
10+
*/
11+
class RoleCreated
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $role;
19+
20+
/**
21+
* @param $role
22+
*/
23+
public function __construct(Role $role)
24+
{
25+
$this->role = $role;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\Role;
4+
5+
use App\Domains\Auth\Models\Role;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class RoleDeleted.
10+
*/
11+
class RoleDeleted
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $role;
19+
20+
/**
21+
* @param $role
22+
*/
23+
public function __construct(Role $role)
24+
{
25+
$this->role = $role;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\Role;
4+
5+
use App\Domains\Auth\Models\Role;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class RoleUpdated.
10+
*/
11+
class RoleUpdated
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $role;
19+
20+
/**
21+
* @param $role
22+
*/
23+
public function __construct(Role $role)
24+
{
25+
$this->role = $role;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\User;
4+
5+
use App\Domains\Auth\Models\User;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class UserCreated.
10+
*/
11+
class UserCreated
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $user;
19+
20+
/**
21+
* @param $user
22+
*/
23+
public function __construct(User $user)
24+
{
25+
$this->user = $user;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\User;
4+
5+
use App\Domains\Auth\Models\User;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class UserDeleted.
10+
*/
11+
class UserDeleted
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $user;
19+
20+
/**
21+
* @param $user
22+
*/
23+
public function __construct(User $user)
24+
{
25+
$this->user = $user;
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace App\Domains\Auth\Events\User;
4+
5+
use App\Domains\Auth\Models\User;
6+
use Illuminate\Queue\SerializesModels;
7+
8+
/**
9+
* Class UserDestroyed.
10+
*/
11+
class UserDestroyed
12+
{
13+
use SerializesModels;
14+
15+
/**
16+
* @var
17+
*/
18+
public $user;
19+
20+
/**
21+
* @param $user
22+
*/
23+
public function __construct(User $user)
24+
{
25+
$this->user = $user;
26+
}
27+
}

0 commit comments

Comments
 (0)