mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 06:29:47 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
423e7439ee
|
@ -23,6 +23,7 @@ use Redirect;
|
||||||
use Str;
|
use Str;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
use View;
|
use View;
|
||||||
|
use App\Notifications\CurrentInventory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This controller handles all actions related to Users for
|
* This controller handles all actions related to Users for
|
||||||
|
@ -615,6 +616,28 @@ class UsersController extends Controller
|
||||||
->with('settings', Setting::getSettings());
|
->with('settings', Setting::getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emails user a list of assigned assets
|
||||||
|
*
|
||||||
|
* @author [G. Martinez] [<godmartinz@gmail.com>]
|
||||||
|
* @since [v6.0.5]
|
||||||
|
* @param \App\Http\Controllers\Users\UsersController $id
|
||||||
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
*/
|
||||||
|
public function emailAssetList($id)
|
||||||
|
{
|
||||||
|
$this->authorize('view', User::class);
|
||||||
|
|
||||||
|
if( User::where('id', $id)->first()->exists())
|
||||||
|
{
|
||||||
|
$user= User::where('id', $id)->first();
|
||||||
|
$user->notify((new CurrentInventory($user)));
|
||||||
|
return redirect()->back()->with('success', 'admin/users/general.user_notified');
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->back()->with('error', 'admin/accessories/message.user_does_not_exist');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send individual password reset email
|
* Send individual password reset email
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,7 +42,7 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
);
|
);
|
||||||
|
|
||||||
$config['validations'][$core.'emails'] = 'nullable|array'; // emails are not required in Snipe-IT...
|
$config['validations'][$core.'emails'] = 'nullable|array'; // emails are not required in Snipe-IT...
|
||||||
$config['validations'][$core.'emails.*.value'] = 'required|email'; // ...but if you give us one, it better be an email address
|
$config['validations'][$core.'emails.*.value'] = 'email'; // ...(had to remove the recommended 'required' here)
|
||||||
|
|
||||||
$mappings['emails'] = [[
|
$mappings['emails'] = [[
|
||||||
"value" => AttributeMapping::eloquent("email"),
|
"value" => AttributeMapping::eloquent("email"),
|
||||||
|
@ -58,7 +58,7 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
|
|
||||||
//phone
|
//phone
|
||||||
$config['validations'][$core.'phoneNumbers'] = 'nullable|array';
|
$config['validations'][$core.'phoneNumbers'] = 'nullable|array';
|
||||||
$config['validations'][$core.'phoneNumbers.*.value'] = 'required';
|
$config['validations'][$core.'phoneNumbers.*.value'] = 'string'; // another one where want to say 'we don't _need_ a phone number, but if you have one it better have a value.
|
||||||
|
|
||||||
$mappings['phoneNumbers'] = [[
|
$mappings['phoneNumbers'] = [[
|
||||||
"value" => AttributeMapping::eloquent("phone"),
|
"value" => AttributeMapping::eloquent("phone"),
|
||||||
|
@ -69,10 +69,10 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
|
|
||||||
//address
|
//address
|
||||||
$config['validations'][$core.'addresses'] = 'nullable|array';
|
$config['validations'][$core.'addresses'] = 'nullable|array';
|
||||||
$config['validations'][$core.'addresses.*.streetAddress'] = 'required';
|
$config['validations'][$core.'addresses.*.streetAddress'] = 'string';
|
||||||
$config['validations'][$core.'addresses.*.locality'] = 'string';
|
$config['validations'][$core.'addresses.*.locality'] = 'string';
|
||||||
$config['validations'][$core.'addresses.*.region'] = 'string';
|
$config['validations'][$core.'addresses.*.region'] = 'nullable|string';
|
||||||
$config['validations'][$core.'addresses.*.postalCode'] = 'string';
|
$config['validations'][$core.'addresses.*.postalCode'] = 'nullable|string';
|
||||||
$config['validations'][$core.'addresses.*.country'] = 'string';
|
$config['validations'][$core.'addresses.*.country'] = 'string';
|
||||||
|
|
||||||
$mappings['addresses'] = [[
|
$mappings['addresses'] = [[
|
||||||
|
@ -118,7 +118,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
'employeeNumber' => AttributeMapping::eloquent('employee_num'),
|
'employeeNumber' => AttributeMapping::eloquent('employee_num'),
|
||||||
'department' =>(new AttributeMapping())->setAdd( // FIXME parent?
|
'department' =>(new AttributeMapping())->setAdd( // FIXME parent?
|
||||||
function ($value, &$object) {
|
function ($value, &$object) {
|
||||||
\Log::error("Department-Add: $value"); //FIXME
|
|
||||||
$department = Department::where("name", $value)->first();
|
$department = Department::where("name", $value)->first();
|
||||||
if ($department) {
|
if ($department) {
|
||||||
$object->department_id = $department->id;
|
$object->department_id = $department->id;
|
||||||
|
@ -126,7 +125,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
}
|
}
|
||||||
)->setReplace(
|
)->setReplace(
|
||||||
function ($value, &$object) {
|
function ($value, &$object) {
|
||||||
\Log::error("Department-Replace: $value"); //FIXME
|
|
||||||
$department = Department::where("name", $value)->first();
|
$department = Department::where("name", $value)->first();
|
||||||
if ($department) {
|
if ($department) {
|
||||||
$object->department_id = $department->id;
|
$object->department_id = $department->id;
|
||||||
|
@ -134,7 +132,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
}
|
}
|
||||||
)->setRead(
|
)->setRead(
|
||||||
function (&$object) {
|
function (&$object) {
|
||||||
\Log::error("Weird department reader firing..."); //FIXME
|
|
||||||
return $object->department ? $object->department->name : null;
|
return $object->department ? $object->department->name : null;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
@ -145,7 +142,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
// NOTE: you could probably do a 'plain' Eloquent mapping here, but we don't for future-proofing
|
// NOTE: you could probably do a 'plain' Eloquent mapping here, but we don't for future-proofing
|
||||||
'value' => (new AttributeMapping())->setAdd(
|
'value' => (new AttributeMapping())->setAdd(
|
||||||
function ($value, &$object) {
|
function ($value, &$object) {
|
||||||
\Log::error("Manager-Add: $value"); //FIXME
|
|
||||||
$manager = User::find($value);
|
$manager = User::find($value);
|
||||||
if ($manager) {
|
if ($manager) {
|
||||||
$object->manager_id = $manager->id;
|
$object->manager_id = $manager->id;
|
||||||
|
@ -153,7 +149,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
}
|
}
|
||||||
)->setReplace(
|
)->setReplace(
|
||||||
function ($value, &$object) {
|
function ($value, &$object) {
|
||||||
\Log::error("Manager-Replace: $value"); //FIXME
|
|
||||||
$manager = User::find($value);
|
$manager = User::find($value);
|
||||||
if ($manager) {
|
if ($manager) {
|
||||||
$object->manager_id = $manager->id;
|
$object->manager_id = $manager->id;
|
||||||
|
@ -161,7 +156,6 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||||
}
|
}
|
||||||
)->setRead(
|
)->setRead(
|
||||||
function (&$object) {
|
function (&$object) {
|
||||||
\Log::error("Weird manager reader firing..."); //FIXME
|
|
||||||
return $object->manager_id;
|
return $object->manager_id;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
|
@ -17,6 +17,8 @@ return [
|
||||||
'last_login' => 'Last Login',
|
'last_login' => 'Last Login',
|
||||||
'ldap_config_text' => 'LDAP configuration settings can be found Admin > Settings. The (optional) selected location will be set for all imported users.',
|
'ldap_config_text' => 'LDAP configuration settings can be found Admin > Settings. The (optional) selected location will be set for all imported users.',
|
||||||
'print_assigned' => 'Print All Assigned',
|
'print_assigned' => 'Print All Assigned',
|
||||||
|
'email_assigned' => 'Email List of All Assigned',
|
||||||
|
'user_notified' => 'User has been emailed a list of their currently assigned items.',
|
||||||
'software_user' => 'Software Checked out to :name',
|
'software_user' => 'Software Checked out to :name',
|
||||||
'send_email_help' => 'You must provide an email address for this user to send them credentials. Emailing credentials can only be done on user creation. Passwords are stored in a one-way hash and cannot be retrieved once saved.',
|
'send_email_help' => 'You must provide an email address for this user to send them credentials. Emailing credentials can only be done on user creation. Passwords are stored in a one-way hash and cannot be retrieved once saved.',
|
||||||
'view_user' => 'View User :name',
|
'view_user' => 'View User :name',
|
||||||
|
|
|
@ -188,6 +188,15 @@
|
||||||
</div>
|
</div>
|
||||||
@endcan
|
@endcan
|
||||||
|
|
||||||
|
@can('view', $user)
|
||||||
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
<form action="{{ route('users.email',['userId'=> $user->id]) }}" method="POST">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
<button style="width: 100%;" class="btn btn-sm btn-primary hidden-print" rel="noopener">{{ trans('admin/users/general.email_assigned') }}</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
@endcan
|
||||||
|
|
||||||
@can('update', $user)
|
@can('update', $user)
|
||||||
@if (($user->activated == '1') && ($user->email != '') && ($user->ldap_import == '0'))
|
@if (($user->activated == '1') && ($user->email != '') && ($user->ldap_import == '0'))
|
||||||
<div class="col-md-12" style="padding-top: 5px;">
|
<div class="col-md-12" style="padding-top: 5px;">
|
||||||
|
|
|
@ -144,6 +144,14 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () {
|
||||||
]
|
]
|
||||||
)->name('users.print');
|
)->name('users.print');
|
||||||
|
|
||||||
|
Route::post(
|
||||||
|
'{userId}/email',
|
||||||
|
[
|
||||||
|
Users\UsersController::class,
|
||||||
|
'emailAssetList'
|
||||||
|
]
|
||||||
|
)->name('users.email');
|
||||||
|
|
||||||
Route::post(
|
Route::post(
|
||||||
'bulkedit',
|
'bulkedit',
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue