/**
  * Handle loading the dashboard widgets.
  *
  * @param DashboardBuilder $builder
  * @return array
  */
 public function handle(DashboardBuilder $builder)
 {
     $module = $this->modules->active();
     $builder->setWidgets(array_map(function (Extension $widget) {
         return $widget->getProvides();
     }, $this->extensions->search($module->getNamespace('widget.*'))->all()));
 }
Ejemplo n.º 2
0
 /**
  * Attempt to authenticate the credentials.
  *
  * @param array $credentials
  * @return bool|UserInterface
  */
 public function authenticate(array $credentials)
 {
     $authenticators = $this->extensions->search('anomaly.module.users::authenticator.*');
     /* @var AuthenticatorExtensionInterface $authenticator */
     foreach ($authenticators as $authenticator) {
         if ($user = $authenticator->authenticate($credentials) instanceof UserInterface) {
             return $user;
         }
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * Check authorization.
  *
  * @param UserInterface $user
  * @return bool|\Illuminate\Http\RedirectResponse|mixed|string
  */
 public function check(UserInterface $user = null)
 {
     $extensions = $this->extensions->search('anomaly.module.users::security_check.*');
     /* @var SecurityCheckInterface $extension */
     foreach ($extensions as $extension) {
         /**
          * If the security check does not return
          * false then we can assume it passed.
          */
         $response = $extension->check($user);
         if ($response === true) {
             continue;
         }
         $this->events->fire(new SecurityCheckHasFailed($extension));
         return $response;
     }
     return true;
 }
 /**
  * Return the modal for choosing a link type.
  *
  * @param ExtensionCollection $extensions
  * @param string              $menu
  * @return \Illuminate\View\View
  */
 public function choose(ExtensionCollection $extensions, $menu)
 {
     return view('module::ajax/choose_link_type', ['link_types' => $extensions->search('anomaly.module.navigation::link_type.*'), 'menu' => $menu]);
 }
Ejemplo n.º 5
0
 /**
  * Return an ajax modal to choose the type
  * of adapter to use for creating a new disk.
  *
  * @param ExtensionCollection $extensions
  * @return \Illuminate\View\View
  */
 public function choose(ExtensionCollection $extensions)
 {
     return view('module::ajax/choose_adapter', ['adapters' => $extensions->search('anomaly.module.files::adapter.*')->enabled()]);
 }
 /**
  * Get the default dashboard.
  *
  * @return DashboardInterface
  */
 public function getDefault()
 {
     $module = $this->modules->active();
     return $this->extensions->search($module->getNamespace('dashboard.*'))->first();
 }
 /**
  * Return the modal for choosing a widget.
  *
  * @param ExtensionCollection $extensions
  * @return \Illuminate\Contracts\View\View|mixed
  */
 public function choose(ExtensionCollection $extensions)
 {
     return $this->view->make('module::admin/widgets/choose', ['widgets' => $extensions->search('anomaly.module.dashboard::widget.*')]);
 }
Ejemplo n.º 8
0
 /**
  * Return the modal to select the type of block to create.
  *
  * @param ExtensionCollection $extensions
  * @return \Illuminate\View\View
  */
 public function choose(ExtensionCollection $extensions)
 {
     return view('module::admin/blocks/choose', ['blocks' => $extensions->search('anomaly.module.blocks::block.*')]);
 }