mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Merge branch 'develop'
# Conflicts: # config/version.php
This commit is contained in:
commit
7c9c6ea3df
|
@ -8,6 +8,8 @@ use App\Models\Ldap;
|
||||||
use Validator;
|
use Validator;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use Mail;
|
use Mail;
|
||||||
|
use App\Notifications\SlackTest;
|
||||||
|
use Notification;
|
||||||
|
|
||||||
class SettingsController extends Controller
|
class SettingsController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -96,6 +98,29 @@ class SettingsController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function slacktest()
|
||||||
|
{
|
||||||
|
|
||||||
|
if ($settings = Setting::getSettings()->slack_channel=='') {
|
||||||
|
\Log::debug('Slack is not enabled. Cannot test.');
|
||||||
|
return response()->json(['message' => 'Slack is not enabled, cannot test.'], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
\Log::debug('Preparing to test slack connection');
|
||||||
|
|
||||||
|
try {
|
||||||
|
Notification::send($settings = Setting::getSettings(), new SlackTest());
|
||||||
|
return response()->json(['message' => 'Success'], 200);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::debug('Slack connection failed');
|
||||||
|
return response()->json(['message' => $e->getMessage()], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the email configuration
|
* Test the email configuration
|
||||||
*
|
*
|
||||||
|
|
|
@ -194,7 +194,7 @@ class ComponentsController extends Controller
|
||||||
public function destroy($componentId)
|
public function destroy($componentId)
|
||||||
{
|
{
|
||||||
if (is_null($component = Component::find($componentId))) {
|
if (is_null($component = Component::find($componentId))) {
|
||||||
return redirect()->route('components.index')->with('error', trans('admin/components/message.not_found'));
|
return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->authorize('delete', $component);
|
$this->authorize('delete', $component);
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Supplier extends SnipeModel
|
||||||
protected $table = 'suppliers';
|
protected $table = 'suppliers';
|
||||||
|
|
||||||
protected $rules = array(
|
protected $rules = array(
|
||||||
'name' => 'required|min:3|max:255|unique_undeleted',
|
'name' => 'required|min:1|max:255|unique_undeleted',
|
||||||
'address' => 'max:50|nullable',
|
'address' => 'max:50|nullable',
|
||||||
'address2' => 'max:50|nullable',
|
'address2' => 'max:50|nullable',
|
||||||
'city' => 'max:255|nullable',
|
'city' => 'max:255|nullable',
|
||||||
|
|
|
@ -330,19 +330,29 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
|
||||||
|
|
||||||
public static function generateFormattedNameFromFullName($format = 'filastname', $users_name)
|
public static function generateFormattedNameFromFullName($format = 'filastname', $users_name)
|
||||||
{
|
{
|
||||||
list($first_name, $last_name) = explode(" ", $users_name, 2);
|
|
||||||
|
|
||||||
// Assume filastname by default
|
// If there was only one name given
|
||||||
$username = str_slug(substr($first_name, 0, 1).$last_name);
|
if (strpos($users_name, ' ') === false) {
|
||||||
|
$first_name = $users_name;
|
||||||
if ($format=='firstname.lastname') {
|
$last_name = '';
|
||||||
$username = str_slug($first_name).'.'.str_slug($last_name);
|
$username = $users_name;
|
||||||
|
|
||||||
} elseif ($format=='firstname_lastname') {
|
} else {
|
||||||
$username = str_slug($first_name).'_'.str_slug($last_name);
|
|
||||||
|
|
||||||
} elseif ($format=='firstname') {
|
list($first_name, $last_name) = explode(" ", $users_name, 2);
|
||||||
$username = str_slug($first_name);
|
|
||||||
|
// Assume filastname by default
|
||||||
|
$username = str_slug(substr($first_name, 0, 1).$last_name);
|
||||||
|
|
||||||
|
if ($format=='firstname.lastname') {
|
||||||
|
$username = str_slug($first_name).'.'.str_slug($last_name);
|
||||||
|
|
||||||
|
} elseif ($format=='firstname_lastname') {
|
||||||
|
$username = str_slug($first_name).'_'.str_slug($last_name);
|
||||||
|
|
||||||
|
} elseif ($format=='firstname') {
|
||||||
|
$username = str_slug($first_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user['first_name'] = $first_name;
|
$user['first_name'] = $first_name;
|
||||||
|
|
77
app/Notifications/SlackTest.php
Normal file
77
app/Notifications/SlackTest.php
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Notifications;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
|
use App\Models\Setting;
|
||||||
|
|
||||||
|
class SlackTest extends Notification
|
||||||
|
{
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new notification instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via($notifiable)
|
||||||
|
{
|
||||||
|
return ['slack'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mail representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Slack representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return SlackMessage
|
||||||
|
*/
|
||||||
|
public function toSlack($notifiable)
|
||||||
|
{
|
||||||
|
$settings = Setting::getSettings();
|
||||||
|
return (new SlackMessage)
|
||||||
|
->from($settings->slack_botname, ':heart:')
|
||||||
|
->to($settings->slack_channel)
|
||||||
|
->image('https://snipeitapp.com/favicon.ico')
|
||||||
|
->content('Oh hai! Looks like your Slack integration with Snipe-IT is working!');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the array representation of the notification.
|
||||||
|
*
|
||||||
|
* @param mixed $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,15 +37,15 @@
|
||||||
"watson/validating": "^3.0"
|
"watson/validating": "^3.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"fzaninotto/faker": "~1.4",
|
"codeception/codeception": "2.3.6",
|
||||||
"phpunit/phpunit": "~5.7",
|
"fzaninotto/faker": "~1.4",
|
||||||
"symfony/css-selector": "3.1.*",
|
"phpunit/php-token-stream": "1.4.11",
|
||||||
"symfony/dom-crawler": "3.1.*",
|
"phpunit/phpunit": "~5.7",
|
||||||
"codeception/codeception": "2.3.6",
|
"roave/security-advisories": "dev-master",
|
||||||
"squizlabs/php_codesniffer": "*",
|
"squizlabs/php_codesniffer": "*",
|
||||||
"phpunit/php-token-stream": "1.4.11"
|
"symfony/css-selector": "3.1.*",
|
||||||
|
"symfony/dom-crawler": "3.1.*"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"classmap": [
|
"classmap": [
|
||||||
"database"
|
"database"
|
||||||
|
|
160
composer.lock
generated
160
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "65f58262b045761a0f36791e81edf898",
|
"content-hash": "bcafb4e19ce95a2d002d3edfa5c579e3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "barryvdh/laravel-debugbar",
|
"name": "barryvdh/laravel-debugbar",
|
||||||
|
@ -5788,6 +5788,160 @@
|
||||||
],
|
],
|
||||||
"time": "2017-06-30T09:13:00+00:00"
|
"time": "2017-06-30T09:13:00+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "roave/security-advisories",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Roave/SecurityAdvisories.git",
|
||||||
|
"reference": "940eb3dbebd9bb2d82c94ecc896df8b19b9bd867"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/940eb3dbebd9bb2d82c94ecc896df8b19b9bd867",
|
||||||
|
"reference": "940eb3dbebd9bb2d82c94ecc896df8b19b9bd867",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"3f/pygmentize": "<1.2",
|
||||||
|
"adodb/adodb-php": "<5.20.6",
|
||||||
|
"amphp/artax": "<1.0.6|>=2,<2.0.6",
|
||||||
|
"asymmetricrypt/asymmetricrypt": ">=0,<9.9.99",
|
||||||
|
"aws/aws-sdk-php": ">=3,<3.2.1",
|
||||||
|
"bugsnag/bugsnag-laravel": ">=2,<2.0.2",
|
||||||
|
"cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.0.15|>=3.1,<3.1.4",
|
||||||
|
"cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4",
|
||||||
|
"cartalyst/sentry": "<=2.1.6",
|
||||||
|
"codeigniter/framework": "<=3.0.6",
|
||||||
|
"composer/composer": "<=1.0.0-alpha11",
|
||||||
|
"contao-components/mediaelement": ">=2.14.2,<2.21.1",
|
||||||
|
"contao/core": ">=2,<3.5.32",
|
||||||
|
"contao/core-bundle": ">=4,<4.4.8",
|
||||||
|
"contao/listing-bundle": ">=4,<4.4.8",
|
||||||
|
"contao/newsletter-bundle": ">=4,<4.1",
|
||||||
|
"doctrine/annotations": ">=1,<1.2.7",
|
||||||
|
"doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2",
|
||||||
|
"doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1",
|
||||||
|
"doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2",
|
||||||
|
"doctrine/doctrine-bundle": "<1.5.2",
|
||||||
|
"doctrine/doctrine-module": "<=0.7.1",
|
||||||
|
"doctrine/mongodb-odm": ">=1,<1.0.2",
|
||||||
|
"doctrine/mongodb-odm-bundle": ">=2,<3.0.1",
|
||||||
|
"doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1",
|
||||||
|
"dompdf/dompdf": ">=0.6,<0.6.2",
|
||||||
|
"drupal/core": ">=8,<8.3.7",
|
||||||
|
"drupal/drupal": ">=8,<8.3.7",
|
||||||
|
"ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.2|>=5.4,<5.4.10.1|>=2017.8,<2017.8.1.1",
|
||||||
|
"firebase/php-jwt": "<2",
|
||||||
|
"friendsofsymfony/rest-bundle": ">=1.2,<1.2.2",
|
||||||
|
"friendsofsymfony/user-bundle": ">=1.2,<1.3.5",
|
||||||
|
"gree/jose": "<=2.2",
|
||||||
|
"gregwar/rst": "<1.0.3",
|
||||||
|
"guzzlehttp/guzzle": ">=6,<6.2.1|>=4.0.0-rc2,<4.2.4|>=5,<5.3.1",
|
||||||
|
"illuminate/auth": ">=4,<4.0.99|>=4.1,<4.1.26",
|
||||||
|
"illuminate/database": ">=4,<4.0.99|>=4.1,<4.1.29",
|
||||||
|
"joomla/session": "<1.3.1",
|
||||||
|
"laravel/framework": ">=4,<4.0.99|>=4.1,<4.1.29",
|
||||||
|
"laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10",
|
||||||
|
"magento/magento1ce": ">=1.5.0.1,<1.9.3.2",
|
||||||
|
"magento/magento1ee": ">=1.9,<1.14.3.2",
|
||||||
|
"magento/magento2ce": ">=2,<2.2",
|
||||||
|
"monolog/monolog": ">=1.8,<1.12",
|
||||||
|
"namshi/jose": "<2.2",
|
||||||
|
"onelogin/php-saml": "<2.10.4",
|
||||||
|
"oro/crm": ">=1.7,<1.7.4",
|
||||||
|
"oro/platform": ">=1.7,<1.7.4",
|
||||||
|
"padraic/humbug_get_contents": "<1.1.2",
|
||||||
|
"pagarme/pagarme-php": ">=0,<9.9.99",
|
||||||
|
"phpmailer/phpmailer": ">=5,<5.2.24",
|
||||||
|
"phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3",
|
||||||
|
"phpxmlrpc/extras": "<0.6.1",
|
||||||
|
"propel/propel": ">=2.0.0-alpha1,<=2.0.0-alpha7",
|
||||||
|
"propel/propel1": ">=1,<=1.7.1",
|
||||||
|
"pusher/pusher-php-server": "<2.2.1",
|
||||||
|
"sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9",
|
||||||
|
"shopware/shopware": "<5.3.7",
|
||||||
|
"silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11",
|
||||||
|
"silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
|
||||||
|
"silverstripe/framework": ">=3,<3.3",
|
||||||
|
"silverstripe/userforms": "<3",
|
||||||
|
"simplesamlphp/saml2": "<1.10.4|>=2,<2.3.5|>=3,<3.1.1",
|
||||||
|
"simplesamlphp/simplesamlphp": "<1.15.2",
|
||||||
|
"simplesamlphp/simplesamlphp-module-infocard": "<1.0.1",
|
||||||
|
"socalnick/scn-social-auth": "<1.15.2",
|
||||||
|
"squizlabs/php_codesniffer": ">=1,<2.8.1",
|
||||||
|
"stormpath/sdk": ">=0,<9.9.99",
|
||||||
|
"swiftmailer/swiftmailer": ">=4,<5.4.5",
|
||||||
|
"symfony/dependency-injection": ">=2,<2.0.17",
|
||||||
|
"symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
||||||
|
"symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2",
|
||||||
|
"symfony/http-foundation": ">=2,<2.3.27|>=2.4,<2.5.11|>=2.6,<2.6.6",
|
||||||
|
"symfony/http-kernel": ">=2,<2.3.29|>=2.4,<2.5.12|>=2.6,<2.6.8",
|
||||||
|
"symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
||||||
|
"symfony/routing": ">=2,<2.0.19",
|
||||||
|
"symfony/security": ">=2,<2.0.25|>=2.1,<2.1.13|>=2.2,<2.2.9|>=2.3,<2.3.37|>=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8.23,<2.8.25|>=3.2.10,<3.2.12|>=3.3.3,<3.3.5",
|
||||||
|
"symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.6|>=2.8.23,<2.8.25|>=3,<3.0.6|>=3.2.10,<3.2.12|>=3.3.3,<3.3.5",
|
||||||
|
"symfony/security-csrf": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
||||||
|
"symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
||||||
|
"symfony/serializer": ">=2,<2.0.11",
|
||||||
|
"symfony/symfony": ">=2,<2.3.41|>=2.4,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13",
|
||||||
|
"symfony/translation": ">=2,<2.0.17",
|
||||||
|
"symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3",
|
||||||
|
"symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4",
|
||||||
|
"symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7",
|
||||||
|
"thelia/backoffice-default-template": ">=2.1,<2.1.2",
|
||||||
|
"thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3",
|
||||||
|
"titon/framework": ">=0,<9.9.99",
|
||||||
|
"twig/twig": "<1.20",
|
||||||
|
"typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.22|>=8,<8.7.5",
|
||||||
|
"typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5",
|
||||||
|
"typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4",
|
||||||
|
"willdurand/js-translation-bundle": "<2.1.1",
|
||||||
|
"yiisoft/yii": ">=1.1.14,<1.1.15",
|
||||||
|
"yiisoft/yii2": "<2.0.14",
|
||||||
|
"yiisoft/yii2-bootstrap": "<2.0.4",
|
||||||
|
"yiisoft/yii2-dev": "<2.0.14",
|
||||||
|
"yiisoft/yii2-gii": "<2.0.4",
|
||||||
|
"yiisoft/yii2-jui": "<2.0.4",
|
||||||
|
"zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3",
|
||||||
|
"zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2",
|
||||||
|
"zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2",
|
||||||
|
"zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5",
|
||||||
|
"zendframework/zend-diactoros": ">=1,<1.0.4",
|
||||||
|
"zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1",
|
||||||
|
"zendframework/zend-http": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.3,<2.3.8|>=2.4,<2.4.1",
|
||||||
|
"zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6",
|
||||||
|
"zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3",
|
||||||
|
"zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2",
|
||||||
|
"zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1",
|
||||||
|
"zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4",
|
||||||
|
"zendframework/zend-validator": ">=2.3,<2.3.6",
|
||||||
|
"zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1",
|
||||||
|
"zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6",
|
||||||
|
"zendframework/zendframework": ">=2,<2.4.11|>=2.5,<2.5.1",
|
||||||
|
"zendframework/zendframework1": "<1.12.20",
|
||||||
|
"zendframework/zendopenid": ">=2,<2.0.2",
|
||||||
|
"zendframework/zendxml": ">=1,<1.0.1",
|
||||||
|
"zetacomponents/mail": "<1.8.2",
|
||||||
|
"zf-commons/zfc-user": "<1.2.2",
|
||||||
|
"zfcampus/zf-apigility-doctrine": ">=1,<1.0.3",
|
||||||
|
"zfr/zfr-oauth2-server-module": "<0.1.2"
|
||||||
|
},
|
||||||
|
"type": "metapackage",
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Marco Pivetta",
|
||||||
|
"email": "ocramius@gmail.com",
|
||||||
|
"role": "maintainer"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
|
||||||
|
"time": "2018-02-21T14:50:18+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/code-unit-reverse-lookup",
|
"name": "sebastian/code-unit-reverse-lookup",
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
@ -6335,7 +6489,9 @@
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"roave/security-advisories": 20
|
||||||
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
return array (
|
return array (
|
||||||
'app_version' => 'v4.1.14',
|
'app_version' => 'v4.1.14',
|
||||||
'full_app_version' => 'v4.1.14 - build 3382-g0f23462',
|
'full_app_version' => 'v4.1.14 - build 3391-g0f23462',
|
||||||
'build_version' => '3382',
|
'build_version' => '3391',
|
||||||
'prerelease_version' => '',
|
'prerelease_version' => '',
|
||||||
'hash_version' => 'g0f23462',
|
'hash_version' => 'g0f23462',
|
||||||
'full_hash' => 'v4.1.13-5-g0f23462',
|
'full_hash' => 'v4.1.13-5-g0f23462',
|
||||||
|
|
|
@ -105,7 +105,8 @@ return array(
|
||||||
'slack_channel' => 'Slack Channel',
|
'slack_channel' => 'Slack Channel',
|
||||||
'slack_endpoint' => 'Slack Endpoint',
|
'slack_endpoint' => 'Slack Endpoint',
|
||||||
'slack_integration' => 'Slack Settings',
|
'slack_integration' => 'Slack Settings',
|
||||||
'slack_integration_help' => 'Slack integration is optional, however the endpoint and channel are required if you wish to use it. To configure Slack integration, you must first <a href=":slack_link" target="_new">create an incoming webhook</a> on your Slack account.',
|
'slack_integration_help' => 'Slack integration is optional, however the endpoint and channel are required if you wish to use it. To configure Slack integration, you must first <a href=":slack_link" target="_new">create an incoming webhook</a> on your Slack account. Once you have saved your Slack information, a test button will appear.',
|
||||||
|
'slack_test_help' => 'Test whether your Slack integration is configured correctly. YOU MUST SAVE YOUR UPDATED SLACK SETTINGS FIRST.',
|
||||||
'snipe_version' => 'Snipe-IT version',
|
'snipe_version' => 'Snipe-IT version',
|
||||||
'support_footer' => 'Support Footer Links ',
|
'support_footer' => 'Support Footer Links ',
|
||||||
'support_footer_help' => 'Specify who sees the links to the Snipe-IT Support info and Users Manual',
|
'support_footer_help' => 'Specify who sees the links to the Snipe-IT Support info and Users Manual',
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
data-search="true"
|
data-search="true"
|
||||||
data-side-pagination="server"
|
data-side-pagination="server"
|
||||||
data-show-columns="true"
|
data-show-columns="true"
|
||||||
data-show-export="false"
|
data-show-export="true"
|
||||||
data-show-refresh="true"
|
data-show-refresh="true"
|
||||||
data-sort-order="asc"
|
data-sort-order="asc"
|
||||||
data-sort-name="name"
|
data-sort-name="name"
|
||||||
|
|
|
@ -38,9 +38,14 @@
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-11 col-md-offset-1">
|
<p style="border-bottom: 0px;">
|
||||||
|
{!! trans('admin/settings/general.slack_integration_help',array('slack_link' => 'https://my.slack.com/services/new/incoming-webhook')) !!}
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="col-md-11 col-md-offset-1" style="border-top: 0px;">
|
||||||
|
|
||||||
<p class="help-block">{!! trans('admin/settings/general.slack_integration_help',array('slack_link' => 'https://my.slack.com/services/new/incoming-webhook')) !!}</p>
|
|
||||||
|
|
||||||
<!-- slack endpoint -->
|
<!-- slack endpoint -->
|
||||||
<div class="form-group {{ $errors->has('slack_endpoint') ? 'error' : '' }}">
|
<div class="form-group {{ $errors->has('slack_endpoint') ? 'error' : '' }}">
|
||||||
|
@ -87,10 +92,26 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (($setting->slack_channel!='') && ($setting->slack_endpoint))
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-3">
|
||||||
|
{{ Form::label('est_slack', 'Test Slack') }}
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9" id="slacktestrow">
|
||||||
|
<a class="btn btn-default btn-sm pull-left" id="slacktest" style="margin-right: 10px;">Test Integration</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<span id="slacktesticon"></span>
|
||||||
|
<span id="slacktestresult"></span>
|
||||||
|
<span id="slackteststatus"></span>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-9 col-md-offset-3">
|
||||||
|
<p class="help-block">{{ trans('admin/settings/general.slack_test_help') }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
</div> <!--/-->
|
||||||
</div> <!--/.box-body-->
|
</div> <!--/.box-body-->
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<div class="text-left col-md-6">
|
<div class="text-left col-md-6">
|
||||||
|
@ -108,3 +129,78 @@
|
||||||
{{Form::close()}}
|
{{Form::close()}}
|
||||||
|
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
|
@section('moar_scripts')
|
||||||
|
<script nonce="{{ csrf_token() }}">
|
||||||
|
$("#slacktest").click(function() {
|
||||||
|
$("#slacktestrow").removeClass('text-success');
|
||||||
|
$("#slacktestrow").removeClass('text-danger');
|
||||||
|
$("#slackteststatus").removeClass('text-danger');
|
||||||
|
$("#slackteststatus").html('');
|
||||||
|
$("#slacktesticon").html('<i class="fa fa-spinner spin"></i> Sending Slack test message...');
|
||||||
|
$.ajax({
|
||||||
|
url: '{{ route('api.settings.slacktest') }}',
|
||||||
|
type: 'POST',
|
||||||
|
headers: {
|
||||||
|
"X-Requested-With": 'XMLHttpRequest',
|
||||||
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
'ldaptest_user': $('#ldaptest_user').val(),
|
||||||
|
'ldaptest_password': $('#ldaptest_password').val()
|
||||||
|
},
|
||||||
|
|
||||||
|
dataType: 'json',
|
||||||
|
|
||||||
|
success: function (data) {
|
||||||
|
$("#slacktesticon").html('');
|
||||||
|
$("#slacktestrow").addClass('text-success');
|
||||||
|
$("#slackteststatus").addClass('text-success');
|
||||||
|
$("#slackteststatus").html('<i class="fa fa-check text-success"></i> Success! Check the {{ $setting->slack_channel}} channel for your test message');
|
||||||
|
},
|
||||||
|
|
||||||
|
error: function (data) {
|
||||||
|
|
||||||
|
if (data.responseJSON) {
|
||||||
|
var errors = data.responseJSON.message;
|
||||||
|
} else {
|
||||||
|
var errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
var error_text = '';
|
||||||
|
|
||||||
|
$("#slacktesticon").html('');
|
||||||
|
$("#slackteststatus").addClass('text-danger');
|
||||||
|
$("#slacktesticon").html('<i class="fa fa-exclamation-triangle text-danger"></i>');
|
||||||
|
|
||||||
|
if (data.status == 500) {
|
||||||
|
$('#slackteststatus').html('500 Server Error');
|
||||||
|
} else if (data.status == 400) {
|
||||||
|
|
||||||
|
if (typeof errors != 'string') {
|
||||||
|
|
||||||
|
for (i = 0; i < errors.length; i++) {
|
||||||
|
if (errors[i]) {
|
||||||
|
error_text += '<li>Error: ' + errors[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
error_text = errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#slackteststatus').html(error_text);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#slackteststatus').html(data.responseText.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
@stop
|
||||||
|
|
|
@ -527,6 +527,11 @@ Route::group(['prefix' => 'v1','namespace' => 'Api'], function () {
|
||||||
'uses' => 'SettingsController@ldaptestlogin'
|
'uses' => 'SettingsController@ldaptestlogin'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Route::post('settings/slacktest', [
|
||||||
|
'as' => 'api.settings.slacktest',
|
||||||
|
'uses' => 'SettingsController@slacktest'
|
||||||
|
]);
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'settings/mailtest',
|
'settings/mailtest',
|
||||||
[
|
[
|
||||||
|
|
|
@ -71,5 +71,13 @@ class UserTest extends BaseTest
|
||||||
$this->assertEquals($expected_username, $user['username']);
|
$this->assertEquals($expected_username, $user['username']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testSingleName()
|
||||||
|
{
|
||||||
|
$fullname = "Natalia";
|
||||||
|
$expected_username = 'natalia';
|
||||||
|
$user = User::generateFormattedNameFromFullName('firstname_lastname', $fullname);
|
||||||
|
$this->assertEquals($expected_username, $user['username']);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue