/**
  * Authorize the table.
  *
  * @param FormBuilder $builder
  */
 public function authorize(FormBuilder $builder)
 {
     // Try the option first.
     $permission = $builder->getFormOption('permission');
     if ($permission === false) {
         return;
     }
     if (!env('INSTALLED')) {
         return;
     }
     if ($permission && !$this->authorizer->authorizeAny((array) $permission)) {
         abort(403);
     }
 }
 /**
  * Check the authorization of module access.
  *
  * @param  Request  $request
  * @param  \Closure $next
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle(Request $request, Closure $next)
 {
     if (in_array($request->path(), ['admin/login', 'admin/logout'])) {
         return $next($request);
     }
     if ($request->segment(1) == 'admin' && !$this->authorizer->authorize('anomaly.module.users::general.control_panel')) {
         abort(403);
     }
     $permission = array_get($this->route->getAction(), 'anomaly.module.users::permission');
     $redirect = array_get($this->route->getAction(), 'anomaly.module.users::redirect');
     $message = array_get($this->route->getAction(), 'anomaly.module.users::message');
     if ($permission && !$this->authorizer->authorizeAny((array) $permission)) {
         if ($message) {
             $this->messages->error($message);
         }
         if ($redirect) {
             return $this->redirect->to($redirect);
         }
         abort(403);
     }
     return $next($request);
 }