mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 15:44:11 -08:00
6756dd193e
Cleaning up routes to match laravel-scim-server's recommended implementation Some actually *working* changes for SCIM support?! Whoops, forgot my route file Fix public SCIM routes Removed Ziggy, removed old generated file, yanked Ziggy references Resolves the first set of comments for SCIM Ensure all /api routes have baseUrl prepended Fix the parent:: call to be, uh, actually correct :P Clarify the route-ordering, as it is quite tricky This gets it so that users can actually be saved.. Work around the lack of callbacks with some inheritance Mapped a bunch more fields from SCIM into Snipe-IT's user table More baseUrl shenanigans since we yanked Ziggy :/ Properly map job title and work with some other necessary attributes Map more fields... Finalized basic mapping for core and enterprise namespaces Latest tuned settings for SCIM config to work with Azure (and others)
89 lines
3.2 KiB
PHP
89 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Accessory;
|
|
use App\Models\Asset;
|
|
use App\Models\Component;
|
|
use App\Models\Consumable;
|
|
use App\Models\License;
|
|
use App\Models\Setting;
|
|
use App\Models\SnipeSCIMConfig;
|
|
use App\Observers\AccessoryObserver;
|
|
use App\Observers\AssetObserver;
|
|
use App\Observers\ComponentObserver;
|
|
use App\Observers\ConsumableObserver;
|
|
use App\Observers\LicenseObserver;
|
|
use App\Observers\SettingObserver;
|
|
use Illuminate\Routing\UrlGenerator;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
/**
|
|
* This service provider handles setting the observers on models
|
|
*
|
|
* PHP version 5.5.9
|
|
* @version v3.0
|
|
*/
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Custom email array validation
|
|
*
|
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
* @since [v3.0]
|
|
* @return void
|
|
*/
|
|
public function boot(UrlGenerator $url)
|
|
{
|
|
if (env('APP_FORCE_TLS')) {
|
|
if (strpos(env('APP_URL'), 'https') === 0) {
|
|
$url->forceScheme('https');
|
|
} else {
|
|
\Log::warning("'APP_FORCE_TLS' is set to true, but 'APP_URL' does not start with 'https://'. Will not force TLS on connections.");
|
|
}
|
|
}
|
|
|
|
// TODO - isn't it somehow 'gauche' to check the environment directly; shouldn't we be using config() somehow?
|
|
if ( ! env('APP_ALLOW_INSECURE_HOSTS')) { // unless you set APP_ALLOW_INSECURE_HOSTS, you should PROHIBIT forging domain parts of URL via Host: headers
|
|
$url_parts = parse_url(config('app.url'));
|
|
if ($url_parts && array_key_exists('scheme', $url_parts) && array_key_exists('host', $url_parts)) { // check for the *required* parts of a bare-minimum URL
|
|
\URL::forceRootUrl(config('app.url'));
|
|
} else {
|
|
\Log::error("Your APP_URL in your .env is misconfigured - it is: ".config('app.url').". Many things will work strangely unless you fix it.");
|
|
}
|
|
}
|
|
|
|
\Illuminate\Pagination\Paginator::useBootstrap();
|
|
|
|
Schema::defaultStringLength(191);
|
|
Asset::observe(AssetObserver::class);
|
|
Accessory::observe(AccessoryObserver::class);
|
|
Component::observe(ComponentObserver::class);
|
|
Consumable::observe(ConsumableObserver::class);
|
|
License::observe(LicenseObserver::class);
|
|
Setting::observe(SettingObserver::class);
|
|
}
|
|
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
// Only load rollbar if there is a rollbar key and the app is in production
|
|
if (($this->app->environment('production')) && (config('logging.channels.rollbar.access_token'))) {
|
|
$this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
|
|
}
|
|
|
|
// Only load dusk's service provider if the app is in local or develop mode
|
|
if ($this->app->environment(['local', 'develop'])) {
|
|
$this->app->register(\Laravel\Dusk\DuskServiceProvider::class);
|
|
}
|
|
|
|
$this->app->singleton('ArieTimmerman\Laravel\SCIMServer\SCIMConfig', SnipeSCIMConfig::class); // this overrides the default SCIM configuration with our own
|
|
|
|
}
|
|
}
|