mirror of
https://github.com/snipe/snipe-it.git
synced 2025-10-29 11:21:21 +00:00
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net> # Conflicts: # public/css/build/app.css # public/css/build/app.css.map # public/css/build/overrides.css # public/css/build/overrides.css.map # public/css/dist/all.css # public/mix-manifest.json
This commit is contained in:
commit
3461bbfdb3
@ -4216,6 +4216,24 @@
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "nickwest",
|
||||
"name": "Nicky West",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/634790?v=4",
|
||||
"profile": "http://nickwest.me",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "akaspeh1",
|
||||
"name": "akaspeh1",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/1347327?v=4",
|
||||
"profile": "https://github.com/akaspeh1",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@ -193,11 +193,17 @@ LDAP_TIME_LIM=600
|
||||
IMPORT_TIME_LIMIT=600
|
||||
IMPORT_MEMORY_LIMIT=500M
|
||||
REPORT_TIME_LIMIT=12000
|
||||
REQUIRE_SAML=false
|
||||
API_THROTTLE_PER_MINUTE=120
|
||||
CSV_ESCAPE_FORMULAS=true
|
||||
LIVEWIRE_URL_PREFIX=null
|
||||
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: SAML SETTINGS
|
||||
# --------------------------------------------
|
||||
REQUIRE_SAML=false
|
||||
SAML_KEY_SIZE=2048
|
||||
|
||||
# --------------------------------------------
|
||||
# OPTIONAL: HASHING
|
||||
# --------------------------------------------
|
||||
|
||||
2
.github/workflows/SA-codeql.yml
vendored
2
.github/workflows/SA-codeql.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
language: [ 'javascript' ]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
2
.github/workflows/codacy-analysis.yml
vendored
2
.github/workflows/codacy-analysis.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
steps:
|
||||
# Checkout the repository to the GitHub Actions runner
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
|
||||
2
.github/workflows/crowdin-upload.yml
vendored
2
.github/workflows/crowdin-upload.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Crowdin push
|
||||
uses: crowdin/github-action@v2
|
||||
|
||||
2
.github/workflows/docker-alpine.yml
vendored
2
.github/workflows/docker-alpine.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
|
||||
2
.github/workflows/docker-ubuntu.yml
vendored
2
.github/workflows/docker-ubuntu.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- name: Checkout codebase
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# https://github.com/docker/setup-buildx-action
|
||||
- name: Setup Docker Buildx
|
||||
|
||||
2
.github/workflows/dockerhub-description.yml
vendored
2
.github/workflows/dockerhub-description.yml
vendored
@ -11,7 +11,7 @@ jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Docker Hub Description
|
||||
uses: grokability/dockerhub-description@7ea9d275c7cdbe2b676a093a0308c50665e3b8b4
|
||||
|
||||
2
.github/workflows/tests-mysql.yml
vendored
2
.github/workflows/tests-mysql.yml
vendored
@ -37,7 +37,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
2
.github/workflows/tests-postgres.yml
vendored
2
.github/workflows/tests-postgres.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
2
.github/workflows/tests-sqlite.yml
vendored
2
.github/workflows/tests-sqlite.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
php-version: "${{ matrix.php-version }}"
|
||||
coverage: none
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Get Composer Cache Directory
|
||||
id: composer-cache
|
||||
|
||||
@ -68,7 +68,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
||||
| [<img src="https://avatars.githubusercontent.com/u/181059?v=4" width="110px;"/><br /><sub>Juan Font</sub>](https://github.com/juanfont)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juanfont "Code") | [<img src="https://avatars.githubusercontent.com/u/13137708?v=4" width="110px;"/><br /><sub>Juho Taipale</sub>](https://github.com/juhotaipale)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juhotaipale "Code") | [<img src="https://avatars.githubusercontent.com/u/1007419?v=4" width="110px;"/><br /><sub>Korvin Szanto</sub>](https://github.com/KorvinSzanto)<br />[💻](https://github.com/snipe/snipe-it/commits?author=KorvinSzanto "Code") | [<img src="https://avatars.githubusercontent.com/u/8513053?v=4" width="110px;"/><br /><sub>Lewis Foster</sub>](https://lewisfoster.foo/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sniff122 "Code") | [<img src="https://avatars.githubusercontent.com/u/33877541?v=4" width="110px;"/><br /><sub>Logan Swartzendruber</sub>](https://github.com/loganswartz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=loganswartz "Code") | [<img src="https://avatars.githubusercontent.com/u/1156208?v=4" width="110px;"/><br /><sub>Lorenzo P.</sub>](https://github.com/lopezio)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lopezio "Code") | [<img src="https://avatars.githubusercontent.com/u/33946590?v=4" width="110px;"/><br /><sub>Lukas Jung</sub>](https://github.com/m4us1ne)<br />[💻](https://github.com/snipe/snipe-it/commits?author=m4us1ne "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/10965027?v=4" width="110px;"/><br /><sub>Ellie</sub>](https://leafedfox.xyz/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeafedFox "Code") | [<img src="https://avatars.githubusercontent.com/u/20960555?v=4" width="110px;"/><br /><sub>GA Stamper</sub>](https://github.com/gastamper)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gastamper "Code") | [<img src="https://avatars.githubusercontent.com/u/206553556?v=4" width="110px;"/><br /><sub>Guillaume Lefranc</sub>](https://github.com/gl-pup)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gl-pup "Code") | [<img src="https://avatars.githubusercontent.com/u/733892?v=4" width="110px;"/><br /><sub>Hajo Möller</sub>](https://github.com/dasjoe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dasjoe "Code") | [<img src="https://avatars.githubusercontent.com/u/3420063?v=4" width="110px;"/><br /><sub>Istvan Basa</sub>](https://github.com/pottom)<br />[💻](https://github.com/snipe/snipe-it/commits?author=pottom "Code") | [<img src="https://avatars.githubusercontent.com/u/810824?v=4" width="110px;"/><br /><sub>JJ Asghar</sub>](https://jjasghar.github.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jjasghar "Code") | [<img src="https://avatars.githubusercontent.com/u/40404495?v=4" width="110px;"/><br /><sub>James E. Msenga</sub>](https://github.com/JemCdo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JemCdo "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/6865786?v=4" width="110px;"/><br /><sub>Jan Felix Wiebe</sub>](https://github.com/jfwiebe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jfwiebe "Code") | [<img src="https://avatars.githubusercontent.com/u/43412008?v=4" width="110px;"/><br /><sub>Jo Drexl</sub>](https://www.nfon.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=drexljo "Code") | [<img src="https://avatars.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>Austin Sasko</sub>](https://github.com/austinsasko)<br />[💻](https://github.com/snipe/snipe-it/commits?author=austinsasko "Code") | [<img src="https://avatars.githubusercontent.com/u/4875039?v=4" width="110px;"/><br /><sub>Jasson</sub>](http://jassoncordones.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JassonCordones "Code") | [<img src="https://avatars.githubusercontent.com/u/76069640?v=4" width="110px;"/><br /><sub>Okean</sub>](https://github.com/Tinyblargon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Tinyblargon "Code") | [<img src="https://avatars.githubusercontent.com/u/6515064?v=4" width="110px;"/><br /><sub>Alejandro Medrano</sub>](https://www.lst.tfo.upm.es/alejandro-medrano/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=amedranogil "Code") | [<img src="https://avatars.githubusercontent.com/u/58696401?v=4" width="110px;"/><br /><sub>Lukas Kraic</sub>](https://github.com/lukaskraic)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lukaskraic "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/1571724?v=4" width="110px;"/><br /><sub>Герхард PICCORO Lenz McKAY </sub>](https://github-readme-stats.vercel.app/api?username=mckaygerhard)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mckaygerhard "Code") | [<img src="https://avatars.githubusercontent.com/u/15015119?v=4" width="110px;"/><br /><sub>Johannes Pollitt</sub>](https://github.com/FlorestanII)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorestanII "Code") | [<img src="https://avatars.githubusercontent.com/u/14185442?v=4" width="110px;"/><br /><sub>Michael Strobel</sub>](https://strobelm.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=strobelm "Code") |
|
||||
| [<img src="https://avatars.githubusercontent.com/u/1571724?v=4" width="110px;"/><br /><sub>Герхард PICCORO Lenz McKAY </sub>](https://github-readme-stats.vercel.app/api?username=mckaygerhard)<br />[💻](https://github.com/snipe/snipe-it/commits?author=mckaygerhard "Code") | [<img src="https://avatars.githubusercontent.com/u/15015119?v=4" width="110px;"/><br /><sub>Johannes Pollitt</sub>](https://github.com/FlorestanII)<br />[💻](https://github.com/snipe/snipe-it/commits?author=FlorestanII "Code") | [<img src="https://avatars.githubusercontent.com/u/14185442?v=4" width="110px;"/><br /><sub>Michael Strobel</sub>](https://strobelm.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=strobelm "Code") | [<img src="https://avatars.githubusercontent.com/u/634790?v=4" width="110px;"/><br /><sub>Nicky West</sub>](http://nickwest.me)<br />[💻](https://github.com/snipe/snipe-it/commits?author=nickwest "Code") | [<img src="https://avatars.githubusercontent.com/u/1347327?v=4" width="110px;"/><br /><sub>akaspeh1</sub>](https://github.com/akaspeh1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=akaspeh1 "Code") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
||||
@ -55,6 +55,8 @@ class LdapSync extends Command
|
||||
ini_set('max_execution_time', env('LDAP_TIME_LIM', 600)); //600 seconds = 10 minutes
|
||||
ini_set('memory_limit', env('LDAP_MEM_LIM', '500M'));
|
||||
|
||||
|
||||
// Map the LDAP attributes to the Snipe-IT user fields.
|
||||
$ldap_map = [
|
||||
"username" => Setting::getSettings()->ldap_username_field,
|
||||
"last_name" => Setting::getSettings()->ldap_lname_field,
|
||||
@ -63,11 +65,17 @@ class LdapSync extends Command
|
||||
"emp_num" => Setting::getSettings()->ldap_emp_num,
|
||||
"email" => Setting::getSettings()->ldap_email,
|
||||
"phone" => Setting::getSettings()->ldap_phone_field,
|
||||
"mobile" => Setting::getSettings()->ldap_mobile,
|
||||
"jobtitle" => Setting::getSettings()->ldap_jobtitle,
|
||||
"address" => Setting::getSettings()->ldap_address,
|
||||
"city" => Setting::getSettings()->ldap_city,
|
||||
"state" => Setting::getSettings()->ldap_state,
|
||||
"zip" => Setting::getSettings()->ldap_zip,
|
||||
"country" => Setting::getSettings()->ldap_country,
|
||||
"location" => Setting::getSettings()->ldap_location,
|
||||
"dept" => Setting::getSettings()->ldap_dept,
|
||||
"manager" => Setting::getSettings()->ldap_manager,
|
||||
"display_name" => Setting::getSettings()->ldap_display_name,
|
||||
];
|
||||
|
||||
$ldap_default_group = Setting::getSettings()->ldap_default_group;
|
||||
@ -234,9 +242,11 @@ class LdapSync extends Command
|
||||
}
|
||||
|
||||
|
||||
// Assign the mapped LDAP attributes for each user to the Snipe-IT user fields
|
||||
for ($i = 0; $i < $results['count']; $i++) {
|
||||
$item = [];
|
||||
$item['username'] = $results[$i][$ldap_map["username"]][0] ?? '';
|
||||
$item['display_name'] = $results[$i][$ldap_map["display_name"]][0] ?? '';
|
||||
$item['employee_number'] = $results[$i][$ldap_map["emp_num"]][0] ?? '';
|
||||
$item['lastname'] = $results[$i][$ldap_map["last_name"]][0] ?? '';
|
||||
$item['firstname'] = $results[$i][$ldap_map["first_name"]][0] ?? '';
|
||||
@ -244,8 +254,13 @@ class LdapSync extends Command
|
||||
$item['ldap_location_override'] = $results[$i]['ldap_location_override'] ?? '';
|
||||
$item['location_id'] = $results[$i]['location_id'] ?? '';
|
||||
$item['telephone'] = $results[$i][$ldap_map["phone"]][0] ?? '';
|
||||
$item['mobile'] = $results[$i][$ldap_map["mobile"]][0] ?? '';
|
||||
$item['jobtitle'] = $results[$i][$ldap_map["jobtitle"]][0] ?? '';
|
||||
$item['address'] = $results[$i][$ldap_map["ldap_address"]][0] ?? '';
|
||||
$item['city'] = $results[$i][$ldap_map["city"]][0] ?? '';
|
||||
$item['state'] = $results[$i][$ldap_map["state"]][0] ?? '';
|
||||
$item['country'] = $results[$i][$ldap_map["country"]][0] ?? '';
|
||||
$item['zip'] = $results[$i][$ldap_map["zip"]][0] ?? '';
|
||||
$item['department'] = $results[$i][$ldap_map["dept"]][0] ?? '';
|
||||
$item['manager'] = $results[$i][$ldap_map["manager"]][0] ?? '';
|
||||
$item['location'] = $results[$i][$ldap_map["location"]][0] ?? '';
|
||||
@ -278,6 +293,9 @@ class LdapSync extends Command
|
||||
if($ldap_map["username"] != null){
|
||||
$user->username = $item['username'];
|
||||
}
|
||||
if($ldap_map["display_name"] != null){
|
||||
$user->display_name = $item['display_name'];
|
||||
}
|
||||
if($ldap_map["last_name"] != null){
|
||||
$user->last_name = $item['lastname'];
|
||||
}
|
||||
@ -293,6 +311,9 @@ class LdapSync extends Command
|
||||
if($ldap_map["phone"] != null){
|
||||
$user->phone = $item['telephone'];
|
||||
}
|
||||
if($ldap_map["mobile"] != null){
|
||||
$user->mobile = $item['mobile'];
|
||||
}
|
||||
if($ldap_map["jobtitle"] != null){
|
||||
$user->jobtitle = $item['jobtitle'];
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ class SendAcceptanceReminder extends Command
|
||||
if(!$email){
|
||||
$no_email_list[] = [
|
||||
'id' => $acceptance->assignedTo?->id,
|
||||
'name' => $acceptance->assignedTo?->present()->fullName(),
|
||||
'name' => $acceptance->assignedTo?->display_name,
|
||||
];
|
||||
} else {
|
||||
$count++;
|
||||
|
||||
@ -610,7 +610,7 @@ class AssetsController extends Controller
|
||||
$asset->use_text = $asset->present()->fullName;
|
||||
|
||||
if (($asset->checkedOutToUser()) && ($asset->assigned)) {
|
||||
$asset->use_text .= ' → ' . $asset->assigned->getFullNameAttribute();
|
||||
$asset->use_text .= ' → ' . $asset->assigned->display_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -230,13 +230,13 @@ class ConsumablesController extends Controller
|
||||
'avatar' => ($consumable_assignment->user) ? e($consumable_assignment->user->present()->gravatar) : '',
|
||||
'user' => ($consumable_assignment->user) ? [
|
||||
'id' => (int) $consumable_assignment->user->id,
|
||||
'name'=> e($consumable_assignment->user->present()->fullName()),
|
||||
'name'=> e($consumable_assignment->user->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($consumable_assignment->created_at, 'datetime'),
|
||||
'note' => ($consumable_assignment->note) ? e($consumable_assignment->note) : null,
|
||||
'created_by' => ($consumable_assignment->adminuser) ? [
|
||||
'id' => (int) $consumable_assignment->adminuser->id,
|
||||
'name'=> e($consumable_assignment->adminuser->present()->fullName()),
|
||||
'name'=> e($consumable_assignment->adminuser->display_name),
|
||||
] : null,
|
||||
];
|
||||
}
|
||||
|
||||
95
app/Http/Controllers/Api/NotesController.php
Normal file
95
app/Http/Controllers/Api/NotesController.php
Normal file
@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* This class controls all API actions related to notes for
|
||||
* the Snipe-IT Asset Management application.
|
||||
*/
|
||||
class NotesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Retrieve a list of manual notes (action logs) for a given asset.
|
||||
*
|
||||
* Checks authorization to view assets, attempts to find the asset by ID,
|
||||
* and fetches related action log entries of type 'note added', including
|
||||
* user information for each note. Returns a JSON response with the notes or errors.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request The incoming HTTP request.
|
||||
* @param Asset $asset The ID of the asset whose notes to retrieve.
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function index(Asset $asset): JsonResponse
|
||||
{
|
||||
$this->authorize('view', $asset);
|
||||
|
||||
// Get the manual notes for the asset
|
||||
$notes = ActionLog::with('user:id,username')
|
||||
->where('item_type', Asset::class)
|
||||
->where('item_id', $asset->id)
|
||||
->where('action_type', 'note added')
|
||||
->orderBy('created_at', 'desc')
|
||||
->get(['id', 'created_at', 'note', 'created_by', 'item_id', 'item_type', 'action_type', 'target_id', 'target_type']);
|
||||
|
||||
$notesArray = $notes->map(function ($note) {
|
||||
return [
|
||||
'id' => $note->id,
|
||||
'created_at' => $note->created_at,
|
||||
'note' => $note->note,
|
||||
'created_by' => $note->created_by,
|
||||
'username' => $note->user?->username, // adding the username
|
||||
'item_id' => $note->item_id,
|
||||
'item_type' => $note->item_type,
|
||||
'action_type' => $note->action_type,
|
||||
];
|
||||
});
|
||||
|
||||
// Return a success response
|
||||
return response()->json(Helper::formatStandardApiResponse('success', ['notes' => $notesArray, 'asset_id' => $asset->id]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a manual note on a specified asset and log the action.
|
||||
*
|
||||
* Checks authorization for updating assets, validates the presence of the 'note',
|
||||
* attempts to find the asset by ID, and creates a new ActionLog entry if successful.
|
||||
* Returns JSON responses indicating success or failure with appropriate HTTP status codes.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request The incoming HTTP request containing the 'note'.
|
||||
* @param Asset $asset The ID of the asset to attach the note to.
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function store(Request $request, Asset $asset): JsonResponse
|
||||
{
|
||||
$this->authorize('update', $asset);
|
||||
|
||||
if ($request->input('note', '') == '') {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('validation.required', ['attribute' => 'note'])), 422);
|
||||
}
|
||||
|
||||
// Create the note
|
||||
$logaction = new ActionLog();
|
||||
$logaction->item_type = get_class($asset);
|
||||
$logaction->created_by = Auth::id();
|
||||
$logaction->item_id = $asset->id;
|
||||
$logaction->note = $request->input('note', '');
|
||||
|
||||
if ($logaction->logaction('note added')) {
|
||||
// Return a success response
|
||||
return response()->json(Helper::formatStandardApiResponse('success', ['note' => $logaction->note, 'item_id' => $asset->id], trans('general.note_added')));
|
||||
}
|
||||
|
||||
// Return an error response if something went wrong
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'Something went wrong'), 500);
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,6 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Helpers\StorageHelper;
|
||||
use App\Http\Transformers\DatatablesTransformer;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
@ -51,10 +50,22 @@ class SettingsController extends Controller
|
||||
})->slice(0, 10)->map(function ($item) use ($settings) {
|
||||
return (object) [
|
||||
'username' => $item[$settings['ldap_username_field']][0] ?? null,
|
||||
'display_name' => $item[$settings['ldap_display_name']][0] ?? null,
|
||||
'employee_number' => $item[$settings['ldap_emp_num']][0] ?? null,
|
||||
'lastname' => $item[$settings['ldap_lname_field']][0] ?? null,
|
||||
'firstname' => $item[$settings['ldap_fname_field']][0] ?? null,
|
||||
'email' => $item[$settings['ldap_email']][0] ?? null,
|
||||
'phone' => $item[$settings['ldap_phone_field']][0] ?? null,
|
||||
'mobile' => $item[$settings['ldap_mobile']][0] ?? null,
|
||||
'jobtitle' => $item[$settings['ldap_jobtitle']][0] ?? null,
|
||||
'department' => $item[$settings['ldap_department']][0] ?? null,
|
||||
'manager' => $item[$settings['ldap_manager']][0] ?? null,
|
||||
'address' => $item[$settings['ldap_address']][0] ?? null,
|
||||
'city' => $item[$settings['ldap_city']][0] ?? null,
|
||||
'state' => $item[$settings['ldap_state']][0] ?? null,
|
||||
'zip' => $item[$settings['ldap_zip']][0] ?? null,
|
||||
'country' => $item[$settings['ldap_country']][0] ?? null,
|
||||
'location' => $item[$settings['ldap_location']][0] ?? null,
|
||||
];
|
||||
});
|
||||
if ($users->count() > 0) {
|
||||
|
||||
@ -64,6 +64,7 @@ class UsersController extends Controller
|
||||
'users.jobtitle',
|
||||
'users.last_login',
|
||||
'users.last_name',
|
||||
'users.display_name',
|
||||
'users.locale',
|
||||
'users.location_id',
|
||||
'users.manager_id',
|
||||
@ -154,6 +155,10 @@ class UsersController extends Controller
|
||||
$users = $users->where('users.last_name', '=', $request->input('last_name'));
|
||||
}
|
||||
|
||||
if ($request->filled('display_name')) {
|
||||
$users = $users->where('users.display_name', '=', $request->input('display_name'));
|
||||
}
|
||||
|
||||
if ($request->filled('employee_num')) {
|
||||
$users = $users->where('users.employee_num', '=', $request->input('employee_num'));
|
||||
}
|
||||
@ -284,6 +289,7 @@ class UsersController extends Controller
|
||||
[
|
||||
'last_name',
|
||||
'first_name',
|
||||
'display_name',
|
||||
'email',
|
||||
'jobtitle',
|
||||
'username',
|
||||
@ -355,6 +361,7 @@ class UsersController extends Controller
|
||||
'users.employee_num',
|
||||
'users.first_name',
|
||||
'users.last_name',
|
||||
'users.display_name',
|
||||
'users.gravatar',
|
||||
'users.avatar',
|
||||
'users.email',
|
||||
@ -365,20 +372,17 @@ class UsersController extends Controller
|
||||
$users = $users->where(function ($query) use ($request) {
|
||||
$query->SimpleNameSearch($request->get('search'))
|
||||
->orWhere('username', 'LIKE', '%'.$request->get('search').'%')
|
||||
->orWhere('display_name', 'LIKE', '%'.$request->get('search').'%')
|
||||
->orWhere('email', 'LIKE', '%'.$request->get('search').'%')
|
||||
->orWhere('employee_num', 'LIKE', '%'.$request->get('search').'%');
|
||||
});
|
||||
}
|
||||
|
||||
$users = $users->orderBy('last_name', 'asc')->orderBy('first_name', 'asc');
|
||||
$users = $users->orderBy('display_name', 'asc')->orderBy('last_name', 'asc')->orderBy('first_name', 'asc');
|
||||
$users = $users->paginate(50);
|
||||
|
||||
foreach ($users as $user) {
|
||||
$name_str = '';
|
||||
if ($user->last_name != '') {
|
||||
$name_str .= $user->last_name.', ';
|
||||
}
|
||||
$name_str .= $user->first_name;
|
||||
$name_str = $user->display_name;
|
||||
|
||||
if ($user->username != '') {
|
||||
$name_str .= ' ('.$user->username.')';
|
||||
@ -511,6 +515,10 @@ class UsersController extends Controller
|
||||
$user->username = $request->input('username');
|
||||
}
|
||||
|
||||
if ($request->filled('display_name')) {
|
||||
$user->display_name = $request->input('display_name');
|
||||
}
|
||||
|
||||
if ($request->filled('email')) {
|
||||
$user->email = $request->input('email');
|
||||
}
|
||||
|
||||
@ -797,7 +797,7 @@ class AssetsController extends Controller
|
||||
'item_id' => $asset->id,
|
||||
'item_type' => Asset::class,
|
||||
'created_by' => auth()->id(),
|
||||
'note' => 'Checkout imported by '.auth()->user()->present()->fullName().' from history importer',
|
||||
'note' => 'Checkout imported by '.auth()->user()->display_name.' from history importer',
|
||||
'target_id' => $item[$asset_tag][$batch_counter]['user_id'],
|
||||
'target_type' => User::class,
|
||||
'created_at' => $item[$asset_tag][$batch_counter]['checkout_date'],
|
||||
@ -825,7 +825,7 @@ class AssetsController extends Controller
|
||||
'item_id' => $item[$asset_tag][$batch_counter]['asset_id'],
|
||||
'item_type' => Asset::class,
|
||||
'created_by' => auth()->id(),
|
||||
'note' => 'Checkin imported by '.auth()->user()->present()->fullName().' from history importer',
|
||||
'note' => 'Checkin imported by '.auth()->user()->display_name.' from history importer',
|
||||
'target_id' => null,
|
||||
'created_at' => $checkin_date,
|
||||
'action_type' => 'checkin',
|
||||
|
||||
@ -364,7 +364,7 @@ class LicensesController extends Controller
|
||||
$license->order_number,
|
||||
$license->free_seat_count,
|
||||
$license->seats,
|
||||
($license->adminuser ? $license->adminuser->present()->fullName() : trans('admin/reports/general.deleted_user')),
|
||||
($license->adminuser ? $license->adminuser->display_name : trans('admin/reports/general.deleted_user')),
|
||||
$license->depreciation ? $license->depreciation->name: '',
|
||||
$license->updated_at,
|
||||
$license->deleted_at,
|
||||
|
||||
@ -275,7 +275,7 @@ class ReportsController extends Controller
|
||||
|
||||
if ($actionlog->target) {
|
||||
if ($actionlog->targetType() == 'user') {
|
||||
$target_name = $actionlog->target->getFullNameAttribute();
|
||||
$target_name = $actionlog->target->display_name;
|
||||
} else {
|
||||
$target_name = $actionlog->target->getDisplayNameAttribute();
|
||||
}
|
||||
@ -289,7 +289,7 @@ class ReportsController extends Controller
|
||||
|
||||
$row = [
|
||||
$actionlog->created_at,
|
||||
($actionlog->adminuser) ? e($actionlog->adminuser->getFullNameAttribute()) : '',
|
||||
($actionlog->adminuser) ? e($actionlog->adminuser->display_name) : '',
|
||||
$actionlog->present()->actionType(),
|
||||
e($actionlog->itemType()),
|
||||
($actionlog->itemType() == 'user') ? $actionlog->filename : $item_name,
|
||||
@ -856,7 +856,7 @@ class ReportsController extends Controller
|
||||
}
|
||||
|
||||
if ($request->filled('assigned_to')) {
|
||||
$row[] = ($asset->checkedOutToUser() && $asset->assigned) ? $asset->assigned->getFullNameAttribute() : ($asset->assigned ? $asset->assigned->display_name : '');
|
||||
$row[] = ($asset->checkedOutToUser() && $asset->assigned) ?? $asset->assigned->display_name;
|
||||
$row[] = ($asset->checkedOutToUser() && $asset->assigned) ? 'user' : $asset->assignedType();
|
||||
}
|
||||
|
||||
|
||||
@ -873,6 +873,7 @@ class SettingsController extends Controller
|
||||
$setting->ldap_default_group = $request->input('ldap_default_group');
|
||||
$setting->ldap_filter = $request->input('ldap_filter');
|
||||
$setting->ldap_username_field = $request->input('ldap_username_field');
|
||||
$setting->ldap_display_name = $request->input('ldap_display_name');
|
||||
$setting->ldap_lname_field = $request->input('ldap_lname_field');
|
||||
$setting->ldap_fname_field = $request->input('ldap_fname_field');
|
||||
$setting->ldap_auth_filter_query = $request->input('ldap_auth_filter_query');
|
||||
@ -889,7 +890,12 @@ class SettingsController extends Controller
|
||||
$setting->ldap_pw_sync = $request->input('ldap_pw_sync', '0');
|
||||
$setting->custom_forgot_pass_url = $request->input('custom_forgot_pass_url');
|
||||
$setting->ldap_phone_field = $request->input('ldap_phone');
|
||||
$setting->ldap_mobile = $request->input('ldap_mobile');
|
||||
$setting->ldap_jobtitle = $request->input('ldap_jobtitle');
|
||||
$setting->ldap_address = $request->input('ldap_address');
|
||||
$setting->ldap_city = $request->input('ldap_city');
|
||||
$setting->ldap_state = $request->input('ldap_state');
|
||||
$setting->ldap_zip = $request->input('ldap_zip');
|
||||
$setting->ldap_country = $request->input('ldap_country');
|
||||
$setting->ldap_location = $request->input('ldap_location');
|
||||
$setting->ldap_dept = $request->input('ldap_dept');
|
||||
|
||||
@ -88,6 +88,7 @@ class UsersController extends Controller
|
||||
//Username, email, and password need to be handled specially because the need to respect config values on an edit.
|
||||
$user->email = trim($request->input('email'));
|
||||
$user->username = trim($request->input('username'));
|
||||
$user->display_name = $request->input('display_name');
|
||||
if ($request->filled('password')) {
|
||||
$user->password = bcrypt($request->input('password'));
|
||||
}
|
||||
@ -240,6 +241,7 @@ class UsersController extends Controller
|
||||
|
||||
$user->first_name = $request->input('first_name');
|
||||
$user->last_name = $request->input('last_name');
|
||||
$user->display_name = $request->input('display_name');
|
||||
$user->two_factor_optin = $request->input('two_factor_optin') ?: 0;
|
||||
$user->locale = $request->input('locale');
|
||||
$user->employee_num = $request->input('employee_num');
|
||||
@ -562,10 +564,10 @@ class UsersController extends Controller
|
||||
$user->employee_num,
|
||||
$user->first_name,
|
||||
$user->last_name,
|
||||
$user->present()->fullName(),
|
||||
$user->display_name,
|
||||
$user->username,
|
||||
$user->email,
|
||||
($user->manager) ? $user->manager->present()->fullName() : '',
|
||||
($user->manager) ? $user->manager->display_name : '',
|
||||
($user->userloc) ? $user->userloc->name : '',
|
||||
($user->department) ? $user->department->name : '',
|
||||
$user->assets->count(),
|
||||
|
||||
@ -185,7 +185,7 @@ class ViewAssetsController extends Controller
|
||||
$logaction->target_type = User::class;
|
||||
|
||||
$data['item_quantity'] = $request->has('request-quantity') ? e($request->input('request-quantity')) : 1;
|
||||
$data['requested_by'] = $user->present()->fullName();
|
||||
$data['requested_by'] = $user->display_name;
|
||||
$data['item'] = $item;
|
||||
$data['item_type'] = $itemType;
|
||||
$data['target'] = auth()->user();
|
||||
|
||||
@ -109,7 +109,7 @@ class SettingsSamlRequest extends FormRequest
|
||||
];
|
||||
|
||||
$pkey = openssl_pkey_new([
|
||||
'private_key_bits' => 2048,
|
||||
'private_key_bits' => config('app.saml_key_size'),
|
||||
'private_key_type' => OPENSSL_KEYTYPE_RSA,
|
||||
]);
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class AccessoriesTransformer
|
||||
'checkouts_count' => $accessory->checkouts_count,
|
||||
'created_by' => ($accessory->adminuser) ? [
|
||||
'id' => (int) $accessory->adminuser->id,
|
||||
'name'=> e($accessory->adminuser->present()->fullName()),
|
||||
'name'=> e($accessory->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($accessory->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($accessory->updated_at, 'datetime'),
|
||||
|
||||
@ -150,7 +150,7 @@ class ActionlogsTransformer
|
||||
|
||||
'item' => ($actionlog->item) ? [
|
||||
'id' => (int) $actionlog->item->id,
|
||||
'name' => ($actionlog->itemType()=='user') ? e($actionlog->item->getFullNameAttribute()) : e($actionlog->item->getDisplayNameAttribute()),
|
||||
'name' => e($actionlog->item->display_name) ?? null,
|
||||
'type' => e($actionlog->itemType()),
|
||||
'serial' =>e($actionlog->item->serial) ? e($actionlog->item->serial) : null
|
||||
] : null,
|
||||
@ -165,19 +165,19 @@ class ActionlogsTransformer
|
||||
'action_type' => $actionlog->present()->actionType(),
|
||||
'admin' => ($actionlog->adminuser) ? [
|
||||
'id' => (int) $actionlog->adminuser->id,
|
||||
'name' => e($actionlog->adminuser->getFullNameAttribute()),
|
||||
'name' => e($actionlog->adminuser->display_name),
|
||||
'first_name'=> e($actionlog->adminuser->first_name),
|
||||
'last_name'=> e($actionlog->adminuser->last_name)
|
||||
] : null,
|
||||
'created_by' => ($actionlog->adminuser) ? [
|
||||
'id' => (int) $actionlog->adminuser->id,
|
||||
'name' => e($actionlog->adminuser->getFullNameAttribute()),
|
||||
'name' => e($actionlog->adminuser->display_name),
|
||||
'first_name'=> e($actionlog->adminuser->first_name),
|
||||
'last_name'=> e($actionlog->adminuser->last_name)
|
||||
] : null,
|
||||
'target' => ($actionlog->target) ? [
|
||||
'id' => (int) $actionlog->target->id,
|
||||
'name' => ($actionlog->targetType()=='user') ? e($actionlog->target->getFullNameAttribute()) : e($actionlog->target->getDisplayNameAttribute()),
|
||||
'name' => ($actionlog->target->display_name) ?? null,
|
||||
'type' => e($actionlog->targetType()),
|
||||
] : null,
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class AssetModelsTransformer
|
||||
'notes' => Helper::parseEscapedMarkedownInline($assetmodel->notes),
|
||||
'created_by' => ($assetmodel->adminuser) ? [
|
||||
'id' => (int) $assetmodel->adminuser->id,
|
||||
'name'=> e($assetmodel->adminuser->present()->fullName()),
|
||||
'name'=> e($assetmodel->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),
|
||||
|
||||
@ -91,7 +91,7 @@ class AssetsTransformer
|
||||
'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,
|
||||
'created_by' => ($asset->adminuser) ? [
|
||||
'id' => (int) $asset->adminuser->id,
|
||||
'name'=> e($asset->adminuser->present()->fullName()),
|
||||
'name'=> e($asset->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($asset->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($asset->updated_at, 'datetime'),
|
||||
@ -287,7 +287,7 @@ class AssetsTransformer
|
||||
'id' => (int) $asset->id,
|
||||
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
|
||||
'type' => 'asset',
|
||||
'name' => e($asset->present()->fullName()),
|
||||
'name' => e($asset->display_name),
|
||||
'model' => ($asset->model) ? e($asset->model->name) : null,
|
||||
'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
|
||||
'asset_tag' => e($asset->asset_tag),
|
||||
|
||||
@ -64,7 +64,7 @@ class CategoriesTransformer
|
||||
'licenses_count' => (int) $category->licenses_count,
|
||||
'created_by' => ($category->adminuser) ? [
|
||||
'id' => (int) $category->adminuser->id,
|
||||
'name'=> e($category->adminuser->present()->fullName()),
|
||||
'name'=> e($category->adminuser->display_name),
|
||||
] : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($category->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($category->created_at, 'datetime'),
|
||||
|
||||
@ -38,7 +38,7 @@ class CompaniesTransformer
|
||||
'users_count' => (int) $company->users_count,
|
||||
'created_by' => ($company->adminuser) ? [
|
||||
'id' => (int) $company->adminuser->id,
|
||||
'name'=> e($company->adminuser->present()->fullName()),
|
||||
'name'=> e($company->adminuser->display_name),
|
||||
] : null,
|
||||
'notes' => Helper::parseEscapedMarkedownInline($company->notes),
|
||||
'created_at' => Helper::getFormattedDateObject($company->created_at, 'datetime'),
|
||||
|
||||
@ -51,7 +51,7 @@ class ComponentsTransformer
|
||||
'notes' => ($component->notes) ? Helper::parseEscapedMarkedownInline($component->notes) : null,
|
||||
'created_by' => ($component->adminuser) ? [
|
||||
'id' => (int) $component->adminuser->id,
|
||||
'name'=> e($component->adminuser->present()->fullName()),
|
||||
'name'=> e($component->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($component->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($component->updated_at, 'datetime'),
|
||||
|
||||
@ -42,7 +42,7 @@ class ConsumablesTransformer
|
||||
'notes' => ($consumable->notes) ? Helper::parseEscapedMarkedownInline($consumable->notes) : null,
|
||||
'created_by' => ($consumable->adminuser) ? [
|
||||
'id' => (int) $consumable->adminuser->id,
|
||||
'name'=> e($consumable->adminuser->present()->fullName()),
|
||||
'name'=> e($consumable->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($consumable->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($consumable->updated_at, 'datetime'),
|
||||
|
||||
@ -35,7 +35,7 @@ class DepartmentsTransformer
|
||||
] : null,
|
||||
'manager' => ($department->manager) ? [
|
||||
'id' => (int) $department->manager->id,
|
||||
'name' => e($department->manager->getFullNameAttribute()),
|
||||
'name' => e($department->manager->display_name),
|
||||
'first_name'=> e($department->manager->first_name),
|
||||
'last_name'=> e($department->manager->last_name),
|
||||
] : null,
|
||||
|
||||
@ -33,7 +33,7 @@ class DepreciationsTransformer
|
||||
'licenses_count' => ($depreciation->licenses_count > 0) ? (int) $depreciation->licenses_count : 0,
|
||||
'created_by' => ($depreciation->adminuser) ? [
|
||||
'id' => (int) $depreciation->adminuser->id,
|
||||
'name'=> e($depreciation->adminuser->present()->fullName()),
|
||||
'name'=> e($depreciation->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($depreciation->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($depreciation->updated_at, 'datetime')
|
||||
|
||||
@ -29,7 +29,7 @@ class GroupsTransformer
|
||||
'notes' => Helper::parseEscapedMarkedownInline($group->notes),
|
||||
'created_by' => ($group->adminuser) ? [
|
||||
'id' => (int) $group->adminuser->id,
|
||||
'name'=> e($group->adminuser->present()->fullName()),
|
||||
'name'=> e($group->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($group->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($group->updated_at, 'datetime'),
|
||||
|
||||
@ -48,7 +48,7 @@ class LicensesTransformer
|
||||
'category' => ($license->category) ? ['id' => (int) $license->category->id, 'name'=> e($license->category->name)] : null,
|
||||
'created_by' => ($license->adminuser) ? [
|
||||
'id' => (int) $license->adminuser->id,
|
||||
'name'=> e($license->adminuser->present()->fullName()),
|
||||
'name'=> e($license->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($license->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($license->updated_at, 'datetime'),
|
||||
|
||||
@ -73,11 +73,11 @@ class MaintenancesTransformer
|
||||
'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'),
|
||||
'user_id' => ($assetmaintenance->adminuser) ? [
|
||||
'id' => $assetmaintenance->adminuser->id,
|
||||
'name'=> e($assetmaintenance->adminuser->present()->fullName())
|
||||
'name'=> e($assetmaintenance->adminuser->display_name)
|
||||
] : null, // legacy to not change the shape of the API
|
||||
'created_by' => ($assetmaintenance->adminuser) ? [
|
||||
'id' => (int) $assetmaintenance->adminuser->id,
|
||||
'name'=> e($assetmaintenance->adminuser->present()->fullName()),
|
||||
'name'=> e($assetmaintenance->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($assetmaintenance->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($assetmaintenance->updated_at, 'datetime'),
|
||||
|
||||
@ -40,7 +40,7 @@ class ManufacturersTransformer
|
||||
'notes' => Helper::parseEscapedMarkedownInline($manufacturer->notes),
|
||||
'created_by' => ($manufacturer->adminuser) ? [
|
||||
'id' => (int) $manufacturer->adminuser->id,
|
||||
'name'=> e($manufacturer->adminuser->present()->fullName()),
|
||||
'name'=> e($manufacturer->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($manufacturer->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($manufacturer->updated_at, 'datetime'),
|
||||
|
||||
@ -34,7 +34,7 @@ class PredefinedKitsTransformer
|
||||
'name' => e($kit->name),
|
||||
'created_by' => ($kit->adminuser) ? [
|
||||
'id' => (int) $kit->adminuser->id,
|
||||
'name'=> e($kit->adminuser->present()->fullName()),
|
||||
'name'=> e($kit->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($kit->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($kit->updated_at, 'datetime'),
|
||||
|
||||
@ -26,7 +26,7 @@ class ProfileTransformer
|
||||
'id' => (int) $file->id,
|
||||
'icon' => Helper::filetype_icon($file->filename),
|
||||
'item' => ($file->item) ? [
|
||||
'name' => ($file->itemType()=='user') ? e($file->item->getFullNameAttribute()) : e($file->item->getDisplayNameAttribute()),
|
||||
'name' => ($file->itemType()=='user') ? e($file->item->display_name) : e($file->item->getDisplayNameAttribute()),
|
||||
'type' => e($file->itemType()),
|
||||
] : null,
|
||||
'filename' => e($file->filename),
|
||||
|
||||
@ -32,7 +32,7 @@ class StatuslabelsTransformer
|
||||
'notes' => e($statuslabel->notes),
|
||||
'created_by' => ($statuslabel->adminuser) ? [
|
||||
'id' => (int) $statuslabel->adminuser->id,
|
||||
'name'=> e($statuslabel->adminuser->present()->fullName()),
|
||||
'name'=> e($statuslabel->adminuser->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($statuslabel->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($statuslabel->updated_at, 'datetime'),
|
||||
|
||||
@ -31,16 +31,17 @@ class UsersTransformer
|
||||
$array = [
|
||||
'id' => (int) $user->id,
|
||||
'avatar' => e($user->present()->gravatar) ?? null,
|
||||
'name' => e($user->getFullNameAttribute()),
|
||||
'first_name' => e($user->first_name),
|
||||
'last_name' => e($user->last_name),
|
||||
'username' => e($user->username),
|
||||
'name' => e($user->getFullNameAttribute()) ?? null,
|
||||
'first_name' => e($user->first_name) ?? null,
|
||||
'last_name' => e($user->last_name) ?? null,
|
||||
'display_name' => e($user->getRawOriginal('display_name')) ?? null,
|
||||
'username' => e($user->username) ?? null,
|
||||
'remote' => ($user->remote == '1') ? true : false,
|
||||
'locale' => ($user->locale) ? e($user->locale) : null,
|
||||
'employee_num' => ($user->employee_num) ? e($user->employee_num) : null,
|
||||
'manager' => ($user->manager) ? [
|
||||
'id' => (int) $user->manager->id,
|
||||
'name'=> e($user->manager->first_name).' '.e($user->manager->last_name),
|
||||
'name'=> e($user->manager->display_name),
|
||||
] : null,
|
||||
'jobtitle' => ($user->jobtitle) ? e($user->jobtitle) : null,
|
||||
'vip' => ($user->vip == '1') ? true : false,
|
||||
@ -59,7 +60,7 @@ class UsersTransformer
|
||||
] : null,
|
||||
'department_manager' => ($user->department?->manager) ? [
|
||||
'id' => (int) $user->department->manager->id,
|
||||
'name'=> e($user->department->manager->full_name),
|
||||
'name'=> e($user->department->manager->display_name),
|
||||
] : null,
|
||||
'location' => ($user->userloc) ? [
|
||||
'id' => (int) $user->userloc->id,
|
||||
@ -82,7 +83,7 @@ class UsersTransformer
|
||||
'company' => ($user->company) ? ['id' => (int) $user->company->id, 'name'=> e($user->company->name)] : null,
|
||||
'created_by' => ($user->createdBy) ? [
|
||||
'id' => (int) $user->createdBy->id,
|
||||
'name'=> e($user->createdBy->present()->fullName),
|
||||
'name'=> e($user->createdBy->display_name),
|
||||
] : null,
|
||||
'created_at' => Helper::getFormattedDateObject($user->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($user->updated_at, 'datetime'),
|
||||
@ -138,6 +139,7 @@ class UsersTransformer
|
||||
'first_name' => e($user->first_name),
|
||||
'last_name' => e($user->last_name),
|
||||
'username' => e($user->username),
|
||||
'display_name' => e($user->display_name),
|
||||
'created_by' => $user->adminuser ? [
|
||||
'id' => (int) $user->adminuser->id,
|
||||
'name'=> e($user->adminuser->present()->fullName),
|
||||
|
||||
@ -72,6 +72,7 @@ abstract class Importer
|
||||
'termination_date' => 'termination date',
|
||||
'warranty_months' => 'warranty',
|
||||
'full_name' => 'full name',
|
||||
'display_name' => 'display name',
|
||||
'email' => 'email',
|
||||
'username' => 'username',
|
||||
'address' => 'address',
|
||||
@ -299,6 +300,7 @@ abstract class Importer
|
||||
'full_name' => $this->findCsvMatch($row, 'full_name'),
|
||||
'first_name' => $this->findCsvMatch($row, 'first_name'),
|
||||
'last_name' => $this->findCsvMatch($row, 'last_name'),
|
||||
'display_name' => $this->findCsvMatch($row, 'display_name'),
|
||||
'email' => $this->findCsvMatch($row, 'email'),
|
||||
'manager_id'=> '',
|
||||
'department_id' => '',
|
||||
@ -369,6 +371,7 @@ abstract class Importer
|
||||
$user->first_name = $user_array['first_name'];
|
||||
$user->last_name = $user_array['last_name'];
|
||||
$user->username = $user_array['username'];
|
||||
$user->display_name = $user_array['display_name'] ?? null;
|
||||
$user->email = $user_array['email'];
|
||||
$user->manager_id = $user_array['manager_id'] ?? null;
|
||||
$user->department_id = $user_array['department_id'] ?? null;
|
||||
|
||||
@ -47,6 +47,7 @@ class UserImporter extends ItemImporter
|
||||
// Pull the records from the CSV to determine their values
|
||||
$this->item['id'] = trim($this->findCsvMatch($row, 'id'));
|
||||
$this->item['username'] = trim($this->findCsvMatch($row, 'username'));
|
||||
$this->item['display_name'] = trim($this->findCsvMatch($row, 'display_name'));
|
||||
$this->item['first_name'] = trim($this->findCsvMatch($row, 'first_name'));
|
||||
$this->item['last_name'] = trim($this->findCsvMatch($row, 'last_name'));
|
||||
$this->item['email'] = trim($this->findCsvMatch($row, 'email'));
|
||||
|
||||
@ -339,6 +339,7 @@ class Importer extends Component
|
||||
'start_date' => trans('general.start_date'),
|
||||
'state' => trans('general.state'),
|
||||
'username' => trans('admin/users/table.username'),
|
||||
'display_name' => trans('admin/users/table.display_name'),
|
||||
'vip' => trans('general.importer.vip'),
|
||||
'website' => trans('general.website'),
|
||||
'zip' => trans('general.zip'),
|
||||
@ -485,6 +486,13 @@ class Importer extends Component
|
||||
'username',
|
||||
trans('general.importer.checked_out_to_username'),
|
||||
],
|
||||
'display_name' =>
|
||||
[
|
||||
'display name',
|
||||
'displayName',
|
||||
'display',
|
||||
trans('admin/users/table.display_name'),
|
||||
],
|
||||
'first_name' =>
|
||||
[
|
||||
'first name',
|
||||
|
||||
@ -38,10 +38,10 @@ class CheckoutAssetMail extends Mailable
|
||||
|
||||
// Location is a target option, but there are no emails currently associated with locations.
|
||||
if($this->target instanceof User){
|
||||
$this->target = $this->target->present()?->fullName();
|
||||
$this->target = $this->target->display_name;
|
||||
}
|
||||
else if($this->target instanceof Asset){
|
||||
$this->target = $this->target->assignedto?->present()?->fullName();
|
||||
$this->target = $this->target->assignedto?->display_name;
|
||||
}
|
||||
|
||||
$this->last_checkout = '';
|
||||
|
||||
@ -31,10 +31,10 @@ class CheckoutLicenseMail extends Mailable
|
||||
$this->target = $checkedOutTo;
|
||||
|
||||
if($this->target instanceof User){
|
||||
$this->target = $this->target->present()?->fullName();
|
||||
$this->target = $this->target->display_name;
|
||||
}
|
||||
elseif($this->target instanceof Asset){
|
||||
$this->target = $this->target->assignedto?->present()?->fullName();
|
||||
$this->target = $this->target->display_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,10 +30,10 @@ class FieldOption
|
||||
if ($asset->relationLoaded('assignedTo')) {
|
||||
// If the "assignedTo" relationship was eager loaded then the way to get the
|
||||
// relationship changes from $asset->assignedTo to $asset->assigned.
|
||||
return $asset->assigned ? $asset->assigned->present()->fullName() : null;
|
||||
return $asset->assigned ? $asset->assigned->display_name : null;
|
||||
}
|
||||
|
||||
return $asset->assignedTo ? $asset->assignedTo->present()->fullName() : null;
|
||||
return $asset->assignedTo ? $asset->assignedTo->display_name : null;
|
||||
}
|
||||
|
||||
// Handle Laravel's stupid Carbon datetime casting
|
||||
|
||||
110
app/Models/Labels/Sheets/Avery/L6009.php
Normal file
110
app/Models/Labels/Sheets/Avery/L6009.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Labels\RectangleSheet;
|
||||
|
||||
abstract class L6009 extends RectangleSheet
|
||||
{
|
||||
|
||||
private const PAPER_FORMAT = 'A4';
|
||||
private const PAPER_ORIENTATION = 'P';
|
||||
|
||||
/* Data in pt from Word Template */
|
||||
private const COLUMN1_X = 31.70;
|
||||
private const COLUMN2_X = 167.92;
|
||||
private const ROW1_Y = 53.00;
|
||||
private const ROW2_Y = 112.8;
|
||||
private const LABEL_W = 122.24;
|
||||
private const LABEL_H = 66.5;
|
||||
|
||||
private float $pageWidth;
|
||||
private float $pageHeight;
|
||||
private float $pageMarginLeft;
|
||||
private float $pageMarginTop;
|
||||
|
||||
private float $columnSpacing;
|
||||
private float $rowSpacing;
|
||||
|
||||
private float $labelWidth;
|
||||
private float $labelHeight;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$paperSize = static::fromFormat(self::PAPER_FORMAT, self::PAPER_ORIENTATION, $this->getUnit(), 0);
|
||||
$this->pageWidth = $paperSize->width;
|
||||
$this->pageHeight = $paperSize->height;
|
||||
|
||||
$this->pageMarginLeft = Helper::convertUnit(self::COLUMN1_X, 'pt', $this->getUnit());
|
||||
$this->pageMarginTop = Helper::convertUnit(self::ROW1_Y, 'pt', $this->getUnit());
|
||||
|
||||
$columnSpacingPt = self::COLUMN2_X - self::COLUMN1_X - self::LABEL_W;
|
||||
$this->columnSpacing = Helper::convertUnit($columnSpacingPt, 'pt', $this->getUnit());
|
||||
$rowSpacingPt = self::ROW2_Y - self::ROW1_Y - self::LABEL_H;
|
||||
$this->rowSpacing = Helper::convertUnit($rowSpacingPt, 'pt', $this->getUnit());
|
||||
|
||||
$this->labelWidth = Helper::convertUnit(self::LABEL_W, 'pt', $this->getUnit());
|
||||
$this->labelHeight = Helper::convertUnit(self::LABEL_H, 'pt', $this->getUnit());
|
||||
}
|
||||
|
||||
public function getPageWidth()
|
||||
{
|
||||
return $this->pageWidth;
|
||||
}
|
||||
public function getPageHeight()
|
||||
{
|
||||
return $this->pageHeight;
|
||||
}
|
||||
|
||||
public function getPageMarginTop()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginBottom()
|
||||
{
|
||||
return $this->pageMarginTop;
|
||||
}
|
||||
public function getPageMarginLeft()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
public function getPageMarginRight()
|
||||
{
|
||||
return $this->pageMarginLeft;
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getRows()
|
||||
{
|
||||
return 12;
|
||||
}
|
||||
|
||||
public function getLabelColumnSpacing()
|
||||
{
|
||||
return $this->columnSpacing;
|
||||
}
|
||||
public function getLabelRowSpacing()
|
||||
{
|
||||
return $this->rowSpacing;
|
||||
}
|
||||
|
||||
public function getLabelWidth()
|
||||
{
|
||||
return $this->labelWidth;
|
||||
}
|
||||
public function getLabelHeight()
|
||||
{
|
||||
return $this->labelHeight;
|
||||
}
|
||||
|
||||
public function getLabelBorder()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
121
app/Models/Labels/Sheets/Avery/L6009_A.php
Normal file
121
app/Models/Labels/Sheets/Avery/L6009_A.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Labels\Sheets\Avery;
|
||||
|
||||
|
||||
class L6009_A extends L6009
|
||||
{
|
||||
private const BARCODE_MARGIN = 1.80;
|
||||
private const TAG_SIZE = 4.80;
|
||||
private const TITLE_SIZE = 3.00;
|
||||
private const TITLE_MARGIN = 1.80;
|
||||
private const LABEL_SIZE = 2.8;
|
||||
private const LABEL_MARGIN = - 0.45;
|
||||
private const FIELD_SIZE = 3.80;
|
||||
private const FIELD_MARGIN = 0.20;
|
||||
|
||||
public function getUnit()
|
||||
{
|
||||
return 'mm';
|
||||
}
|
||||
|
||||
public function getLabelMarginTop()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginBottom()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginLeft()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
public function getLabelMarginRight()
|
||||
{
|
||||
return 0.06;
|
||||
}
|
||||
|
||||
public function getSupportAssetTag()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupport1DBarcode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupport2DBarcode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public function getSupportFields()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
public function getSupportLogo()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public function getSupportTitle()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function preparePDF($pdf)
|
||||
{
|
||||
}
|
||||
|
||||
public function write($pdf, $record)
|
||||
{
|
||||
$pa = $this->getLabelPrintableArea();
|
||||
|
||||
$currentX = $pa->x1;
|
||||
$currentY = $pa->y1;
|
||||
$usableWidth = $pa->w;
|
||||
$usableHeight = $pa->h;
|
||||
|
||||
if ($record->has('title')) {
|
||||
static::writeText(
|
||||
$pdf, $record->get('title'),
|
||||
$pa->x1, $pa->y1,
|
||||
'freesans', '', self::TITLE_SIZE, 'C',
|
||||
$pa->w, self::TITLE_SIZE, true, 0
|
||||
);
|
||||
|
||||
}
|
||||
$currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$usableHeight -= self::TITLE_SIZE + self::TITLE_MARGIN;
|
||||
$barcodeSize = $usableHeight;
|
||||
if ($record->has('barcode2d')) {
|
||||
static::write2DBarcode(
|
||||
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
|
||||
$currentX, $currentY,
|
||||
$barcodeSize, $barcodeSize
|
||||
);
|
||||
$currentX += $barcodeSize + self::BARCODE_MARGIN;
|
||||
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
|
||||
}
|
||||
|
||||
foreach ($record->get('fields') as $field) {
|
||||
static::writeText(
|
||||
$pdf, $field['label'],
|
||||
$currentX, $currentY,
|
||||
'freesans', '', self::LABEL_SIZE, 'L',
|
||||
$usableWidth, self::LABEL_SIZE, true, 0
|
||||
);
|
||||
$currentY += self::LABEL_SIZE + self::LABEL_MARGIN;
|
||||
|
||||
static::writeText(
|
||||
$pdf, $field['value'],
|
||||
$currentX, $currentY,
|
||||
'freemono', 'B', self::FIELD_SIZE, 'L',
|
||||
$usableWidth, self::FIELD_SIZE, true, 0, 0.01
|
||||
);
|
||||
$currentY += self::FIELD_SIZE + self::FIELD_MARGIN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SnipeModel extends Model
|
||||
@ -155,9 +156,13 @@ class SnipeModel extends Model
|
||||
$this->attributes['status_id'] = $value;
|
||||
}
|
||||
|
||||
//
|
||||
public function getDisplayNameAttribute()
|
||||
|
||||
protected function displayName(): Attribute
|
||||
{
|
||||
return $this->name;
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => $this->name,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||
|
||||
'validations' => [
|
||||
$user_prefix . 'userName' => 'required',
|
||||
$user_prefix . 'displayName' => 'nullable|string',
|
||||
$user_prefix . 'name.givenName' => 'required',
|
||||
$user_prefix . 'name.familyName' => 'nullable|string',
|
||||
$user_prefix . 'externalId' => 'nullable|string',
|
||||
@ -121,7 +122,7 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||
'honorificSuffix' => null
|
||||
],
|
||||
|
||||
'displayName' => null,
|
||||
'displayName' => AttributeMapping::eloquent("display_name"),
|
||||
'nickName' => null,
|
||||
'profileUrl' => null,
|
||||
'title' => AttributeMapping::eloquent('jobtitle'),
|
||||
@ -153,21 +154,12 @@ class SnipeSCIMConfig extends \ArieTimmerman\Laravel\SCIMServer\SCIMConfig
|
||||
"primary" => AttributeMapping::constant(true)->ignoreWrite()
|
||||
]],
|
||||
|
||||
// Mobile and work phone numbers
|
||||
'phoneNumbers' => [
|
||||
[
|
||||
"value" => AttributeMapping::eloquent("phone"),
|
||||
"display" => null,
|
||||
"type" => AttributeMapping::constant("work")->ignoreWrite(),
|
||||
"primary" => AttributeMapping::constant(true)->ignoreWrite(),
|
||||
],
|
||||
[
|
||||
"value" => AttributeMapping::eloquent("mobile"),
|
||||
"display" => null,
|
||||
"type" => AttributeMapping::constant("mobile")->ignoreWrite(),
|
||||
"primary" => AttributeMapping::constant(false)->ignoreWrite()
|
||||
]
|
||||
],
|
||||
'phoneNumbers' => [[
|
||||
"value" => AttributeMapping::eloquent("phone"),
|
||||
"display" => null,
|
||||
"type" => AttributeMapping::constant("work")->ignoreWrite(),
|
||||
"primary" => AttributeMapping::constant(true)->ignoreWrite()
|
||||
]],
|
||||
|
||||
'ims' => [[
|
||||
"value" => null,
|
||||
|
||||
@ -64,6 +64,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'first_name',
|
||||
'jobtitle',
|
||||
'last_name',
|
||||
'display_name',
|
||||
'ldap_import',
|
||||
'locale',
|
||||
'location_id',
|
||||
@ -103,6 +104,8 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
|
||||
protected $rules = [
|
||||
'first_name' => 'required|string|min:1|max:191',
|
||||
'last_name' => 'nullable|string|max:191',
|
||||
'display_name' => 'nullable|string|max:191',
|
||||
'username' => 'required|string|min:1|unique_undeleted|max:191',
|
||||
'email' => 'email|nullable|max:191',
|
||||
'password' => 'required|min:8',
|
||||
@ -113,9 +116,9 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'start_date' => 'nullable|date_format:Y-m-d',
|
||||
'end_date' => 'nullable|date_format:Y-m-d|after_or_equal:start_date',
|
||||
'autoassign_licenses' => 'boolean',
|
||||
'address' => 'max:191|nullable',
|
||||
'city' => 'max:191|nullable',
|
||||
'state' => 'min:2|max:191|nullable',
|
||||
'address' => 'nullable|string|max:191',
|
||||
'city' => 'nullable|string|max:191',
|
||||
'state' => 'nullable|string|max:191',
|
||||
'country' => 'min:2|max:191|nullable',
|
||||
'zip' => 'max:10|nullable',
|
||||
'vip' => 'boolean',
|
||||
@ -132,15 +135,16 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'address',
|
||||
'city',
|
||||
'country',
|
||||
'display_name',
|
||||
'email',
|
||||
'employee_num',
|
||||
'first_name',
|
||||
'jobtitle',
|
||||
'last_name',
|
||||
'locale',
|
||||
'mobile',
|
||||
'notes',
|
||||
'phone',
|
||||
'mobile',
|
||||
'state',
|
||||
'username',
|
||||
'website',
|
||||
@ -157,7 +161,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'department' => ['name'],
|
||||
'groups' => ['name'],
|
||||
'company' => ['name'],
|
||||
'manager' => ['first_name', 'last_name', 'username'],
|
||||
'manager' => ['first_name', 'last_name', 'username', 'display_name'],
|
||||
];
|
||||
|
||||
|
||||
@ -196,8 +200,20 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This overrides the SnipeModel displayName accessor to return the full name if display_name is not set
|
||||
* @see SnipeModel::displayName()
|
||||
* @return Attribute
|
||||
*/
|
||||
|
||||
public function isAvatarExternal()
|
||||
protected function displayName(): Attribute
|
||||
{
|
||||
return Attribute:: make(
|
||||
get: fn(mixed $value) => $value ?? $this->getFullNameAttribute(),
|
||||
);
|
||||
}
|
||||
|
||||
public function isAvatarExternal() : bool
|
||||
{
|
||||
// Check if it's a google avatar or some external avatar
|
||||
if (Str::startsWith($this->avatar, ['http://', 'https://'])) {
|
||||
@ -859,6 +875,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
{
|
||||
return $query->where('first_name', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('last_name', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('display_name', 'LIKE', '%' . $search . '%')
|
||||
->orWhereMultipleColumns(
|
||||
[
|
||||
'users.first_name',
|
||||
@ -1068,6 +1085,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
->orWhere('users.jobtitle', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('users.employee_num', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('users.username', 'LIKE', '%' . $search . '%')
|
||||
->orWhere('users.display_name', 'LIKE', '%' . $search . '%')
|
||||
->orwhereRaw('CONCAT(users.first_name," ",users.last_name) LIKE \''.$search.'%\'');
|
||||
|
||||
}
|
||||
|
||||
@ -57,14 +57,14 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
return (new SlackMessage)
|
||||
->success()
|
||||
->content(class_basename(get_class($this->params['item'])).' Audited')
|
||||
->content(class_basename(get_class($this->params['item'])).' '.trans('general.audited'))
|
||||
->from(($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot')
|
||||
->to($channel)
|
||||
->attachment(function ($attachment) {
|
||||
$item = $this->params['item'];
|
||||
$admin_user = $this->params['admin'];
|
||||
$fields = [
|
||||
'By' => '<'.$admin_user->present()->viewUrl().'|'.$admin_user->present()->fullName().'>',
|
||||
'By' => '<'.$admin_user->present()->viewUrl().'|'.$admin_user->display_name.'>',
|
||||
];
|
||||
array_key_exists('note', $this->params) && $fields['Notes'] = $this->params['note'];
|
||||
array_key_exists('location', $this->params) && $fields['Location'] = $this->params['location'];
|
||||
@ -76,22 +76,22 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;
|
||||
|
||||
public static function toMicrosoftTeams($params)
|
||||
{
|
||||
$item = $params['item'];
|
||||
$admin_user = $params['admin'];
|
||||
$note = $params['note'];
|
||||
$location = $params['location'];
|
||||
$item = $params['item'] ?? null;
|
||||
$admin_user = $params['admin'] ?? null;
|
||||
$note = $params['note'] ?? '';
|
||||
$location = $params['location'] ?? '';
|
||||
$setting = Setting::getSettings();
|
||||
|
||||
if(!Str::contains($setting->webhook_endpoint, 'workflows')) {
|
||||
return MicrosoftTeamsMessage::create()
|
||||
->to($setting->webhook_endpoint)
|
||||
->type('success')
|
||||
->title(class_basename(get_class($params['item'])) . ' Audited')
|
||||
->title(class_basename(get_class($params['item'])) .' '.trans('general.audited'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(trans('mail.asset'), $item)
|
||||
->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->present()->fullName());
|
||||
->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->display_name);
|
||||
}
|
||||
$message = class_basename(get_class($params['item'])) . ' Audited By '.$admin_user->present()->fullName();
|
||||
$message = class_basename(get_class($params['item'])) . ' Audited By '.$admin_user->display_name;
|
||||
$details = [
|
||||
trans('mail.asset') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
|
||||
@ -73,8 +73,8 @@ class CheckinAccessoryNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -109,7 +109,7 @@ class CheckinAccessoryNotification extends Notification
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
@ -118,7 +118,7 @@ class CheckinAccessoryNotification extends Notification
|
||||
$details = [
|
||||
trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.checked_into') => $item->location->name ? $item->location->name : '',
|
||||
trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->present()->fullName(),
|
||||
trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->display_name,
|
||||
trans('admin/consumables/general.remaining')=> $item->numRemaining(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
|
||||
@ -78,7 +78,7 @@ class CheckinAssetNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
trans('general.status') => $item->assetstatus?->name,
|
||||
trans('general.location') => ($item->location) ? $item->location->name : '',
|
||||
];
|
||||
@ -116,7 +116,7 @@ class CheckinAssetNotification extends Notification
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||
->fact(trans('mail.checked_into'), ($item->location) ? $item->location->name : '')
|
||||
->fact(trans('mail.Asset_Checkin_Notification') . " by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.Asset_Checkin_Notification') . " by ", $admin->display_name)
|
||||
->fact(trans('admin/hardware/form.status'), $item->assetstatus?->name)
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
@ -126,7 +126,7 @@ class CheckinAssetNotification extends Notification
|
||||
$details = [
|
||||
trans('mail.asset') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.checked_into') => ($item->location) ? $item->location->name : '',
|
||||
trans('mail.Asset_Checkin_Notification')." by " => $admin->present()->fullName(),
|
||||
trans('mail.Asset_Checkin_Notification')." by " => $admin->display_name,
|
||||
trans('admin/hardware/form.status') => $item->assetstatus?->name,
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
|
||||
@ -76,8 +76,8 @@ class CheckinComponentNotification extends Notification
|
||||
|
||||
if ($admin) {
|
||||
$fields = [
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -90,7 +90,7 @@ class CheckinComponentNotification extends Notification
|
||||
|
||||
} else {
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
'By' => 'CLI tool',
|
||||
];
|
||||
}
|
||||
@ -119,16 +119,16 @@ class CheckinComponentNotification extends Notification
|
||||
->title(trans('mail.Component_checkin_notification'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'header')
|
||||
->fact(trans('mail.Component_checkin_notification')." by ", $admin->present()->fullName() ?: 'CLI tool')
|
||||
->fact(trans('mail.checkedin_from'), $target->present()->fullName())
|
||||
->fact(trans('mail.Component_checkin_notification')." by ", $admin->display_name ?: 'CLI tool')
|
||||
->fact(trans('mail.checkedin_from'), $target->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
$message = trans('mail.Component_checkin_notification');
|
||||
$details = [
|
||||
trans('mail.checkedin_from')=> $target->present()->fullName(),
|
||||
trans('mail.Component_checkin_notification')." by " => $admin->present()->fullName() ?: 'CLI tool',
|
||||
trans('mail.checkedin_from')=> $target->display_name,
|
||||
trans('mail.Component_checkin_notification')." by " => $admin->display_name ?: 'CLI tool',
|
||||
trans('admin/consumables/general.remaining') => $item->numRemaining(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
@ -153,7 +153,7 @@ class CheckinComponentNotification extends Notification
|
||||
Section::create(
|
||||
KeyValue::create(
|
||||
trans('mail.checkedin_from') ?: '',
|
||||
$target->present()->fullName() ?: '',
|
||||
$target->display_name ?: '',
|
||||
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
|
||||
)
|
||||
->onClick(route('components.show', $item->id))
|
||||
|
||||
@ -77,8 +77,8 @@ class CheckinLicenseSeatNotification extends Notification
|
||||
|
||||
if ($admin) {
|
||||
$fields = [
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -91,7 +91,7 @@ class CheckinLicenseSeatNotification extends Notification
|
||||
|
||||
} else {
|
||||
$fields = [
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
'To' => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
'By' => 'CLI tool',
|
||||
];
|
||||
}
|
||||
@ -120,17 +120,17 @@ class CheckinLicenseSeatNotification extends Notification
|
||||
->title(trans('mail.License_Checkin_Notification'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'header')
|
||||
->fact(trans('mail.License_Checkin_Notification')." by ", $admin->present()->fullName() ?: 'CLI tool')
|
||||
->fact(trans('mail.checkedin_from'), $target->present()->fullName())
|
||||
->fact(trans('mail.License_Checkin_Notification')." by ", $admin->display_name ?: 'CLI tool')
|
||||
->fact(trans('mail.checkedin_from'), $target->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
$message = trans('mail.License_Checkin_Notification');
|
||||
$details = [
|
||||
trans('mail.checkedin_from')=> $target->present()->fullName(),
|
||||
trans('mail.checkedin_from')=> $target->display_name,
|
||||
trans('mail.license_for') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.License_Checkin_Notification')." by " => $admin->present()->fullName() ?: 'CLI tool',
|
||||
trans('mail.License_Checkin_Notification')." by " => $admin->display_name ?: 'CLI tool',
|
||||
trans('admin/consumables/general.remaining') => $item->availCount()->count(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
@ -155,7 +155,7 @@ class CheckinLicenseSeatNotification extends Notification
|
||||
Section::create(
|
||||
KeyValue::create(
|
||||
trans('mail.checkedin_from') ?: '',
|
||||
$target->present()->fullName() ?: '',
|
||||
$target->display_name ?: '',
|
||||
trans('admin/consumables/general.remaining').': '.$item->availCount()->count(),
|
||||
)
|
||||
->onClick(route('licenses.show', $item->id))
|
||||
|
||||
@ -100,8 +100,8 @@ class CheckoutAccessoryNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -140,7 +140,7 @@ class CheckoutAccessoryNotification extends Notification
|
||||
->fact(trans('mail.assigned_to'), $target->present()->name)
|
||||
->fact(trans('general.qty'), $this->checkout_qty)
|
||||
->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
@ -151,7 +151,7 @@ class CheckoutAccessoryNotification extends Notification
|
||||
trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('general.qty') => $this->checkout_qty,
|
||||
trans('mail.checkedout_from') => $item->location->name ? $item->location->name : '',
|
||||
trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->present()->fullName(),
|
||||
trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->display_name,
|
||||
trans('admin/consumables/general.remaining')=> $item->numRemaining(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
|
||||
@ -93,8 +93,8 @@ class CheckoutAssetNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -135,7 +135,7 @@ class CheckoutAssetNotification extends Notification
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(trans('mail.assigned_to'), $target->present()->name)
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||
->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->display_name)
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ class CheckoutAssetNotification extends Notification
|
||||
$details = [
|
||||
trans('mail.assigned_to') => $target->present()->name,
|
||||
trans('mail.asset') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.Asset_Checkout_Notification'). ' by' => $admin->present()->fullName(),
|
||||
trans('mail.Asset_Checkout_Notification'). ' by' => $admin->display_name,
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
return array($message, $details);
|
||||
|
||||
@ -80,8 +80,8 @@ class CheckoutComponentNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -117,17 +117,17 @@ class CheckoutComponentNotification extends Notification
|
||||
->title(trans('mail.Component_checkout_notification'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.Component_checkout_notification')." by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.assigned_to'), $target->present()->fullName())
|
||||
->fact(trans('mail.Component_checkout_notification')." by ", $admin->display_name)
|
||||
->fact(trans('mail.assigned_to'), $target->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
$message = trans('mail.Component_checkout_notification');
|
||||
$details = [
|
||||
trans('mail.assigned_to') => $target->present()->fullName(),
|
||||
trans('mail.assigned_to') => $target->display_name,
|
||||
trans('mail.item') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.Component_checkout_notification').' by' => $admin->present()->fullName(),
|
||||
trans('mail.Component_checkout_notification').' by' => $admin->display_name,
|
||||
trans('admin/consumables/general.remaining') => $item->numRemaining(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
@ -152,7 +152,7 @@ class CheckoutComponentNotification extends Notification
|
||||
Section::create(
|
||||
KeyValue::create(
|
||||
trans('mail.assigned_to') ?: '',
|
||||
$target->present()->fullName() ?: '',
|
||||
$target->display_name ?: '',
|
||||
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
|
||||
)
|
||||
->onClick(route('api.assets.show', $target->id))
|
||||
|
||||
@ -80,8 +80,8 @@ class CheckoutConsumableNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -117,17 +117,17 @@ class CheckoutConsumableNotification extends Notification
|
||||
->title(trans('mail.Consumable_checkout_notification'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.assigned_to'), $target->present()->fullName())
|
||||
->fact(trans('mail.Consumable_checkout_notification')." by ", $admin->display_name)
|
||||
->fact(trans('mail.assigned_to'), $target->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
$message = trans('mail.Consumable_checkout_notification');
|
||||
$details = [
|
||||
trans('mail.assigned_to') => $target->present()->fullName(),
|
||||
trans('mail.assigned_to') => $target->display_name,
|
||||
trans('mail.item') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.Consumable_checkout_notification').' by' => $admin->present()->fullName(),
|
||||
trans('mail.Consumable_checkout_notification').' by' => $admin->display_name,
|
||||
trans('admin/consumables/general.remaining') => $item->numRemaining(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
@ -152,7 +152,7 @@ class CheckoutConsumableNotification extends Notification
|
||||
Section::create(
|
||||
KeyValue::create(
|
||||
trans('mail.assigned_to') ?: '',
|
||||
$target->present()->fullName() ?: '',
|
||||
$target->display_name ?: '',
|
||||
trans('admin/consumables/general.remaining').': '.$item->numRemaining(),
|
||||
)
|
||||
->onClick(route('users.show', $target->id))
|
||||
|
||||
@ -78,8 +78,8 @@ class CheckoutLicenseSeatNotification extends Notification
|
||||
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
|
||||
|
||||
$fields = [
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
|
||||
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->display_name.'>',
|
||||
];
|
||||
|
||||
if ($item->location) {
|
||||
@ -115,17 +115,17 @@ class CheckoutLicenseSeatNotification extends Notification
|
||||
->title(trans('mail.License_Checkout_Notification'))
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact(trans('mail.License_Checkout_Notification')." by ", $admin->present()->fullName())
|
||||
->fact(trans('mail.assigned_to'), $target->present()->fullName())
|
||||
->fact(trans('mail.License_Checkout_Notification')." by ", $admin->display_name)
|
||||
->fact(trans('mail.assigned_to'), $target->display_name)
|
||||
->fact(trans('admin/consumables/general.remaining'), $item->availCount()->count())
|
||||
->fact(trans('mail.notes'), $note ?: '');
|
||||
}
|
||||
|
||||
$message = trans('mail.License_Checkout_Notification');
|
||||
$details = [
|
||||
trans('mail.assigned_to') => $target->present()->fullName(),
|
||||
trans('mail.assigned_to') => $target->display_name,
|
||||
trans('mail.license_for') => htmlspecialchars_decode($item->present()->name),
|
||||
trans('mail.License_Checkout_Notification').' by' => $admin->present()->fullName(),
|
||||
trans('mail.License_Checkout_Notification').' by' => $admin->display_name,
|
||||
trans('admin/consumables/general.remaining') => $item->availCount()->count(),
|
||||
trans('mail.notes') => $note ?: '',
|
||||
];
|
||||
|
||||
@ -79,7 +79,7 @@ class RequestAssetCancelation extends Notification
|
||||
|
||||
$fields = [
|
||||
'QTY' => $qty,
|
||||
'Canceled By' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
'Canceled By' => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
];
|
||||
|
||||
if (($this->expected_checkin) && ($this->expected_checkin != '')) {
|
||||
|
||||
@ -78,7 +78,7 @@ class RequestAssetNotification extends Notification
|
||||
|
||||
$fields = [
|
||||
'QTY' => $qty,
|
||||
'Requested By' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
|
||||
'Requested By' => '<'.$target->present()->viewUrl().'|'.$target->display_name.'>',
|
||||
];
|
||||
|
||||
return (new SlackMessage)
|
||||
|
||||
@ -191,7 +191,7 @@ class ComponentPresenter extends Presenter
|
||||
*/
|
||||
public function nameUrl()
|
||||
{
|
||||
return (string) link_to_route('components.show', e($this->name), $this->id);
|
||||
return (string) link_to_route('consumables.show', e($this->name), $this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,6 +200,6 @@ class ComponentPresenter extends Presenter
|
||||
*/
|
||||
public function viewUrl()
|
||||
{
|
||||
return route('components.show', $this->id);
|
||||
return route('accessories.show', $this->id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
namespace App\Presenters;
|
||||
|
||||
use App\Models\SnipeModel;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
|
||||
abstract class Presenter
|
||||
{
|
||||
@ -69,10 +70,30 @@ abstract class Presenter
|
||||
return '';
|
||||
}
|
||||
|
||||
public function name()
|
||||
{
|
||||
return $this->model->name;
|
||||
}
|
||||
// public function name()
|
||||
// {
|
||||
// return $this->model->name;
|
||||
// }
|
||||
//
|
||||
// public function display_name()
|
||||
// {
|
||||
// return $this->model->display_name;
|
||||
// }
|
||||
|
||||
|
||||
// protected function displayName(): Attribute
|
||||
// {
|
||||
// // This override should only kick in if the model has a display_name prope
|
||||
// if ($this->getRawOriginal('display_name')) {
|
||||
// return Attribute:: make (
|
||||
// get: fn(mixed $value) => 'Poop:'.$this->display_name
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// return Attribute:: make(
|
||||
// get: fn(mixed $value) => 'Fart: '.$this->name,
|
||||
// );
|
||||
// }
|
||||
|
||||
public function __get($property)
|
||||
{
|
||||
@ -80,7 +101,7 @@ abstract class Presenter
|
||||
return $this->{$property}();
|
||||
}
|
||||
|
||||
return e($this->model->{$property});
|
||||
return $this->model->{$property};
|
||||
}
|
||||
|
||||
public function __call($method, $args)
|
||||
|
||||
@ -79,6 +79,14 @@ class UserPresenter extends Presenter
|
||||
'visible' => false,
|
||||
'formatter' => 'usersLinkFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'display_name',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => false,
|
||||
'title' => trans('admin/users/table.display_name'),
|
||||
'visible' => true,
|
||||
],
|
||||
[
|
||||
'field' => 'jobtitle',
|
||||
'searchable' => true,
|
||||
@ -191,6 +199,7 @@ class UserPresenter extends Presenter
|
||||
'visible' => true,
|
||||
'formatter' => 'usernameRoleLinkFormatter',
|
||||
],
|
||||
|
||||
[
|
||||
'field' => 'employee_num',
|
||||
'searchable' => true,
|
||||
@ -447,20 +456,23 @@ class UserPresenter extends Presenter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fullName()
|
||||
{
|
||||
return html_entity_decode($this->first_name.' '.$this->last_name, ENT_QUOTES | ENT_XML1, 'UTF-8');
|
||||
}
|
||||
// public function fullName()
|
||||
// {
|
||||
// if ($this->display_name) {
|
||||
// return 'kjdfh'.html_entity_decode($this->display_name, ENT_QUOTES | ENT_XML1, 'UTF-8');
|
||||
// }
|
||||
// return 'roieuoe'.html_entity_decode($this->first_name.' '.$this->last_name, ENT_QUOTES | ENT_XML1, 'UTF-8');
|
||||
// }
|
||||
|
||||
/**
|
||||
* Standard accessor.
|
||||
* @TODO Remove presenter::fullName() entirely?
|
||||
* @return string
|
||||
*/
|
||||
public function name()
|
||||
{
|
||||
return $this->fullName();
|
||||
}
|
||||
// /**
|
||||
// * Standard accessor.
|
||||
// * @TODO Remove presenter::fullName() entirely?
|
||||
// * @return string
|
||||
// */
|
||||
// public function name()
|
||||
// {
|
||||
// return $this->fullName();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -74,12 +74,12 @@ class BreadcrumbsServiceProvider extends ServiceProvider
|
||||
|
||||
Breadcrumbs::for('hardware.show', fn (Trail $trail, Asset $asset) =>
|
||||
$trail->parent('hardware.index', route('hardware.index'))
|
||||
->push($asset->present()->fullName(), route('hardware.show', $asset))
|
||||
->push($asset->display_name, route('hardware.show', $asset))
|
||||
);
|
||||
|
||||
Breadcrumbs::for('hardware.edit', fn (Trail $trail, Asset $asset) =>
|
||||
$trail->parent('hardware.index', route('hardware.index'))
|
||||
->push($asset->present()->fullName(), route('hardware.show', $asset))
|
||||
->push($asset->display_name, route('hardware.show', $asset))
|
||||
->push(trans('admin/hardware/general.edit'))
|
||||
);
|
||||
|
||||
@ -579,7 +579,7 @@ class BreadcrumbsServiceProvider extends ServiceProvider
|
||||
|
||||
Breadcrumbs::for('users.show', fn (Trail $trail, User $user) =>
|
||||
$trail->parent('users.index', route('users.index'))
|
||||
->push($user->getFullNameAttribute() ?? 'Missing Username!', route('users.show', $user))
|
||||
->push($user->display_name ?? 'Missing Username!', route('users.show', $user))
|
||||
);
|
||||
|
||||
Breadcrumbs::for('users.edit', fn (Trail $trail, User $user) =>
|
||||
|
||||
@ -207,7 +207,7 @@ return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Require SAML Login
|
||||
| Require SAML Login
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Disable the ability to login via form login, and disables the 'nosaml'
|
||||
@ -220,6 +220,23 @@ return [
|
||||
|
||||
'require_saml' => env('REQUIRE_SAML', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SAML KEYS
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the size of the keys used by openssl_pkey_new for SAML authentication.
|
||||
| The default is 2048 bits, but this can be changed to 3072 or 4096 bits
|
||||
| for higher security. Note that this will increase the time it takes to
|
||||
| generate the keys, so it is not recommended to set this to a very high value
|
||||
| unless you have a specific need for it.
|
||||
|
|
||||
| The European Commission now requires at least 3072-bit keys for new SAML certificates
|
||||
| @link https://github.com/grokability/snipe-it/issues/17386
|
||||
*/
|
||||
|
||||
'saml_key_size' => env('SAML_KEY_SIZE', 2048),
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@ -84,6 +84,28 @@ class ActionlogFactory extends Factory
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This sets up an ActionLog representing a manually added note tied to an Asset,
|
||||
* with an optional User as the creator. If no User is provided, one is generated.
|
||||
*
|
||||
* @param User|null $user Optional user to associate as the creator of the note.
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory<ActionLog>
|
||||
*/
|
||||
public function assetNote(?User $user=null)
|
||||
{
|
||||
return $this
|
||||
->state(function () use ($user) {
|
||||
return [
|
||||
'action_type' => 'note added',
|
||||
'item_type' => Asset::class,
|
||||
'target_type' => 'asset',
|
||||
'note' => 'Factory-generated manual note',
|
||||
'created_by' => $user?->id ?? User::factory(),
|
||||
];
|
||||
})
|
||||
->for($user ?? User::factory(), 'user');
|
||||
}
|
||||
|
||||
public function licenseCheckoutToUser()
|
||||
{
|
||||
return $this->state(function () {
|
||||
|
||||
@ -28,8 +28,9 @@ class UserFactory extends Factory
|
||||
'email' => $this->faker->safeEmail(),
|
||||
'employee_num' => $this->faker->numberBetween(3500, 35050),
|
||||
'first_name' => $this->faker->firstName(),
|
||||
'jobtitle' => $this->faker->jobTitle(),
|
||||
'last_name' => $this->faker->lastName(),
|
||||
'display_name' => null,
|
||||
'jobtitle' => $this->faker->jobTitle(),
|
||||
'locale' => 'en-US',
|
||||
'notes' => 'Created by DB seeder',
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'display_name')) {
|
||||
$table->text('display_name')->after('last_name')->nullable()->default(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('users', 'display_name')) {
|
||||
$table->dropColumn('display_name');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_display_name')) {
|
||||
$table->string('ldap_display_name', 191)->after('ldap_fname_field')->nullable()->default(null);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_zip')) {
|
||||
$table->string('ldap_zip', 191)->after('ldap_manager')->nullable()->default(null);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_state')) {
|
||||
$table->string('ldap_state', 191)->after('ldap_manager')->nullable()->default(null);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_city')) {
|
||||
$table->string('ldap_city', 191)->after('ldap_manager')->nullable()->default(null);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_address')) {
|
||||
$table->string('ldap_address', 191)->after('ldap_manager')->nullable()->default(null);
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('settings', 'ldap_mobile')) {
|
||||
$table->string('ldap_mobile', 191)->after('ldap_phone_field')->nullable()->default(null);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_display_name')) {
|
||||
$table->dropColumn('ldap_display_name');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_zip')) {
|
||||
$table->dropColumn('ldap_zip');
|
||||
}
|
||||
});
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_address')) {
|
||||
$table->dropColumn('ldap_address');
|
||||
}
|
||||
});
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_city')) {
|
||||
$table->dropColumn('ldap_city');
|
||||
}
|
||||
});
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_state')) {
|
||||
$table->dropColumn('ldap_state');
|
||||
}
|
||||
});
|
||||
Schema::table('settings', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('settings', 'ldap_mobile')) {
|
||||
$table->dropColumn('ldap_mobile');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->index(['created_at']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('models', function (Blueprint $table) {
|
||||
$table->dropIndex(['created_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/css/dist/all.css
vendored
2
public/css/dist/all.css
vendored
File diff suppressed because one or more lines are too long
@ -2,8 +2,8 @@
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=5c191843e0bb9292ec6b7f0a3c5765b3",
|
||||
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=bf1a348eae3e60c62b8879953f7df14c",
|
||||
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=146086d653897e2557af5e68f6f8c56f",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=9aea2f652724c59f1d4ad5243426ba5d",
|
||||
"/css/build/app.css": "/css/build/app.css?id=1674f26bdc2a6a84188ca514ffeb8d1b",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=76e64b2cfa4ab7008e0f57bc6de5e05e",
|
||||
"/css/build/app.css": "/css/build/app.css?id=84cb527ec7ce2ff26744420d6f4df96f",
|
||||
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=bdf169bc2141f453390614c138cdce95",
|
||||
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=e1e6e1c64cf14fc350585aaeb0e42f6b",
|
||||
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=08ae1b3e66008966ce5d600ea3ad04a2",
|
||||
@ -19,7 +19,7 @@
|
||||
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=68a92d85c8e351dfb38a835307f126ec",
|
||||
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=cbb20ad6182b658f34117bf96a621b63",
|
||||
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=84e2ee950ae04444988b37038e5a3951",
|
||||
"/css/dist/all.css": "/css/dist/all.css?id=f58c91a56f1fb4629636fcdf204dc031",
|
||||
"/css/dist/all.css": "/css/dist/all.css?id=db8c87683d06d40dc1d6c788a311fa1e",
|
||||
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
|
||||
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",
|
||||
|
||||
@ -1243,3 +1243,12 @@ caption.tableCaption {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.visually-hidden {
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0,0,0,0);
|
||||
white-space: preserve;
|
||||
display: inline-block;
|
||||
}
|
||||
@ -93,11 +93,11 @@ return [
|
||||
'ldap_integration' => 'LDAP Integration',
|
||||
'ldap_settings' => 'LDAP Settings',
|
||||
'ldap_client_tls_cert_help' => 'Client-Side TLS Certificate and Key for LDAP connections are usually only useful in Google Workspace configurations with "Secure LDAP." Both are required.',
|
||||
'ldap_location' => 'LDAP Location',
|
||||
'ldap_location_help' => 'The Ldap Location field should be used if <strong>an OU is not being used in the Base Bind DN.</strong> Leave this blank if an OU search is being used.',
|
||||
'ldap_location' => 'LDAP Location Field',
|
||||
'ldap_location_help' => 'The LDAP Location field should be used if <strong>an OU is not being used in the Base Bind DN.</strong> Leave this blank if an OU search is being used.',
|
||||
'ldap_login_test_help' => 'Enter a valid LDAP username and password from the base DN you specified above to test whether your LDAP login is configured correctly. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_login_sync_help' => 'This only tests that LDAP can sync correctly. If your LDAP Authentication query is not correct, users may still not be able to login. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_manager' => 'LDAP Manager',
|
||||
'ldap_login_sync_help' => 'This only tests that LDAP can sync and that your fields are mapped correctly. If your LDAP Authentication query is not correct, users may still not be able to login. YOU MUST SAVE YOUR UPDATED LDAP SETTINGS FIRST.',
|
||||
'ldap_manager' => 'LDAP Manager Field',
|
||||
'ldap_server' => 'LDAP Server',
|
||||
'ldap_server_help' => 'This should start with ldap:// (for unencrypted) or ldaps:// (for TLS or SSL)',
|
||||
'ldap_server_cert' => 'LDAP SSL certificate validation',
|
||||
@ -106,26 +106,33 @@ return [
|
||||
'ldap_tls' => 'Use TLS',
|
||||
'ldap_tls_help' => 'This should be checked only if you are running STARTTLS on your LDAP server. ',
|
||||
'ldap_uname' => 'LDAP Bind Username',
|
||||
'ldap_dept' => 'LDAP Department',
|
||||
'ldap_phone' => 'LDAP Telephone Number',
|
||||
'ldap_jobtitle' => 'LDAP Job Title',
|
||||
'ldap_country' => 'LDAP Country',
|
||||
'ldap_dept' => 'LDAP Department Field',
|
||||
'ldap_phone' => 'LDAP Phone Number Field',
|
||||
'ldap_jobtitle' => 'LDAP Job Title Field',
|
||||
'ldap_country' => 'LDAP Country Field',
|
||||
'ldap_pword' => 'LDAP Bind Password',
|
||||
'ldap_basedn' => 'Base Bind DN',
|
||||
'ldap_filter' => 'LDAP Filter',
|
||||
'ldap_pw_sync' => 'Cache LDAP Passwords',
|
||||
'ldap_pw_sync_help' => 'Uncheck this box if you do not wish to keep LDAP passwords cached as local hashed passwords. Disabling this means that your users may not be able to login if your LDAP server is unreachable for some reason.',
|
||||
'ldap_username_field' => 'Username Field',
|
||||
'ldap_lname_field' => 'Last Name',
|
||||
'ldap_fname_field' => 'LDAP First Name',
|
||||
'ldap_username_field' => 'LDAP Username Field',
|
||||
'ldap_display_name' => 'LDAP Display Name Field',
|
||||
'ldap_display_name_help' => 'If you have a separate displayName field in your LDAP/AD, map it here and it will be used for displaying users within Snipe-IT.',
|
||||
'ldap_lname_field' => 'LDAP Last Name Field',
|
||||
'ldap_fname_field' => 'LDAP First Name Field',
|
||||
'ldap_auth_filter_query' => 'LDAP Authentication query',
|
||||
'ldap_version' => 'LDAP Version',
|
||||
'ldap_active_flag' => 'LDAP Active Flag',
|
||||
'ldap_activated_flag_help' => 'This value is used to determine whether a synced user can login to Snipe-IT. <strong>It does not affect the ability to check items in or out to them</strong>, and should be the <strong>attribute name</strong> within your AD/LDAP, <strong>not the value</strong>. <br><br>If this field is set to a field name that does not exist in your AD/LDAP, or the value in the AD/LDAP field is set to <code>0</code> or <code>false</code>, <strong>user login will be disabled</strong>. If the value in the AD/LDAP field is set to <code>1</code> or <code>true</code> or <em>any other text</em> means the user can log in. When the field is blank in your AD, we respect the <code>userAccountControl</code> attribute, which usually allows non-suspended users to log in.',
|
||||
'ldap_invert_active_flag' => 'LDAP Invert Active Flag',
|
||||
'ldap_invert_active_flag_help' => 'If enabled: when the value returned by LDAP Active Flag is <code>0</code> or <code>false</code> the user account will be active.',
|
||||
'ldap_emp_num' => 'LDAP Employee Number',
|
||||
'ldap_email' => 'LDAP Email',
|
||||
'ldap_emp_num' => 'LDAP Employee Number Field',
|
||||
'ldap_email' => 'LDAP Email Field',
|
||||
'ldap_mobile' => 'LDAP Mobile Field',
|
||||
'ldap_address' => 'LDAP Address Field',
|
||||
'ldap_city' => 'LDAP City Field',
|
||||
'ldap_state' => 'LDAP State/Province Field',
|
||||
'ldap_zip' => 'LDAP Postal Code Field',
|
||||
'ldap_test' => 'Test LDAP',
|
||||
'ldap_test_sync' => 'Test LDAP Synchronization',
|
||||
'license' => 'Software License',
|
||||
@ -462,21 +469,24 @@ return [
|
||||
|
||||
|
||||
'legends' => [
|
||||
'scoping' => 'Scoping',
|
||||
'formats' => 'Default Formats',
|
||||
'profiles' => 'User Profiles',
|
||||
'eula' => 'EULA & Acceptance Preferences',
|
||||
'misc_display' => 'Miscellaneous Display Options',
|
||||
'email' => 'Email Preferences',
|
||||
'checkin' => 'Checkin Preferences',
|
||||
'dashboard' => 'Login & Dashboard Preferences',
|
||||
'misc' => 'Miscellaneous',
|
||||
'logos' => 'Logos & Display',
|
||||
'colors' => 'Colors & Skins',
|
||||
'dashboard' => 'Login & Dashboard Preferences',
|
||||
'email' => 'Email Preferences',
|
||||
'eula' => 'EULA & Acceptance Preferences',
|
||||
'footer' => 'Footer Preferences',
|
||||
'security' => 'Security Preferences',
|
||||
'formats' => 'Default Formats',
|
||||
'general' => 'General',
|
||||
'intervals' => 'Intervals & Thresholds',
|
||||
'logos' => 'Logos & Display',
|
||||
'mapping' => 'LDAP Field Mapping',
|
||||
'test' => 'Test LDAP Connection',
|
||||
'misc' => 'Miscellaneous',
|
||||
'misc_display' => 'Miscellaneous Display Options',
|
||||
'profiles' => 'User Profiles',
|
||||
'server' => 'Server Settings',
|
||||
'scoping' => 'Scoping',
|
||||
'security' => 'Security Preferences',
|
||||
],
|
||||
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ return array(
|
||||
'total_assets_cost' => "Total Assets Cost",
|
||||
'updateuser' => 'Update User',
|
||||
'username' => 'Username',
|
||||
'display_name' => 'Display Name',
|
||||
'user_deleted_text' => 'This user has been marked as deleted.',
|
||||
'username_note' => '(This is used for Active Directory binding only, not for login.)',
|
||||
'cloneuser' => 'Clone User',
|
||||
|
||||
@ -36,6 +36,7 @@ return [
|
||||
'accept_assets_menu' => 'Accept Assets',
|
||||
'accept_item' => 'Accept Item',
|
||||
'audit' => 'Audit',
|
||||
'audited' => 'Audited',
|
||||
'audits' => 'Audits',
|
||||
'audit_report' => 'Audit Log',
|
||||
'assets' => 'Assets',
|
||||
|
||||
@ -139,7 +139,7 @@
|
||||
<input class="form-control" type="text" name="gravatar" id="gravatar" value="{{ old('gravatar', $user->gravatar) }}" />
|
||||
{!! $errors->first('gravatar', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
|
||||
<p style="padding-top: 3px;">
|
||||
<img src="//secure.gravatar.com/avatar/{{ md5(strtolower(trim($user->gravatar))) }}" width="30" height="30" alt="{{ $user->present()->fullName() }} avatar image">
|
||||
<img src="//secure.gravatar.com/avatar/{{ md5(strtolower(trim($user->gravatar))) }}" width="30" height="30" alt="{{ $user->display_name }} avatar image">
|
||||
{!! trans('general.gravatar_url') !!}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
{{-- Page title --}}
|
||||
@section('title')
|
||||
{{ trans('general.hello_name', array('name' => $user->present()->getFullNameAttribute())) }}
|
||||
{{ trans('general.hello_name', array('name' => $user->display_name)) }}
|
||||
@parent
|
||||
@stop
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
<select name="user_id" id="user_id" class="form-control select2" onchange="this.form.submit()" style="width: 250px; display: inline-block;">
|
||||
@foreach ($subordinates as $subordinate)
|
||||
<option value="{{ $subordinate->id }}" {{ (int)$selectedUserId === (int)$subordinate->id ? ' selected' : '' }}>
|
||||
{{ $subordinate->present()->fullName() }}
|
||||
{{ $subordinate->display_name }}
|
||||
@if ($subordinate->id == auth()->id())
|
||||
({{ trans('general.me') }})
|
||||
@endif
|
||||
@ -133,7 +133,7 @@
|
||||
<div class="col-md-3 col-xs-12 col-sm-push-9">
|
||||
|
||||
<div class="col-md-12 text-center">
|
||||
<img src="{{ $user->present()->gravatar() }}" class=" img-thumbnail hidden-print" style="margin-bottom: 20px;" alt="{{ $user->present()->fullName() }}" alt="User avatar">
|
||||
<img src="{{ $user->present()->gravatar() }}" class=" img-thumbnail hidden-print" style="margin-bottom: 20px;" alt="{{ $user->display_name }}" alt="User avatar">
|
||||
</div>
|
||||
@can('self.profile')
|
||||
<div class="col-md-12">
|
||||
@ -204,7 +204,7 @@
|
||||
{{ trans('admin/users/table.name') }}
|
||||
</div>
|
||||
<div class="col-md-9 col-sm-2">
|
||||
{{ $user->present()->fullName() }}
|
||||
{{ $user->display_name }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -309,9 +309,7 @@
|
||||
{{ trans('admin/users/table.manager') }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="{{ route('users.show', $user->manager->id) }}">
|
||||
{{ $user->manager->getFullNameAttribute() }}
|
||||
</a>
|
||||
<x-full-user-name :user="$user->manager" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@ -2,26 +2,22 @@
|
||||
'user'
|
||||
])
|
||||
|
||||
@if($user)
|
||||
@php
|
||||
$fullName = $user->present()->fullName();
|
||||
@endphp
|
||||
|
||||
@if ($user)
|
||||
@can('view', $user)
|
||||
@if(! $user->trashed())
|
||||
{{-- if the user is in database but soft-deleted --}}
|
||||
<a href="{{ route('users.show', $user->id) }}">{{ $fullName }}</a>
|
||||
{{-- if the user is in database, the viewer CAN see them, and the user is not deleted --}}
|
||||
<a href="{{ route('users.show', $user->id) }}">{{ $user->display_name }}</a>
|
||||
@else
|
||||
{{-- if the user exists --}}
|
||||
<s><a href="{{ route('users.show', $user->id) }}">{{ $fullName }}</a></s>
|
||||
{{-- if the user is soft deleted, but the viewer can see them, add a strikethrough --}}
|
||||
<s><a href="{{ route('users.show', $user->id) }}">{{ $user->display_name }}</a></s>
|
||||
@endif
|
||||
@else
|
||||
@if(! $user->trashed())
|
||||
{{-- if the user is in database but soft-deleted --}}
|
||||
<span>{{ $fullName }}</span>
|
||||
{{-- if the user is in database and not soft-deleted --}}
|
||||
<span>{{ $user->display_name }}</span>
|
||||
@else
|
||||
{{-- if the user exists --}}
|
||||
<s><span>{{ $fullName }}</span></s>
|
||||
{{-- if the user exists but is deleted and the viewer cannot click through to see their details --}}
|
||||
<s><span>{{ $user->display_name }}</span></s>
|
||||
@endif
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
<td>
|
||||
@if ($request->requestingUser() && !$request->requestingUser()->trashed())
|
||||
<a href="{{ config('app.url') }}/users/{{ $request->requestingUser()->id }}">
|
||||
{{ $request->requestingUser()->present()->fullName() }}
|
||||
{{ $request->requestingUser()->display_name }}
|
||||
</a>
|
||||
@else
|
||||
(deleted user)
|
||||
|
||||
@ -338,7 +338,7 @@
|
||||
|
||||
@if (($asset->checkedOutToUser()) && ($asset->assignedTo->present()->gravatar()))
|
||||
<li>
|
||||
<img src="{{ $asset->assignedTo->present()->gravatar() }}" class="user-image-inline hidden-print" alt="{{ $asset->assignedTo->present()->fullName() }}">
|
||||
<img src="{{ $asset->assignedTo->present()->gravatar() }}" class="user-image-inline hidden-print" alt="{{ $asset->assignedTo->display_name }}">
|
||||
{!! $asset->assignedTo->present()->nameUrl() !!}
|
||||
</li>
|
||||
@else
|
||||
@ -547,7 +547,7 @@
|
||||
{!! $asset->checkInvalidNextAuditDate() ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
|
||||
{{ Helper::getFormattedDateObject($audit_log->created_at, 'datetime', false) }}
|
||||
@if ($audit_log->user)
|
||||
(by {{ link_to_route('users.show', $audit_log->user->present()->fullname(), [$audit_log->user->id]) }})
|
||||
(by {{ link_to_route('users.show', $audit_log->user->display_name, [$audit_log->user->id]) }})
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@ -732,7 +732,7 @@
|
||||
@if (!empty($asset->{$field->db_column_name()}))
|
||||
{{-- Hidden span used as copy target --}}
|
||||
{{-- It's tempting to break out the HTML into separate lines for this, but it results in extra spaces being added onto the end of the coipied value --}}
|
||||
<span class="js-copy-{{ $field->id }} hidden-print" style="font-size: 0px;">{{ ($field->isFieldDecryptable($asset->{$field->db_column_name()}) ? Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) : $asset->{$field->db_column_name()}) }}</span>
|
||||
<span class="js-copy-{{ $field->id }} visually-hidden hidden-print" style="font-size: 0px;">{{ ($field->isFieldDecryptable($asset->{$field->db_column_name()}) ? Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}) : $asset->{$field->db_column_name()}) }}</span>
|
||||
|
||||
{{-- Clipboard icon --}}
|
||||
<i class="fa-regular fa-clipboard js-copy-link hidden-print"
|
||||
@ -755,7 +755,7 @@
|
||||
$fieldSize = strlen(Helper::gracefulDecrypt($field, $asset->{$field->db_column_name()}))
|
||||
@endphp
|
||||
@if ($fieldSize > 0)
|
||||
<span id="text-{{ $field->id }}-to-hide">{{ str_repeat('*', $fieldSize) }}</span>
|
||||
<span id="text-{{ $field->id }}-to-hide">***********</span>
|
||||
@if (($field->format=='URL') && ($asset->{$field->db_column_name()}!=''))
|
||||
<span class="js-copy-{{ $field->id }} hidden-print"
|
||||
id="text-{{ $field->id }}-to-show"
|
||||
@ -809,7 +809,7 @@
|
||||
<div class="col-md-9">
|
||||
{{ Helper::getFormattedDateObject($asset->purchase_date, 'date', false) }}
|
||||
-
|
||||
{{ Carbon::parse($asset->purchase_date)->diff(Carbon::now())->format('%y years, %m months and %d days')}}
|
||||
{{ Carbon::parse($asset->purchase_date)->diffForHumans(['parts' => 3]) }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -930,9 +930,7 @@
|
||||
<div class="col-md-3">
|
||||
<strong>
|
||||
{{ trans('admin/hardware/form.warranty_expires') }}
|
||||
@if ($asset->purchase_date)
|
||||
{!! $asset->present()->warranty_expires() < date("Y-m-d") ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
|
||||
@endif
|
||||
|
||||
|
||||
</strong>
|
||||
</div>
|
||||
@ -940,7 +938,11 @@
|
||||
@if ($asset->purchase_date)
|
||||
{{ Helper::getFormattedDateObject($asset->present()->warranty_expires(), 'date', false) }}
|
||||
-
|
||||
{{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans(['parts' => 2]) }}
|
||||
{{ Carbon::parse($asset->present()->warranty_expires())->diffForHumans(['parts' => 3]) }}
|
||||
|
||||
@if ($asset->purchase_date)
|
||||
{!! $asset->present()->warranty_expires() < date("Y-m-d") ? '<i class="fas fa-exclamation-triangle text-orange" aria-hidden="true"></i>' : '' !!}
|
||||
@endif
|
||||
@else
|
||||
{{ trans('general.na_no_purchase_date') }}
|
||||
@endif
|
||||
@ -971,7 +973,7 @@
|
||||
@if ($asset->purchase_date)
|
||||
{{ Helper::getFormattedDateObject($asset->depreciated_date()->format('Y-m-d'), 'date', false) }}
|
||||
-
|
||||
{{ Carbon::parse($asset->depreciated_date())->diffForHumans(['parts' => 2]) }}
|
||||
{{ Carbon::parse($asset->depreciated_date())->diffForHumans(['parts' => 3]) }}
|
||||
@else
|
||||
{{ trans('general.na_no_purchase_date') }}
|
||||
@endif
|
||||
@ -1008,7 +1010,7 @@
|
||||
@if ($asset->asset_eol_date)
|
||||
{{ Helper::getFormattedDateObject($asset->asset_eol_date, 'date', false) }}
|
||||
-
|
||||
{{ Carbon::parse($asset->asset_eol_date)->diffForHumans(['parts' => 2]) }}
|
||||
{{ Carbon::parse($asset->asset_eol_date)->locale(app()->getLocale())->diffForHumans(['parts' => 3]) }}
|
||||
@else
|
||||
{{ trans('general.na_no_purchase_date') }}
|
||||
@endif
|
||||
@ -1017,7 +1019,7 @@
|
||||
data-placement="top"
|
||||
data-title="Explicit EOL"
|
||||
title="Explicit EOL">
|
||||
<x-icon type="warning" class="text-orange" />
|
||||
<x-icon type="warning" class="text-primary" />
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@ -353,7 +353,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
|
||||
@endif
|
||||
|
||||
<span class="hidden-xs">
|
||||
{{ Auth::user()->getFullNameAttribute() }}
|
||||
{{ Auth::user()->display_name }}
|
||||
<strong class="caret"></strong>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<title>{{ trans('general.assigned_to', array('name' => $location->present()->fullName())) }} </title>
|
||||
<title>{{ trans('general.assigned_to', array('name' => $location->display_name)) }} </title>
|
||||
<style>
|
||||
body {
|
||||
font-family: "Arial, Helvetica", sans-serif;
|
||||
@ -49,9 +49,9 @@
|
||||
@endif
|
||||
@endif
|
||||
|
||||
<h2>{{ trans('general.assigned_to', array('name' => $location->present()->fullName())) }}</h2>
|
||||
<h2>{{ trans('general.assigned_to', array('name' => $location->display_name)) }}</h2>
|
||||
@if ($parent)
|
||||
{{ $parent->present()->fullName() }}
|
||||
{{ $parent->display_name }}
|
||||
@endif
|
||||
<br>
|
||||
@if ($company)
|
||||
@ -59,7 +59,7 @@
|
||||
<br>
|
||||
@endif
|
||||
@if ($manager)
|
||||
<b>{{ trans('general.manager') }}</b> {{ $manager->present()->fullName() }}<br>
|
||||
<b>{{ trans('general.manager') }}</b> {{ $manager->display_name }}<br>
|
||||
@endif
|
||||
<b>{{ trans('general.date') }}</b> {{ \App\Helpers\Helper::getFormattedDateObject(now(), 'datetime', false) }}<br><br>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
|
||||
# {{ trans('mail.hello') }} {{ $target->display_name }},
|
||||
|
||||
{{ trans('mail.the_following_item') }}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
| **{{ trans('general.model_no') }}** | {{ $item->model_no }} |
|
||||
@endif
|
||||
@if ($admin)
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->display_name }} |
|
||||
@endif
|
||||
@if ($note)
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
|
||||
# {{ trans('mail.hello') }} {{ $target->display_name }},
|
||||
|
||||
{{ trans('mail.the_following_item') }}
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
@endif
|
||||
@endforeach
|
||||
@if ($admin)
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->display_name }} |
|
||||
@endif
|
||||
@if ($note)
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $target->assignedto->present()->fullName() }},
|
||||
# {{ trans('mail.hello') }} {{ $target->assignedto->display_name }},
|
||||
|
||||
{{ trans('mail.the_following_item') }}
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
| **{{ trans('general.manufacturer') }}** | {{ $item->manufacturer->name }} |
|
||||
@endif
|
||||
@if ($admin)
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->display_name }} |
|
||||
@endif
|
||||
@if ($note)
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $target->present()->fullName() }},
|
||||
# {{ trans('mail.hello') }} {{ $target->display_name }},
|
||||
|
||||
{{ trans('mail.the_following_item') }}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
| **{{ trans('general.category') }}** | {{ $license->category->name }} |
|
||||
@endif
|
||||
@if ($admin)
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->display_name }} |
|
||||
@endif
|
||||
@if ($note)
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }} {{ $recipient->present()->fullName() }},
|
||||
# {{ trans('mail.hello') }} {{ $recipient->display_name }},
|
||||
|
||||
{{ $introduction }}:
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
@component('mail::table')
|
||||
| | |
|
||||
| ------------- | ------------- |
|
||||
| **{{ trans('mail.user') }}** | {{ $assignedTo->present()->fullName() }} |
|
||||
| **{{ trans('mail.user') }}** | {{ $assignedTo->display_name }} |
|
||||
| **{{ trans('mail.name') }}** | {{ $item->present()->name() }} |
|
||||
@if (isset($item->asset_tag))
|
||||
| **{{ trans('mail.asset_tag') }}** | {{ $item->asset_tag }} |
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@component('mail::message')
|
||||
# {{ trans('mail.hello') }}{{ $target->assignedto?->present()->fullName() ? ' ' . $target->assignedto->present()->fullName() . ',' : ',' }}
|
||||
# {{ trans('mail.hello') }}{{ $target->assignedto?->display_name ? ' ' . $target->assignedto->display_name . ',' : ',' }}
|
||||
|
||||
{{ trans('mail.new_item_checked') }}
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
| **{{ trans('mail.additional_notes') }}** | {{ $note }} |
|
||||
@endif
|
||||
@if ($admin)
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->present()->fullName() }} |
|
||||
| **{{ trans('general.administrator') }}** | {{ $admin->display_name }} |
|
||||
@endif
|
||||
@endcomponent
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user