PHP Класс Cartalyst\Sentinel\Sentinel

Наследование: use trait Cartalyst\Support\Traits\EventTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface The Activations repository.
$basicResponse Closure The closure used to create a basic response for failed HTTP auth.
$checkpoints array Array that holds all the enabled checkpoints.
$checkpointsStatus boolean Flag for the checkpoint status.
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface The Persistence repository.
$reminders Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface The Reminders repository.
$requestCredentials Closure The closure to retrieve the request credentials.
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface The Role repository.
$throttle Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface The Throttle repository.
$user Cartalyst\Sentinel\Users\UserInterface The current cached, logged in user.
$userMethods array Cached, available methods on the user repository, used for dynamic calls.
$users Cartalyst\Sentinel\Users\UserRepositoryInterface The User repository.

Открытые методы

Метод Описание
__call ( string $method, array $parameters ) : mixed Dynamically pass missing methods to Sentinel.
__construct ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences, Cartalyst\Sentinel\Users\UserRepositoryInterface $users, Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles, Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations, Illuminate\Events\Dispatcher $dispatcher ) : void Create a new Sentinel instance.
activate ( mixed $user ) : boolean Activates the given user.
addCheckpoint ( string $key, Cartalyst\Sentinel\Checkpoints\CheckpointInterface $checkpoint ) : void Add a new checkpoint to Sentinel.
authenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false, boolean $login = true ) : Cartalyst\Sentinel\Users\UserInterface | boolean Authenticates a user, with "remember" flag.
authenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Authenticates a user, with the "remember" flag.
basic ( ) : mixed Attempt to authenticate using HTTP Basic Auth.
bypassCheckpoints ( Closure $callback, array $checkpoints = [] ) : mixed Pass a closure to Sentinel to bypass checkpoints.
check ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean Checks to see if a user is logged in.
checkpointsStatus ( ) : boolean Checks if checkpoints are enabled.
creatingBasicResponse ( Closure $basicResponse ) : void Sets the callback which creates a basic response.
disableCheckpoints ( ) : void Disables checkpoints.
enableCheckpoints ( ) : void Enables checkpoints.
forceAuthenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean Forces an authentication to bypass checkpoints.
forceAuthenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Forces an authentication to bypass checkpoints, with the "remember" flag.
forceCheck ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean Checks to see if a user is logged in, bypassing checkpoints
getActivationRepository ( ) : Cartalyst\Sentinel\Activations\ActivationRepositoryInterface Returns the activations repository.
getBasicResponse ( ) : mixed Sends a response when HTTP basic authentication fails.
getPersistenceRepository ( ) : Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface Returns the persistences repository.
getReminderRepository ( ) : Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface Returns the reminders repository.
getRequestCredentials ( ) : array Returns the request credentials.
getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface Returns the role repository.
getThrottleRepository ( ) : Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface Returns the throttle repository.
getUser ( boolean $check = true ) : Cartalyst\Sentinel\Users\UserInterface Returns the currently logged in user, lazily checking for it.
getUserRepository ( ) : Cartalyst\Sentinel\Users\UserRepositoryInterface Returns the user repository.
guest ( ) : boolean Checks if we are currently a guest.
login ( Cartalyst\Sentinel\Users\UserInterface $user, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean Persists a login for the given user.
loginAndRemember ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean Persists a login for the given user, with the "remember" flag.
logout ( Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $everywhere = false ) : boolean Logs the current user out.
register ( array $credentials, Closure | boolean $callback = null ) : Cartalyst\Sentinel\Users\UserInteface | boolean Registers a user. You may provide a callback to occur before the user is saved, or provide a true boolean as a shortcut to activation.
registerAndActivate ( array $credentials ) : Cartalyst\Sentinel\Users\UserInteface | boolean Registers and activates the user.
removeCheckpoint ( string $key ) : void Removes a checkpoint.
removeCheckpoints ( array $checkpoints = [] ) : void Removes the given checkpoints.
setActivationRepository ( Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations ) : void Sets the activations repository.
setPersistenceRepository ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences ) : void Sets the persistences repository.
setReminderRepository ( Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders ) : void Sets the reminders repository.
setRequestCredentials ( Closure $requestCredentials ) : void Sets the closure which resolves the request credentials.
setRoleRepository ( Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles ) : void Sets the role repository.
setThrottleRepository ( Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle ) : void Sets the throttle repository.
setUser ( Cartalyst\Sentinel\Users\UserInterface $user ) : void Sets the user associated with Sentinel (does not log in).
setUserRepository ( Cartalyst\Sentinel\Users\UserRepositoryInterface $users ) : void Sets the user repository.
stateless ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean Attempt a stateless authentication.

