mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Small phpcbf cleanup
This commit is contained in:
parent
fd805bde50
commit
51ceaedfaf
|
@ -159,6 +159,4 @@ class LdapSync extends Command
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ class Versioning extends Command
|
||||||
'build_version' => $version[1],
|
'build_version' => $version[1],
|
||||||
'hash_version' => $version[2],
|
'hash_version' => $version[2],
|
||||||
'full_hash' => $hash_version),
|
'full_hash' => $hash_version),
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Construct our file content
|
// Construct our file content
|
||||||
|
|
|
@ -31,7 +31,8 @@ class Helper
|
||||||
* @since [v2.0]
|
* @since [v2.0]
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static function parseEscapedMarkedown($str) {
|
public static function parseEscapedMarkedown($str)
|
||||||
|
{
|
||||||
$Parsedown = new \Parsedown();
|
$Parsedown = new \Parsedown();
|
||||||
|
|
||||||
if ($str) {
|
if ($str) {
|
||||||
|
@ -173,8 +174,9 @@ class Helper
|
||||||
$categories = Category::orderBy('name', 'asc')
|
$categories = Category::orderBy('name', 'asc')
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->orderBy('name', 'asc');
|
->orderBy('name', 'asc');
|
||||||
if(!empty($category_type))
|
if (!empty($category_type)) {
|
||||||
$categories = $categories->where('category_type', '=', $category_type);
|
$categories = $categories->where('category_type', '=', $category_type);
|
||||||
|
}
|
||||||
$category_list = array('' => trans('general.select_category')) + $categories->pluck('name', 'id')->toArray();
|
$category_list = array('' => trans('general.select_category')) + $categories->pluck('name', 'id')->toArray();
|
||||||
return $category_list;
|
return $category_list;
|
||||||
}
|
}
|
||||||
|
@ -585,7 +587,8 @@ class Helper
|
||||||
* @since [v3.0]
|
* @since [v3.0]
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function checkIfRequired($class, $field) {
|
public static function checkIfRequired($class, $field)
|
||||||
|
{
|
||||||
$rules = $class::rules();
|
$rules = $class::rules();
|
||||||
foreach ($rules as $rule_name => $rule) {
|
foreach ($rules as $rule_name => $rule) {
|
||||||
if ($rule_name == $field) {
|
if ($rule_name == $field) {
|
||||||
|
@ -647,7 +650,8 @@ class Helper
|
||||||
* @param String $string
|
* @param String $string
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function gracefulDecrypt(CustomField $field, $string) {
|
public static function gracefulDecrypt(CustomField $field, $string)
|
||||||
|
{
|
||||||
|
|
||||||
if ($field->isFieldDecryptable($string)) {
|
if ($field->isFieldDecryptable($string)) {
|
||||||
|
|
||||||
|
@ -675,7 +679,8 @@ class Helper
|
||||||
* @param $array array
|
* @param $array array
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public static function stripTagsFromJSON(Array $array) {
|
public static function stripTagsFromJSON(array $array)
|
||||||
|
{
|
||||||
|
|
||||||
foreach ($array as $key => $value) {
|
foreach ($array as $key => $value) {
|
||||||
$clean_value = strip_tags($value);
|
$clean_value = strip_tags($value);
|
||||||
|
@ -714,5 +719,4 @@ class Helper
|
||||||
return '<a href="'.$route.'" class="btn btn-warning btn-sm ' . $disabledString . '"><i class="fa fa-recycle icon-white"></i></a>';
|
return '<a href="'.$route.'" class="btn btn-warning btn-sm ' . $disabledString . '"><i class="fa fa-recycle icon-white"></i></a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -948,8 +948,7 @@ class AssetsController extends Controller
|
||||||
'target_type' => User::class,
|
'target_type' => User::class,
|
||||||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
|
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
|
||||||
'action_type' => 'checkout',
|
'action_type' => 'checkout',
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
$asset->assigned_to = $user->id;
|
$asset->assigned_to = $user->id;
|
||||||
|
|
||||||
|
@ -992,8 +991,7 @@ class AssetsController extends Controller
|
||||||
'target_id' => null,
|
'target_id' => null,
|
||||||
'created_at' => $checkin_date,
|
'created_at' => $checkin_date,
|
||||||
'action_type' => 'checkin'
|
'action_type' => 'checkin'
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1152,8 +1150,10 @@ class AssetsController extends Controller
|
||||||
// Create labels
|
// Create labels
|
||||||
if (Input::get('bulk_actions')=='labels') {
|
if (Input::get('bulk_actions')=='labels') {
|
||||||
$count = 0;
|
$count = 0;
|
||||||
return View::make('hardware/labels')->with('assets', Asset::find($asset_ids))->with('settings', Setting::getSettings())->with('count', $count)->with('settings',
|
return View::make('hardware/labels')->with('assets', Asset::find($asset_ids))->with('settings', Setting::getSettings())->with('count', $count)->with(
|
||||||
Setting::getSettings());
|
'settings',
|
||||||
|
Setting::getSettings()
|
||||||
|
);
|
||||||
} elseif (Input::get('bulk_actions')=='delete') {
|
} elseif (Input::get('bulk_actions')=='delete') {
|
||||||
$assets = Asset::with('assigneduser', 'assetloc')->find($asset_ids);
|
$assets = Asset::with('assigneduser', 'assetloc')->find($asset_ids);
|
||||||
$assets->each(function ($asset) {
|
$assets->each(function ($asset) {
|
||||||
|
@ -1168,8 +1168,10 @@ class AssetsController extends Controller
|
||||||
->with('statuslabel_list', Helper::statusLabelList())
|
->with('statuslabel_list', Helper::statusLabelList())
|
||||||
->with('location_list', Helper::locationsList())
|
->with('location_list', Helper::locationsList())
|
||||||
->with('models_list', Helper::modelList())
|
->with('models_list', Helper::modelList())
|
||||||
->with('companies_list',
|
->with(
|
||||||
array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList());
|
'companies_list',
|
||||||
|
array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return redirect()->back()->with('error', 'No action selected');
|
return redirect()->back()->with('error', 'No action selected');
|
||||||
|
@ -1463,10 +1465,9 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$errors = [];
|
$errors = [];
|
||||||
DB::transaction(function() use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids)
|
DB::transaction(function () use ($user, $admin, $checkout_at, $expected_checkin, $errors, $asset_ids) {
|
||||||
{
|
|
||||||
foreach($asset_ids as $asset_id)
|
foreach ($asset_ids as $asset_id) {
|
||||||
{
|
|
||||||
$asset = Asset::find($asset_id);
|
$asset = Asset::find($asset_id);
|
||||||
$this->authorize('checkout', $asset);
|
$this->authorize('checkout', $asset);
|
||||||
$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);
|
$error = $asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), null);
|
||||||
|
@ -1484,5 +1485,4 @@ class AssetsController extends Controller
|
||||||
// Redirect to the asset management page with error
|
// Redirect to the asset management page with error
|
||||||
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
|
return redirect()->to("hardware/bulk-checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,8 @@ class ForgotPasswordController extends Controller
|
||||||
* Overriding method "getEmailSubject()" from trait "use ResetsPasswords"
|
* Overriding method "getEmailSubject()" from trait "use ResetsPasswords"
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getEmailSubject(){
|
public function getEmailSubject()
|
||||||
|
{
|
||||||
return property_exists($this, 'subject') ? $this->subject : \Lang::get('mail.reset_link');
|
return property_exists($this, 'subject') ? $this->subject : \Lang::get('mail.reset_link');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,6 @@ use Log;
|
||||||
use View;
|
use View;
|
||||||
use PragmaRX\Google2FA\Google2FA;
|
use PragmaRX\Google2FA\Google2FA;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller handles authentication for the user, including local
|
* This controller handles authentication for the user, including local
|
||||||
* database users and LDAP users.
|
* database users and LDAP users.
|
||||||
|
@ -210,7 +208,8 @@ class LoginController extends Controller
|
||||||
*
|
*
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function getTwoFactorAuth() {
|
public function getTwoFactorAuth()
|
||||||
|
{
|
||||||
return View::make('auth.two_factor');
|
return View::make('auth.two_factor');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +218,8 @@ class LoginController extends Controller
|
||||||
*
|
*
|
||||||
* @return Redirect
|
* @return Redirect
|
||||||
*/
|
*/
|
||||||
public function postTwoFactorAuth(Request $request) {
|
public function postTwoFactorAuth(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
if (!Auth::check()) {
|
if (!Auth::check()) {
|
||||||
return redirect()->route('login')->with('error', 'You must be logged in.');
|
return redirect()->route('login')->with('error', 'You must be logged in.');
|
||||||
|
@ -310,8 +310,9 @@ class LoginController extends Controller
|
||||||
$maxLoginAttempts = config('auth.throttle.max_attempts');
|
$maxLoginAttempts = config('auth.throttle.max_attempts');
|
||||||
|
|
||||||
return $this->limiter()->tooManyAttempts(
|
return $this->limiter()->tooManyAttempts(
|
||||||
$this->throttleKey($request), $maxLoginAttempts, $lockoutTime
|
$this->throttleKey($request),
|
||||||
|
$maxLoginAttempts,
|
||||||
|
$lockoutTime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,5 +169,4 @@ class CustomFieldsetsController extends Controller
|
||||||
|
|
||||||
return redirect()->route("fieldsets.show", [$id])->with("success", trans('admin/custom_fields/message.field.create.assoc_success'));
|
return redirect()->route("fieldsets.show", [$id])->with("success", trans('admin/custom_fields/message.field.create.assoc_success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ use App\Models\User;
|
||||||
use App\Http\Requests\SetupUserRequest;
|
use App\Http\Requests\SetupUserRequest;
|
||||||
use App\Http\Requests\ImageUploadRequest;
|
use App\Http\Requests\ImageUploadRequest;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller handles all actions related to Settings for
|
* This controller handles all actions related to Settings for
|
||||||
* the Snipe-IT Asset Management application.
|
* the Snipe-IT Asset Management application.
|
||||||
|
@ -443,7 +442,8 @@ class SettingsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getLdapTest() {
|
public function getLdapTest()
|
||||||
|
{
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$connection = Ldap::connectToLdap();
|
$connection = Ldap::connectToLdap();
|
||||||
|
|
|
@ -200,8 +200,10 @@ class SuppliersController extends Controller
|
||||||
// Delete the supplier
|
// Delete the supplier
|
||||||
$supplier->delete();
|
$supplier->delete();
|
||||||
// Redirect to the suppliers management page
|
// Redirect to the suppliers management page
|
||||||
return redirect()->route('suppliers.index')->with('success',
|
return redirect()->route('suppliers.index')->with(
|
||||||
trans('admin/suppliers/message.delete.success'));
|
'success',
|
||||||
|
trans('admin/suppliers/message.delete.success')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Redirect to the asset management page
|
// Redirect to the asset management page
|
||||||
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.assoc_users'));
|
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.assoc_users'));
|
||||||
|
|
|
@ -217,7 +217,8 @@ class UsersController extends Controller
|
||||||
* @internal param int $id
|
* @internal param int $id
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function filterDisplayable($permissions) {
|
private function filterDisplayable($permissions)
|
||||||
|
{
|
||||||
$output = null;
|
$output = null;
|
||||||
foreach ($permissions as $key => $permission) {
|
foreach ($permissions as $key => $permission) {
|
||||||
$output[$key] = array_filter($permission, function ($p) {
|
$output[$key] = array_filter($permission, function ($p) {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace App\Importer;
|
namespace App\Importer;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Accessory;
|
use App\Models\Accessory;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace App\Importer;
|
namespace App\Importer;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Asset;
|
use App\Models\Asset;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace App\Importer;
|
namespace App\Importer;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Importer;
|
namespace App\Importer;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
@ -69,15 +68,17 @@ abstract class Importer
|
||||||
* @param bool $updating
|
* @param bool $updating
|
||||||
* @param null $usernameFormat
|
* @param null $usernameFormat
|
||||||
*/
|
*/
|
||||||
function __construct(string $filename,
|
function __construct(
|
||||||
|
string $filename,
|
||||||
$logCallback,
|
$logCallback,
|
||||||
$progressCallback,
|
$progressCallback,
|
||||||
$errorCallback,
|
$errorCallback,
|
||||||
$testRun = false,
|
$testRun = false,
|
||||||
$user_id = -1,
|
$user_id = -1,
|
||||||
$updating = false,
|
$updating = false,
|
||||||
$usernameFormat = null)
|
$usernameFormat = null
|
||||||
{
|
) {
|
||||||
|
|
||||||
$this->filename = $filename;
|
$this->filename = $filename;
|
||||||
$this->csv = Reader::createFromPath($filename);
|
$this->csv = Reader::createFromPath($filename);
|
||||||
$this->csv->setNewLine('\r\n');
|
$this->csv->setNewLine('\r\n');
|
||||||
|
@ -193,11 +194,13 @@ abstract class Importer
|
||||||
return array_key_exists($index_name, $array) ? e(trim($array[$index_name])) : '';
|
return array_key_exists($index_name, $array) ? e(trim($array[$index_name])) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function log($string) {
|
protected function log($string)
|
||||||
|
{
|
||||||
call_user_func($this->logCallback, $string);
|
call_user_func($this->logCallback, $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function jsonError($item, $field, $errorString) {
|
protected function jsonError($item, $field, $errorString)
|
||||||
|
{
|
||||||
call_user_func($this->errorCallback, $item, $field, $errorString);
|
call_user_func($this->errorCallback, $item, $field, $errorString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Importer;
|
namespace App\Importer;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
|
@ -394,6 +393,4 @@ class ItemImporter extends Importer
|
||||||
return $supplier;
|
return $supplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -45,7 +45,8 @@ class Actionlog extends Model
|
||||||
return $this->morphTo('item')->withTrashed();
|
return $this->morphTo('item')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function company() {
|
public function company()
|
||||||
|
{
|
||||||
return $this->hasMany('\App\Models\Company', 'id', 'company_id');
|
return $this->hasMany('\App\Models\Company', 'id', 'company_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +59,8 @@ class Actionlog extends Model
|
||||||
return camel_case(class_basename($this->item_type));
|
return camel_case(class_basename($this->item_type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parseItemRoute() {
|
public function parseItemRoute()
|
||||||
|
{
|
||||||
if ($this->itemType() == "asset") {
|
if ($this->itemType() == "asset") {
|
||||||
$itemroute = 'assets';
|
$itemroute = 'assets';
|
||||||
} elseif ($this->itemType() == "accessory") {
|
} elseif ($this->itemType() == "accessory") {
|
||||||
|
@ -77,7 +79,8 @@ class Actionlog extends Model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function parseItemIcon() {
|
public function parseItemIcon()
|
||||||
|
{
|
||||||
if ($this->itemType() == "asset") {
|
if ($this->itemType() == "asset") {
|
||||||
$itemicon = 'fa fa-barcode';
|
$itemicon = 'fa fa-barcode';
|
||||||
} elseif ($this->itemType() == "accessory") {
|
} elseif ($this->itemType() == "accessory") {
|
||||||
|
|
|
@ -41,7 +41,8 @@ class AssetModel extends SnipeModel
|
||||||
protected $injectUniqueIdentifier = true;
|
protected $injectUniqueIdentifier = true;
|
||||||
use ValidatingTrait;
|
use ValidatingTrait;
|
||||||
|
|
||||||
public function setEolAttribute($value) {
|
public function setEolAttribute($value)
|
||||||
|
{
|
||||||
if ($value == '') {
|
if ($value == '') {
|
||||||
$value = 0;
|
$value = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,26 +164,32 @@ final class Company extends SnipeModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function users() {
|
public function users()
|
||||||
|
{
|
||||||
return $this->hasMany(User::class);
|
return $this->hasMany(User::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function assets() {
|
public function assets()
|
||||||
|
{
|
||||||
return $this->hasMany(Asset::class);
|
return $this->hasMany(Asset::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function licenses() {
|
public function licenses()
|
||||||
|
{
|
||||||
return $this->hasMany(License::class);
|
return $this->hasMany(License::class);
|
||||||
}
|
}
|
||||||
public function accessories() {
|
public function accessories()
|
||||||
|
{
|
||||||
return $this->hasMany(Accessory::class);
|
return $this->hasMany(Accessory::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function consumables() {
|
public function consumables()
|
||||||
|
{
|
||||||
return $this->hasMany(Consumable::class);
|
return $this->hasMany(Consumable::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function components() {
|
public function components()
|
||||||
|
{
|
||||||
return $this->hasMany(Component::class);
|
return $this->hasMany(Component::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,8 @@ class CustomField extends Model
|
||||||
* @since [v3.4]
|
* @since [v3.4]
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
public function formatFieldValuesAsArray() {
|
public function formatFieldValuesAsArray()
|
||||||
|
{
|
||||||
$arr = preg_split("/\\r\\n|\\r|\\n/", $this->field_values);
|
$arr = preg_split("/\\r\\n|\\r|\\n/", $this->field_values);
|
||||||
|
|
||||||
$result[''] = 'Select '.strtolower($this->format);
|
$result[''] = 'Select '.strtolower($this->format);
|
||||||
|
@ -143,14 +144,11 @@ class CustomField extends Model
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isFieldDecryptable($string) {
|
public function isFieldDecryptable($string)
|
||||||
|
{
|
||||||
if (($this->field_encrypted=='1') && ($string!='')) {
|
if (($this->field_encrypted=='1') && ($string!='')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,7 @@ class CustomFieldset extends Model
|
||||||
$rule = [];
|
$rule = [];
|
||||||
|
|
||||||
if (($field->field_encrypted!='1') ||
|
if (($field->field_encrypted!='1') ||
|
||||||
(($field->field_encrypted =='1') && (Gate::allows('admin')) ))
|
(($field->field_encrypted =='1') && (Gate::allows('admin')) )) {
|
||||||
{
|
|
||||||
|
|
||||||
if ($field->pivot->required) {
|
if ($field->pivot->required) {
|
||||||
$rule[]="required";
|
$rule[]="required";
|
||||||
}
|
}
|
||||||
|
@ -47,5 +45,4 @@ class CustomFieldset extends Model
|
||||||
}
|
}
|
||||||
return $rules;
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Exception;
|
||||||
use Input;
|
use Input;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
|
|
||||||
class Ldap extends Model
|
class Ldap extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -78,13 +77,10 @@ class Ldap extends Model
|
||||||
$ldap_username_field = $settings->ldap_username_field;
|
$ldap_username_field = $settings->ldap_username_field;
|
||||||
$baseDn = $settings->ldap_basedn;
|
$baseDn = $settings->ldap_basedn;
|
||||||
|
|
||||||
if ($settings->is_ad =='1')
|
if ($settings->is_ad =='1') {
|
||||||
{
|
|
||||||
|
|
||||||
// Check if they are using the userprincipalname for the username field.
|
// Check if they are using the userprincipalname for the username field.
|
||||||
// If they are, we can skip building the UPN to authenticate against AD
|
// If they are, we can skip building the UPN to authenticate against AD
|
||||||
if ($ldap_username_field=='userprincipalname')
|
if ($ldap_username_field=='userprincipalname') {
|
||||||
{
|
|
||||||
$userDn = $username;
|
$userDn = $username;
|
||||||
} else {
|
} else {
|
||||||
// In case they haven't added an AD domain
|
// In case they haven't added an AD domain
|
||||||
|
@ -238,7 +234,8 @@ class Ldap extends Model
|
||||||
* @param $ldapatttibutes
|
* @param $ldapatttibutes
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
static function findLdapUsers() {
|
static function findLdapUsers()
|
||||||
|
{
|
||||||
|
|
||||||
$ldapconn = Ldap::connectToLdap();
|
$ldapconn = Ldap::connectToLdap();
|
||||||
$ldap_bind = Ldap::bindAdminToLdap($ldapconn);
|
$ldap_bind = Ldap::bindAdminToLdap($ldapconn);
|
||||||
|
@ -291,8 +288,4 @@ class Ldap extends Model
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,8 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
|
||||||
->orWhere('username', '=', $user_email);
|
->orWhere('username', '=', $user_email);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateEmailFromFullName($name) {
|
public static function generateEmailFromFullName($name)
|
||||||
|
{
|
||||||
$username = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $name);
|
$username = User::generateFormattedNameFromFullName(Setting::getSettings()->email_format, $name);
|
||||||
return $username['username'].'@'.Setting::getSettings()->email_domain;
|
return $username['username'].'@'.Setting::getSettings()->email_domain;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ class CheckinNotification extends Notification
|
||||||
$notifyBy[] = 'slack';
|
$notifyBy[] = 'slack';
|
||||||
}
|
}
|
||||||
$item = $this->params['item'];
|
$item = $this->params['item'];
|
||||||
if (
|
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
|
||||||
(method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
|
|
||||||
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
||||||
) {
|
) {
|
||||||
$notifyBy[] = 'mail';
|
$notifyBy[] = 'mail';
|
||||||
|
|
|
@ -43,8 +43,7 @@ class CheckoutNotification extends Notification
|
||||||
}
|
}
|
||||||
$item = $this->params['item'];
|
$item = $this->params['item'];
|
||||||
|
|
||||||
if (
|
if ((method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
|
||||||
(method_exists($item, 'requireAcceptance') && ($item->requireAcceptance()=='1'))
|
|
||||||
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
|| (method_exists($item, 'getEula') && ($item->getEula()))
|
||||||
) {
|
) {
|
||||||
$notifyBy[] = 'mail';
|
$notifyBy[] = 'mail';
|
||||||
|
|
|
@ -77,5 +77,4 @@ class AssetPolicy
|
||||||
{
|
{
|
||||||
return $user->hasAccess('assets.edit');
|
return $user->hasAccess('assets.edit');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\SnipeModel;
|
use App\Models\SnipeModel;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
@ -10,7 +11,6 @@ use Illuminate\Support\Facades\Gate;
|
||||||
* @package App\Presenters
|
* @package App\Presenters
|
||||||
*/
|
*/
|
||||||
class AssetPresenter extends Presenter
|
class AssetPresenter extends Presenter
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,18 +48,21 @@ class AssetPresenter extends Presenter
|
||||||
|
|
||||||
$actions .= '</div>';
|
$actions .= '</div>';
|
||||||
|
|
||||||
if (($this->model->availableForCheckout()))
|
if (($this->model->availableForCheckout())) {
|
||||||
{
|
|
||||||
if (Gate::allows('checkout', $this->model)) {
|
if (Gate::allows('checkout', $this->model)) {
|
||||||
$inout = '<a href="' . route('checkout/hardware',
|
$inout = '<a href="' . route(
|
||||||
$this->model->id) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
|
'checkout/hardware',
|
||||||
|
$this->model->id
|
||||||
|
) . '" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">' . trans('general.checkout') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!empty($this->model->assigned_to)) {
|
if (!empty($this->model->assigned_to)) {
|
||||||
if (Gate::allows('checkin', $this->model)) {
|
if (Gate::allows('checkin', $this->model)) {
|
||||||
$inout = '<a href="' . route('checkin/hardware',
|
$inout = '<a href="' . route(
|
||||||
$this->model->id) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
|
'checkin/hardware',
|
||||||
|
$this->model->id
|
||||||
|
) . '" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">' . trans('general.checkin') . '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CompanyPresenter
|
* Class CompanyPresenter
|
||||||
* @package App\Presenters
|
* @package App\Presenters
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\SnipeModel;
|
use App\Models\SnipeModel;
|
||||||
|
|
||||||
abstract class Presenter
|
abstract class Presenter
|
||||||
|
@ -79,5 +78,4 @@ abstract class Presenter
|
||||||
{
|
{
|
||||||
return $this->model->$method($args);
|
return $this->model->$method($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace App\Presenters;
|
namespace App\Presenters;
|
||||||
|
|
||||||
|
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
|
@ -6,7 +6,6 @@ use Illuminate\Support\ServiceProvider;
|
||||||
use DB;
|
use DB;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This service provider handles a few custom validation rules.
|
* This service provider handles a few custom validation rules.
|
||||||
*
|
*
|
||||||
|
@ -31,8 +30,7 @@ class AppServiceProvider extends ServiceProvider
|
||||||
$value = str_replace(' ', '', $value);
|
$value = str_replace(' ', '', $value);
|
||||||
$array = explode(',', $value);
|
$array = explode(',', $value);
|
||||||
|
|
||||||
foreach($array as $email) //loop over values
|
foreach ($array as $email) { //loop over values
|
||||||
{
|
|
||||||
$email_to_validate['alert_email'][]=$email;
|
$email_to_validate['alert_email'][]=$email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class MacroServiceProvider extends ServiceProvider {
|
class MacroServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap the application services.
|
* Bootstrap the application services.
|
||||||
|
@ -27,5 +28,4 @@ class MacroServiceProvider extends ServiceProvider {
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue