Bristol SU Support Package
CheckModuleInstanceActive.php
Go to the documentation of this file.
1 <?php
2 
4 
9 
14 {
15 
21  private $authentication;
22 
29  {
30  $this->authentication = $authentication;
31  }
32 
41  public function handle(Request $request, \Closure $next)
42  {
43  $moduleInstance = $request->route('module_instance_slug');
44  if (!LogicTester::evaluate($moduleInstance->activeLogic, $this->authentication->getUser(), $this->authentication->getGroup(), $this->authentication->getRole())) {
45  throw new ModuleInactive('The module instance is currently inactive', 403, null, $moduleInstance);
46  }
47 
48  return $next($request);
49  }
50 
51 }