Защищенные методы

Метод Описание
cycleCheckpoints ( string $method, Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $halt = true ) : boolean Cycles through all the registered checkpoints for a user. Checkpoints may throw their own exceptions, however, if just one returns false, the cycle fails.
getUserMethods ( ) : array Returns all accessible methods on the associated user repository.

Описание методов

__call() публичный Метод

Dynamically pass missing methods to Sentinel.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
Результат mixed

__construct() публичный Метод

Create a new Sentinel instance.
public __construct ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences, Cartalyst\Sentinel\Users\UserRepositoryInterface $users, Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles, Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations, Illuminate\Events\Dispatcher $dispatcher ) : void
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
$users Cartalyst\Sentinel\Users\UserRepositoryInterface
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
$dispatcher Illuminate\Events\Dispatcher
Результат void

activate() публичный Метод

Activates the given user.
public activate ( mixed $user ) : boolean
$user mixed
Результат boolean

addCheckpoint() публичный Метод

Add a new checkpoint to Sentinel.
public addCheckpoint ( string $key, Cartalyst\Sentinel\Checkpoints\CheckpointInterface $checkpoint ) : void
$key string
$checkpoint Cartalyst\Sentinel\Checkpoints\CheckpointInterface
Результат void

authenticate() публичный Метод

Authenticates a user, with "remember" flag.
public authenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false, boolean $login = true ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
$remember boolean
$login boolean
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

authenticateAndRemember() публичный Метод

Authenticates a user, with the "remember" flag.
public authenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

basic() публичный Метод

Attempt to authenticate using HTTP Basic Auth.
public basic ( ) : mixed
Результат mixed

bypassCheckpoints() публичный Метод

Pass a closure to Sentinel to bypass checkpoints.
public bypassCheckpoints ( Closure $callback, array $checkpoints = [] ) : mixed
$callback Closure
$checkpoints array
Результат mixed

check() публичный Метод

Checks to see if a user is logged in.
public check ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

checkpointsStatus() публичный Метод

Checks if checkpoints are enabled.
public checkpointsStatus ( ) : boolean
Результат boolean

creatingBasicResponse() публичный Метод

Sets the callback which creates a basic response.
public creatingBasicResponse ( Closure $basicResponse ) : void
$basicResponse Closure
Результат void

cycleCheckpoints() защищенный Метод

Cycles through all the registered checkpoints for a user. Checkpoints may throw their own exceptions, however, if just one returns false, the cycle fails.
protected cycleCheckpoints ( string $method, Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $halt = true ) : boolean
$method string
$user Cartalyst\Sentinel\Users\UserInterface
$halt boolean
Результат boolean

disableCheckpoints() публичный Метод

Disables checkpoints.
public disableCheckpoints ( ) : void
Результат void

enableCheckpoints() публичный Метод

Enables checkpoints.
public enableCheckpoints ( ) : void
Результат void

forceAuthenticate() публичный Метод

