Bristol SU Support Package
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser Class Reference

Public Member Functions

 __construct (UserAuthentication $userAuthentication, Authentication $authentication)
 
 handle (Request $request, \Closure $next)
 

Private Member Functions

 hasUsers ()
 
 usersAreEqual ()
 

Private Attributes

 $userAuthentication
 
 $authentication
 

Detailed Description

Check the database user, if logged in, owns the control user, if logged in

Definition at line 16 of file CheckDatabaseUserOwnsControlUser.php.

Constructor & Destructor Documentation

◆ __construct()

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::__construct ( UserAuthentication  $userAuthentication,
Authentication  $authentication 
)

Initialise the middleware

Parameters
UserAuthentication$userAuthenticationDatabase user resolver
Authentication$authenticationControl user resolver

Definition at line 39 of file CheckDatabaseUserOwnsControlUser.php.

References BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser\$authentication, and BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser\$userAuthentication.

Member Function Documentation

◆ handle()

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::handle ( Request  $request,
\Closure  $next 
)

Throw an error if the logged in user is not owned by the logged in database user

Parameters
Request$requestThe request object
\Closure$nextThe next middleware in the pipeline
Returns
mixed
Exceptions
IncorrectLogin

Definition at line 53 of file CheckDatabaseUserOwnsControlUser.php.

References BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser\hasUsers(), and BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser\usersAreEqual().

◆ hasUsers()

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::hasUsers ( )
private

Check if the authentication and the User Authentication have the users to check.

Returns
bool

Definition at line 67 of file CheckDatabaseUserOwnsControlUser.php.

Referenced by BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser\handle().

◆ usersAreEqual()

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::usersAreEqual ( )
private

Member Data Documentation

◆ $authentication

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::$authentication
private

◆ $userAuthentication

BristolSU\Support\Authorization\Middleware\CheckDatabaseUserOwnsControlUser::$userAuthentication
private

The documentation for this class was generated from the following file: