Drupal 8  8.0.2
AccessManager Class Reference
Inheritance diagram for AccessManager:

Public Member Functions

 __construct (RouteProviderInterface $route_provider, ParamConverterManagerInterface $paramconverter_manager, AccessArgumentsResolverFactoryInterface $arguments_resolver_factory, AccountInterface $current_user, CheckProviderInterface $check_provider)
 
 checkNamedRoute ($route_name, array $parameters=array(), AccountInterface $account=NULL, $return_as_object=FALSE)
 
 checkRequest (Request $request, AccountInterface $account=NULL, $return_as_object=FALSE)
 
 check (RouteMatchInterface $route_match, AccountInterface $account=NULL, Request $request=NULL, $return_as_object=FALSE)
 

Protected Attributes

 $routeProvider
 
 $paramConverterManager
 
 $argumentsResolverFactory
 
 $currentUser
 
 $checkProvider
 

Detailed Description

Attaches access check services to routes and runs them on request.

See Also

Constructor & Destructor Documentation

__construct ( RouteProviderInterface  $route_provider,
ParamConverterManagerInterface  $paramconverter_manager,
AccessArgumentsResolverFactoryInterface  $arguments_resolver_factory,
AccountInterface  $current_user,
CheckProviderInterface  $check_provider 
)

Constructs a AccessManager instance.

Parameters
\Drupal\Core\Routing\RouteProviderInterface$route_providerThe route provider.
\Drupal\Core\ParamConverter\ParamConverterManagerInterface$paramconverter_managerThe param converter manager.
\Drupal\Core\Access\AccessArgumentsResolverFactoryInterface$arguments_resolver_factoryThe access arguments resolver.
\Drupal\Core\Session\AccountInterface$current_userThe current user.
CheckProviderInterface$check_provider

References Drupal\currentUser().

Here is the call graph for this function:

Member Function Documentation

check ( RouteMatchInterface  $route_match,
AccountInterface  $account = NULL,
Request  $request = NULL,
  $return_as_object = FALSE 
)

{Checks a route against applicable access check services.Determines whether the route is accessible or not.

Parameters
\Drupal\Core\Routing\RouteMatchInterface$route_matchThe route match.
\Drupal\Core\Session\AccountInterface$account(optional) Run access checks for this account. Defaults to the current user.
\Symfony\Component\HttpFoundation\Request$requestOptional, a request. Only supply this parameter when checking the incoming request, do not specify when checking routes on output.
bool$return_as_object(optional) Defaults to FALSE.
Returns
bool| The access result. Returns a boolean if $return_as_object is FALSE (this is the default) and otherwise an AccessResultInterface object. When a boolean is returned, the result of AccessInterface::isAllowed() is returned, i.e. TRUE means access is explicitly allowed, FALSE means access is either explicitly forbidden or "no opinion".
}

Implements AccessManagerInterface.

References AccessResult\allowed(), RouteMatchInterface\getRouteObject(), and AccessResult\neutral().

Referenced by AccessManager\checkNamedRoute(), and AccessManager\checkRequest().

Here is the call graph for this function:

Here is the caller graph for this function:

checkNamedRoute (   $route_name,
array  $parameters = array(),
AccountInterface  $account = NULL,
  $return_as_object = FALSE 
)

{Checks a named route with parameters against applicable access check services.Determines whether the route is accessible or not.

Parameters
string$route_nameThe route to check access to.
array$parametersOptional array of values to substitute into the route path pattern.
\Drupal\Core\Session\AccountInterface$account(optional) Run access checks for this account. Defaults to the current user.
bool$return_as_object(optional) Defaults to FALSE.
Returns
bool| The access result. Returns a boolean if $return_as_object is FALSE (this is the default) and otherwise an AccessResultInterface object. When a boolean is returned, the result of AccessInterface::isAllowed() is returned, i.e. TRUE means access is explicitly allowed, FALSE means access is either explicitly forbidden or "no opinion".
}

Implements AccessManagerInterface.

References AccessManager\check(), and AccessResult\forbidden().

Here is the call graph for this function:

checkRequest ( Request  $request,
AccountInterface  $account = NULL,
  $return_as_object = FALSE 
)

{Execute access checks against the incoming request.

Parameters
Request$requestThe incoming request.
\Drupal\Core\Session\AccountInterface$account(optional) Run access checks for this account. Defaults to the current user.
bool$return_as_object(optional) Defaults to FALSE.
Returns
bool| The access result. Returns a boolean if $return_as_object is FALSE (this is the default) and otherwise an AccessResultInterface object. When a boolean is returned, the result of AccessInterface::isAllowed() is returned, i.e. TRUE means access is explicitly allowed, FALSE means access is either explicitly forbidden or "no opinion".
}

Implements AccessManagerInterface.

References AccessManager\check(), and RouteMatch\createFromRequest().

Here is the call graph for this function:


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