Forces an authentication to bypass checkpoints.
public forceAuthenticate ( Cartalyst\Sentinel\Users\UserInterface | array $credentials, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
$remember boolean
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

forceAuthenticateAndRemember() публичный Метод

Forces an authentication to bypass checkpoints, with the "remember" flag.
public forceAuthenticateAndRemember ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

forceCheck() публичный Метод

Checks to see if a user is logged in, bypassing checkpoints
public forceCheck ( ) : Cartalyst\Sentinel\Users\UserInterface | boolean
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

getActivationRepository() публичный Метод

Returns the activations repository.
public getActivationRepository ( ) : Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
Результат Cartalyst\Sentinel\Activations\ActivationRepositoryInterface

getBasicResponse() публичный Метод

Sends a response when HTTP basic authentication fails.
public getBasicResponse ( ) : mixed
Результат mixed

getPersistenceRepository() публичный Метод

Returns the persistences repository.
public getPersistenceRepository ( ) : Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
Результат Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface

getReminderRepository() публичный Метод

Returns the reminders repository.
public getReminderRepository ( ) : Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface
Результат Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface

getRequestCredentials() публичный Метод

Returns the request credentials.
public getRequestCredentials ( ) : array
Результат array

getRoleRepository() публичный Метод

Returns the role repository.
public getRoleRepository ( ) : Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Результат Cartalyst\Sentinel\Roles\RoleRepositoryInterface

getThrottleRepository() публичный Метод

Returns the throttle repository.
public getThrottleRepository ( ) : Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface
Результат Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface

getUser() публичный Метод

Returns the currently logged in user, lazily checking for it.
public getUser ( boolean $check = true ) : Cartalyst\Sentinel\Users\UserInterface
$check boolean
Результат Cartalyst\Sentinel\Users\UserInterface

getUserMethods() защищенный Метод

Returns all accessible methods on the associated user repository.
protected getUserMethods ( ) : array
Результат array

getUserRepository() публичный Метод

Returns the user repository.
public getUserRepository ( ) : Cartalyst\Sentinel\Users\UserRepositoryInterface
Результат Cartalyst\Sentinel\Users\UserRepositoryInterface

guest() публичный Метод

Checks if we are currently a guest.
public guest ( ) : boolean
Результат boolean

login() публичный Метод

Persists a login for the given user.
public login ( Cartalyst\Sentinel\Users\UserInterface $user, boolean $remember = false ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
$remember boolean
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

loginAndRemember() публичный Метод

Persists a login for the given user, with the "remember" flag.
public loginAndRemember ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

logout() публичный Метод

Logs the current user out.
public logout ( Cartalyst\Sentinel\Users\UserInterface $user = null, boolean $everywhere = false ) : boolean
$user Cartalyst\Sentinel\Users\UserInterface
$everywhere boolean
Результат boolean

register() публичный Метод

Registers a user. You may provide a callback to occur before the user is saved, or provide a true boolean as a shortcut to activation.
public register ( array $credentials, Closure | boolean $callback = null ) : Cartalyst\Sentinel\Users\UserInteface | boolean
$credentials array
$callback Closure | boolean
Результат Cartalyst\Sentinel\Users\UserInteface | boolean

registerAndActivate() публичный Метод

Registers and activates the user.
public registerAndActivate ( array $credentials ) : Cartalyst\Sentinel\Users\UserInteface | boolean
$credentials array
Результат Cartalyst\Sentinel\Users\UserInteface | boolean

removeCheckpoint() публичный Метод

Removes a checkpoint.
public removeCheckpoint ( string $key ) : void
$key string
Результат void

removeCheckpoints() публичный Метод

Removes the given checkpoints.
public removeCheckpoints ( array $checkpoints = [] ) : void
$checkpoints array
Результат void

setActivationRepository() публичный Метод

Sets the activations repository.
public setActivationRepository ( Cartalyst\Sentinel\Activations\ActivationRepositoryInterface $activations ) : void
$activations Cartalyst\Sentinel\Activations\ActivationRepositoryInterface
Результат void

setPersistenceRepository() публичный Метод

Sets the persistences repository.
public setPersistenceRepository ( Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface $persistences ) : void
$persistences Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface
Результат void

setReminderRepository() публичный Метод

Sets the reminders repository.
public setReminderRepository ( Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface $reminders ) : void
$reminders Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface
Результат void

setRequestCredentials() публичный Метод

Sets the closure which resolves the request credentials.
public setRequestCredentials ( Closure $requestCredentials ) : void
$requestCredentials Closure
Результат void

setRoleRepository() публичный Метод

Sets the role repository.
public setRoleRepository ( Cartalyst\Sentinel\Roles\RoleRepositoryInterface $roles ) : void
$roles Cartalyst\Sentinel\Roles\RoleRepositoryInterface
Результат void

setThrottleRepository() публичный Метод

Sets the throttle repository.
public setThrottleRepository ( Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface $throttle ) : void
$throttle Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface
Результат void

setUser() публичный Метод

Sets the user associated with Sentinel (does not log in).
public setUser ( Cartalyst\Sentinel\Users\UserInterface $user ) : void
$user Cartalyst\Sentinel\Users\UserInterface
Результат void

setUserRepository() публичный Метод

Sets the user repository.
public setUserRepository ( Cartalyst\Sentinel\Users\UserRepositoryInterface $users ) : void
$users Cartalyst\Sentinel\Users\UserRepositoryInterface
Результат void

stateless() публичный Метод

Attempt a stateless authentication.
public stateless ( Cartalyst\Sentinel\Users\UserInterface | array $credentials ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$credentials Cartalyst\Sentinel\Users\UserInterface | array
Результат Cartalyst\Sentinel\Users\UserInterface | boolean

Описание свойств

$activations защищенное свойство

The Activations repository.
protected ActivationRepositoryInterface,Cartalyst\Sentinel\Activations $activations
Результат Cartalyst\Sentinel\Activations\ActivationRepositoryInterface

$basicResponse защищенное свойство

The closure used to create a basic response for failed HTTP auth.
protected Closure $basicResponse
Результат Closure

$checkpoints защищенное свойство

Array that holds all the enabled checkpoints.
protected array $checkpoints
Результат array

$checkpointsStatus защищенное свойство

Flag for the checkpoint status.
protected bool $checkpointsStatus
Результат boolean

$persistences защищенное свойство

The Persistence repository.
protected PersistenceRepositoryInterface,Cartalyst\Sentinel\Persistences $persistences
Результат Cartalyst\Sentinel\Persistences\PersistenceRepositoryInterface

$reminders защищенное свойство

The Reminders repository.
protected ReminderRepositoryInterface,Cartalyst\Sentinel\Reminders $reminders
Результат Cartalyst\Sentinel\Reminders\ReminderRepositoryInterface

$requestCredentials защищенное свойство

The closure to retrieve the request credentials.
protected Closure $requestCredentials
Результат Closure

$roles защищенное свойство

The Role repository.
protected RoleRepositoryInterface,Cartalyst\Sentinel\Roles $roles
Результат Cartalyst\Sentinel\Roles\RoleRepositoryInterface

$throttle защищенное свойство

The Throttle repository.
protected ThrottleRepositoryInterface,Cartalyst\Sentinel\Throttling $throttle
Результат Cartalyst\Sentinel\Throttling\ThrottleRepositoryInterface

$user защищенное свойство

The current cached, logged in user.
protected UserInterface,Cartalyst\Sentinel\Users $user
Результат Cartalyst\Sentinel\Users\UserInterface

$userMethods защищенное свойство

Cached, available methods on the user repository, used for dynamic calls.
protected array $userMethods
Результат array

$users защищенное свойство

The User repository.
protected UserRepositoryInterface,Cartalyst\Sentinel\Users $users
Результат Cartalyst\Sentinel\Users\UserRepositoryInterface