Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

[4.x] Custom Middleware to contain auth features #207

Closed
wants to merge 33 commits into from

Conversation

ReeceM
Copy link
Collaborator

@ReeceM ReeceM commented May 21, 2022

This PR should help improve the management of Auth for the package when accessing details.

Description

The changes made is the creation of a new middleware called Authenticate. This is then added into the middleware config so it is loaded in the service provider.

It also adds the added functionality of having a method defined on the User::class model to have a manageMailables method where a person can define if that specific user has access to the Mailable editor.

It also has the change that it checks if the system is running in the console and then doesn't load up the environment check.

Related Issue

#184 #114

Motivation and Context

This adds a central place to manage the authentication for the MailEclipse package. It also allows users to override the functionality if need be.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Comment on lines +33 to +37
if (method_exists($request->user(), 'manageMailables')) {
$request->user()->manageMailables() ?: throw new UnauthorizedException();
}

return $next($request);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should just fail if the method isn't defined? Or allow it to pass if the environment is allowed?

ReeceM and others added 21 commits June 23, 2022 22:10
Bumps [socket.io-parser](https://github.com/socketio/socket.io-parser) to 4.2.1 and updates ancestor dependency [browser-sync](https://github.com/BrowserSync/browser-sync). These dependencies need to be updated together.


Updates `socket.io-parser` from 3.2.0 to 4.2.1
- [Release notes](https://github.com/socketio/socket.io-parser/releases)
- [Changelog](https://github.com/socketio/socket.io-parser/blob/main/CHANGELOG.md)
- [Commits](socketio/socket.io-parser@3.2.0...4.2.1)

Updates `browser-sync` from 2.26.3 to 2.27.10
- [Release notes](https://github.com/BrowserSync/browser-sync/releases)
- [Changelog](https://github.com/BrowserSync/browser-sync/blob/master/CHANGELOG.md)
- [Commits](BrowserSync/browser-sync@v2.26.3...v2.27.10)

---
updated-dependencies:
- dependency-name: socket.io-parser
  dependency-type: indirect
- dependency-name: browser-sync
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
fix: compatible way to call the method on mailable
Bumps [engine.io](https://github.com/socketio/engine.io) to 6.2.1 and updates ancestor dependency [browser-sync](https://github.com/BrowserSync/browser-sync). These dependencies need to be updated together.


Updates `engine.io` from 3.2.1 to 6.2.1
- [Release notes](https://github.com/socketio/engine.io/releases)
- [Changelog](https://github.com/socketio/engine.io/blob/main/CHANGELOG.md)
- [Commits](socketio/engine.io@3.2.1...6.2.1)

Updates `browser-sync` from 2.26.3 to 2.27.10
- [Release notes](https://github.com/BrowserSync/browser-sync/releases)
- [Changelog](https://github.com/BrowserSync/browser-sync/blob/master/CHANGELOG.md)
- [Commits](BrowserSync/browser-sync@v2.26.3...v2.27.10)

---
updated-dependencies:
- dependency-name: engine.io
  dependency-type: indirect
- dependency-name: browser-sync
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
…io-and-browser-sync-6.2.1

Bump engine.io and browser-sync
…io-parser-and-browser-sync-4.2.1

Bump socket.io-parser and browser-sync
Lines variable needs to be array and not integer for loadNamespaceOverrides method.
Update the deps to use laravel 10
@xicond
Copy link

xicond commented Dec 23, 2023

Any update ?

@ReeceM
Copy link
Collaborator Author

ReeceM commented Dec 24, 2023

@xicond is this something that you would like to use on the package?

@xicond
Copy link

xicond commented Dec 30, 2023

@ReeceM I want to avoid error on artisan route:list when environment not exists in config

@ReeceM
Copy link
Collaborator Author

ReeceM commented Dec 30, 2023

Hi There, I'll have a look tonight. Given some what the update for L10 as well I'll bundle the two together.

@ReeceM ReeceM marked this pull request as ready for review December 31, 2023 15:19
@Qoraiche Qoraiche closed this Jun 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants