Beispiel #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure                  $next
  *
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (UserImpersonator::isEnabled() && UserImpersonator::isImpersonating()) {
         auth()->onceUsingId(UserImpersonator::getUserId());
     }
     return $next($request);
 }
 /**
  * Define the public routes for the application.
  *
  * @param  \Illuminate\Contracts\Routing\Registrar  $router
  */
 private function mapPublicRoutes(Router $router)
 {
     $configs = $this->config()->get('arcanesoft.auth.authentication');
     $attributes = Arr::get($configs, 'routes.global', ['prefix' => 'auth', 'as' => 'auth::', 'namespace' => 'Arcanesoft\\Auth\\Http\\Controllers\\Front']);
     $router->group($attributes, function (Router $router) {
         Routes\Front\AuthenticationRoutes::register($router);
         Routes\Front\RegisterRoutes::register($router);
         Routes\Front\PasswordResetRoutes::register($router);
         if (UserImpersonator::isEnabled()) {
             Routes\Front\ImpersonateRoutes::register($router);
         }
         if (SocialAuthenticator::isEnabled()) {
             Routes\Front\SocialiteRoutes::register($router);
         }
     });
     $router->group(array_merge($attributes, ['prefix' => 'api', 'as' => $attributes['as'] . 'api.']), function (Router $router) {
         Routes\Front\ApiRoutes::register($router);
     });
 }
Beispiel #3
0
 /**
  * Map routes.
  *
  * @param  \Illuminate\Contracts\Routing\Registrar  $router
  */
 public function map(Registrar $router)
 {
     $this->bind('auth_user', function ($hashedId) {
         return User::firstHashedOrFail($hashedId);
     });
     $this->group(['prefix' => 'users', 'as' => 'users.'], function () {
         $this->get('/', 'UsersController@index')->name('index');
         // auth::foundation.users.index
         $this->get('trash', 'UsersController@trashList')->name('trash');
         // auth::foundation.users.trash
         $this->get('roles-filter/{auth_role}', 'UsersController@listByRole')->name('roles-filter.index');
         // auth::foundation.users.roles-filter.index
         $this->get('create', 'UsersController@create')->name('create');
         // auth::foundation.users.create
         $this->post('store', 'UsersController@store')->name('store');
         // auth::foundation.users.store
         $this->group(['prefix' => '{auth_user}'], function () {
             $this->get('/', 'UsersController@show')->name('show');
             // auth::foundation.users.show
             $this->get('edit', 'UsersController@edit')->name('edit');
             // auth::foundation.users.edit
             $this->put('update', 'UsersController@update')->name('update');
             // auth::foundation.users.update
             $this->put('activate', 'UsersController@activate')->name('activate');
             // auth::foundation.users.activate
             $this->put('restore', 'UsersController@restore')->name('restore');
             // auth::foundation.users.restore
             $this->delete('delete', 'UsersController@delete')->name('delete');
             // auth::foundation.users.delete
             if (UserImpersonator::isEnabled()) {
                 $this->get('impersonate', 'UsersController@impersonate')->name('impersonate');
                 // auth::foundation.users.impersonate
             }
         });
     });
 }