mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Merge branch 'develop'
# Conflicts: # config/version.php
This commit is contained in:
commit
a988011f0c
|
@ -829,6 +829,15 @@
|
|||
"test",
|
||||
"code"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "Gelob",
|
||||
"name": "Ryan",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/422752?v=4",
|
||||
"profile": "https://github.com/Gelob",
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[![Build Status](https://travis-ci.org/snipe/snipe-it.svg?branch=develop)](https://travis-ci.org/snipe/snipe-it) [![Stories in Ready](https://badge.waffle.io/snipe/snipe-it.png?label=ready+for+dev&title=Ready+for+development)](http://waffle.io/snipe/snipe-it) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() [![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Twitter Follow](https://img.shields.io/twitter/follow/snipeyhead.svg?style=social)](https://twitter.com/snipeyhead) [![Zenhub](https://img.shields.io/badge/Shipping_faster_with-ZenHub-5e60ba.svg)](https://zenhub.io) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-89-orange.svg?style=flat-square)](#contributors)
|
||||
[![All Contributors](https://img.shields.io/badge/all_contributors-90-orange.svg?style=flat-square)](#contributors)
|
||||
|
||||
|
||||
## Snipe-IT - Open Source Asset Management System
|
||||
|
@ -68,7 +68,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
|
|||
| [<img src="https://avatars2.githubusercontent.com/u/857740?v=3" width="110px;"/><br /><sub>Gil Rutkowski</sub>](http://FlashingCursor.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=flashingcursor "Code") | [<img src="https://avatars3.githubusercontent.com/u/129360?v=3" width="110px;"/><br /><sub>Desmond Morris</sub>](http://www.desmondmorris.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=desmondmorris "Code") | [<img src="https://avatars2.githubusercontent.com/u/52936?v=3" width="110px;"/><br /><sub>Nick Peelman</sub>](http://peelman.us)<br />[💻](https://github.com/snipe/snipe-it/commits?author=peelman "Code") | [<img src="https://avatars0.githubusercontent.com/u/53161?v=3" width="110px;"/><br /><sub>Abraham Vegh</sub>](https://abrahamvegh.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=abrahamvegh "Code") | [<img src="https://avatars0.githubusercontent.com/u/2818680?v=3" width="110px;"/><br /><sub>Mohamed Rashid</sub>](https://github.com/rashivkp)<br />[📖](https://github.com/snipe/snipe-it/commits?author=rashivkp "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/1509456?v=3" width="110px;"/><br /><sub>Kasey</sub>](http://hinchk.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=HinchK "Code") | [<img src="https://avatars2.githubusercontent.com/u/10522541?v=3" width="110px;"/><br /><sub>Brett</sub>](https://github.com/BrettFagerlund)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=BrettFagerlund "Tests") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/16108587?v=3" width="110px;"/><br /><sub>Jason Spriggs</sub>](http://jasonspriggs.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jasonspriggs "Code") | [<img src="https://avatars2.githubusercontent.com/u/1134568?v=3" width="110px;"/><br /><sub>Nate Felton</sub>](http://n8felton.wordpress.com)<br />[💻](https://github.com/snipe/snipe-it/commits?author=n8felton "Code") | [<img src="https://avatars2.githubusercontent.com/u/14036694?v=3" width="110px;"/><br /><sub>Manasses Ferreira</sub>](http://homepages.dcc.ufmg.br/~manassesferreira)<br />[💻](https://github.com/snipe/snipe-it/commits?author=manassesferreira "Code") | [<img src="https://avatars0.githubusercontent.com/u/15913949?v=3" width="110px;"/><br /><sub>Steve</sub>](https://github.com/steveelwood)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=steveelwood "Tests") | [<img src="https://avatars1.githubusercontent.com/u/3361683?v=3" width="110px;"/><br /><sub>matc</sub>](http://twitter.com/matc)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=matc "Tests") | [<img src="https://avatars3.githubusercontent.com/u/7405702?v=3" width="110px;"/><br /><sub>Cole R. Davis</sub>](http://www.davisracingteam.com)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=VanillaNinjaD "Tests") | [<img src="https://avatars2.githubusercontent.com/u/10167681?v=3" width="110px;"/><br /><sub>gibsonjoshua55</sub>](https://github.com/gibsonjoshua55)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gibsonjoshua55 "Code") |
|
||||
| [<img src="https://avatars2.githubusercontent.com/u/2809241?v=4" width="110px;"/><br /><sub>Robin Temme</sub>](https://github.com/zwerch)<br />[💻](https://github.com/snipe/snipe-it/commits?author=zwerch "Code") | [<img src="https://avatars0.githubusercontent.com/u/6961695?v=4" width="110px;"/><br /><sub>Iman</sub>](https://github.com/imanghafoori1)<br />[💻](https://github.com/snipe/snipe-it/commits?author=imanghafoori1 "Code") | [<img src="https://avatars1.githubusercontent.com/u/6551003?v=4" width="110px;"/><br /><sub>Richard Hofman</sub>](https://github.com/richardhofman6)<br />[💻](https://github.com/snipe/snipe-it/commits?author=richardhofman6 "Code") | [<img src="https://avatars0.githubusercontent.com/u/3697569?v=4" width="110px;"/><br /><sub>gizzmojr</sub>](https://github.com/gizzmojr)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gizzmojr "Code") | [<img src="https://avatars3.githubusercontent.com/u/404729?v=4" width="110px;"/><br /><sub>Jenny Li</sub>](https://github.com/imjennyli)<br />[📖](https://github.com/snipe/snipe-it/commits?author=imjennyli "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/869227?v=4" width="110px;"/><br /><sub>Geoff Young</sub>](https://github.com/GeoffYoung)<br />[💻](https://github.com/snipe/snipe-it/commits?author=GeoffYoung "Code") | [<img src="https://avatars3.githubusercontent.com/u/1068477?v=4" width="110px;"/><br /><sub>Elliot Blackburn</sub>](http://www.elliotblackburn.com)<br />[📖](https://github.com/snipe/snipe-it/commits?author=BlueHatbRit "Documentation") |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/6357451?v=4" width="110px;"/><br /><sub>Tõnis Ormisson</sub>](http://andmemasin.eu)<br />[💻](https://github.com/snipe/snipe-it/commits?author=TonisOrmisson "Code") | [<img src="https://avatars0.githubusercontent.com/u/449411?v=4" width="110px;"/><br /><sub>Nicolai Essig</sub>](http://www.nicolai-essig.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=thakilla "Code") | [<img src="https://avatars1.githubusercontent.com/u/14809698?v=4" width="110px;"/><br /><sub>Danielle</sub>](https://github.com/techincolor)<br />[📖](https://github.com/snipe/snipe-it/commits?author=techincolor "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/18545156?v=4" width="110px;"/><br /><sub>Lawrence</sub>](https://github.com/TheVakman)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=TheVakman "Tests") [🐛](https://github.com/snipe/snipe-it/issues?q=author%3ATheVakman "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/22473767?v=4" width="110px;"/><br /><sub>uknzaeinozpas</sub>](https://github.com/uknzaeinozpas)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Tests") [💻](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Code") |
|
||||
| [<img src="https://avatars1.githubusercontent.com/u/6357451?v=4" width="110px;"/><br /><sub>Tõnis Ormisson</sub>](http://andmemasin.eu)<br />[💻](https://github.com/snipe/snipe-it/commits?author=TonisOrmisson "Code") | [<img src="https://avatars0.githubusercontent.com/u/449411?v=4" width="110px;"/><br /><sub>Nicolai Essig</sub>](http://www.nicolai-essig.de)<br />[💻](https://github.com/snipe/snipe-it/commits?author=thakilla "Code") | [<img src="https://avatars1.githubusercontent.com/u/14809698?v=4" width="110px;"/><br /><sub>Danielle</sub>](https://github.com/techincolor)<br />[📖](https://github.com/snipe/snipe-it/commits?author=techincolor "Documentation") | [<img src="https://avatars1.githubusercontent.com/u/18545156?v=4" width="110px;"/><br /><sub>Lawrence</sub>](https://github.com/TheVakman)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=TheVakman "Tests") [🐛](https://github.com/snipe/snipe-it/issues?q=author%3ATheVakman "Bug reports") | [<img src="https://avatars1.githubusercontent.com/u/22473767?v=4" width="110px;"/><br /><sub>uknzaeinozpas</sub>](https://github.com/uknzaeinozpas)<br />[⚠️](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Tests") [💻](https://github.com/snipe/snipe-it/commits?author=uknzaeinozpas "Code") | [<img src="https://avatars3.githubusercontent.com/u/422752?v=4" width="110px;"/><br /><sub>Ryan</sub>](https://github.com/Gelob)<br />[📖](https://github.com/snipe/snipe-it/commits?author=Gelob "Documentation") |
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
|
||||
|
|
|
@ -72,6 +72,8 @@ class AssetsController extends Controller
|
|||
'updated_at',
|
||||
'purchase_date',
|
||||
'purchase_cost',
|
||||
'last_audit_date',
|
||||
'next_audit_date',
|
||||
'warranty_months',
|
||||
];
|
||||
|
||||
|
@ -675,7 +677,11 @@ class AssetsController extends Controller
|
|||
|
||||
|
||||
if ($asset) {
|
||||
// We don't want to log this as a normal update, so let's bypass that
|
||||
$asset->unsetEventDispatcher();
|
||||
$asset->next_audit_date = $request->input('next_audit_date');
|
||||
$asset->last_audit_date = date('Y-m-d h:i:s');
|
||||
|
||||
if ($asset->save()) {
|
||||
$log = $asset->logAudit(request('note'),request('location_id'));
|
||||
return response()->json(Helper::formatStandardApiResponse('success', [
|
||||
|
|
|
@ -68,11 +68,11 @@ class UsersController extends Controller
|
|||
}
|
||||
|
||||
if ($request->has('company_id')) {
|
||||
$users = $users->where('company_id', '=', $request->input('company_id'));
|
||||
$users = $users->where('users.company_id', '=', $request->input('company_id'));
|
||||
}
|
||||
|
||||
if ($request->has('location_id')) {
|
||||
$users = $users->where('location_id', '=', $request->input('location_id'));
|
||||
$users = $users->where('users.location_id', '=', $request->input('location_id'));
|
||||
}
|
||||
|
||||
if ($request->has('group_id')) {
|
||||
|
|
|
@ -402,13 +402,6 @@ class AssetsController extends Controller
|
|||
|
||||
$asset->delete();
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->item_id = $asset->id;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->logaction('deleted');
|
||||
|
||||
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
|
||||
}
|
||||
|
||||
|
@ -919,6 +912,14 @@ class AssetsController extends Controller
|
|||
if (isset($asset->id)) {
|
||||
// Restore the asset
|
||||
Asset::withTrashed()->where('id', $assetId)->restore();
|
||||
|
||||
$logaction = new Actionlog();
|
||||
$logaction->item_type = Asset::class;
|
||||
$logaction->item_id = $asset->id;
|
||||
$logaction->created_at = date("Y-m-d H:i:s");
|
||||
$logaction->user_id = Auth::user()->id;
|
||||
$logaction->logaction('restored');
|
||||
|
||||
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.restore.success'));
|
||||
}
|
||||
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||
|
@ -1255,6 +1256,7 @@ class AssetsController extends Controller
|
|||
return view('hardware/audit')->with('asset', $asset)->with('next_audit_date', $dt)->with('locations_list');
|
||||
}
|
||||
|
||||
|
||||
public function auditStore(Request $request, $id)
|
||||
{
|
||||
$this->authorize('audit', Asset::class);
|
||||
|
@ -1270,7 +1272,11 @@ class AssetsController extends Controller
|
|||
}
|
||||
|
||||
$asset = Asset::findOrFail($id);
|
||||
// We don't want to log this as a normal update, so let's bypass that
|
||||
$asset->unsetEventDispatcher();
|
||||
|
||||
$asset->next_audit_date = $request->input('next_audit_date');
|
||||
$asset->last_audit_date = date('Y-m-d h:i:s');
|
||||
|
||||
if ($asset->save()) {
|
||||
$asset->logAudit(request('note'), request('location_id'));
|
||||
|
|
|
@ -362,7 +362,14 @@ class LicensesController extends Controller
|
|||
// Redirect to the asset management page with error
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
$this->authorize('checkin', $licenseSeat);
|
||||
|
||||
if (is_null($license = License::find($licenseSeat->license_id))) {
|
||||
// Redirect to the asset management page with error
|
||||
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.not_found'));
|
||||
}
|
||||
|
||||
|
||||
$this->authorize('checkout', $license);
|
||||
return view('licenses/checkin', compact('licenseSeat'))->with('backto', $backTo);
|
||||
}
|
||||
|
||||
|
@ -386,8 +393,7 @@ class LicensesController extends Controller
|
|||
}
|
||||
|
||||
$license = License::find($licenseSeat->license_id);
|
||||
|
||||
$this->authorize('checkin', $licenseSeat);
|
||||
$this->authorize('checkout', $license);
|
||||
|
||||
if (!$license->reassignable) {
|
||||
// Not allowed to checkin
|
||||
|
|
|
@ -35,6 +35,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->authorize('index', Manufacturer::class);
|
||||
return view('manufacturers/index', compact('manufacturers'));
|
||||
}
|
||||
|
||||
|
@ -49,6 +50,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
$this->authorize('create', Manufacturer::class);
|
||||
return view('manufacturers/edit')->with('item', new Manufacturer);
|
||||
}
|
||||
|
||||
|
@ -65,6 +67,7 @@ class ManufacturersController extends Controller
|
|||
public function store(ImageUploadRequest $request)
|
||||
{
|
||||
|
||||
$this->authorize('edit', Manufacturer::class);
|
||||
$manufacturer = new Manufacturer;
|
||||
$manufacturer->name = $request->input('name');
|
||||
$manufacturer->user_id = Auth::user()->id;
|
||||
|
@ -104,6 +107,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function edit($id = null)
|
||||
{
|
||||
$this->authorize('edit', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($item = Manufacturer::find($id))) {
|
||||
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.does_not_exist'));
|
||||
|
@ -125,6 +129,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function update(ImageUploadRequest $request, $manufacturerId = null)
|
||||
{
|
||||
$this->authorize('edit', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturer page
|
||||
|
@ -186,6 +191,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function destroy($manufacturerId)
|
||||
{
|
||||
$this->authorize('delete', Manufacturer::class);
|
||||
// Check if the manufacturer exists
|
||||
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
|
||||
// Redirect to the manufacturers page
|
||||
|
@ -224,6 +230,7 @@ class ManufacturersController extends Controller
|
|||
*/
|
||||
public function show($manufacturerId = null)
|
||||
{
|
||||
$this->authorize('view', Manufacturer::class);
|
||||
$manufacturer = Manufacturer::find($manufacturerId);
|
||||
|
||||
if (isset($manufacturer->id)) {
|
||||
|
|
|
@ -535,6 +535,14 @@ class ReportsController extends Controller
|
|||
$header[] = trans('general.updated_at');
|
||||
}
|
||||
|
||||
if ($request->has('last_audit_date')) {
|
||||
$header[] = trans('general.last_audit');
|
||||
}
|
||||
|
||||
if ($request->has('next_audit_date')) {
|
||||
$header[] = trans('general.next_audit_date');
|
||||
}
|
||||
|
||||
if ($request->has('notes')) {
|
||||
$header[] = trans('general.notes');
|
||||
}
|
||||
|
@ -709,6 +717,14 @@ class ReportsController extends Controller
|
|||
$row[] = ($asset->updated_at) ? $asset->updated_at : '';
|
||||
}
|
||||
|
||||
if ($request->has('last_audit_date')) {
|
||||
$row[] = ($asset->last_audit_date) ? $asset->last_audit_date : '';
|
||||
}
|
||||
|
||||
if ($request->has('next_audit_date')) {
|
||||
$row[] = ($asset->next_audit_date) ? $asset->next_audit_date : '';
|
||||
}
|
||||
|
||||
if ($request->has('notes')) {
|
||||
$row[] = ($asset->notes) ? $asset->notes : '';
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ class AssetsTransformer
|
|||
'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,
|
||||
'created_at' => Helper::getFormattedDateObject($asset->created_at, 'datetime'),
|
||||
'updated_at' => Helper::getFormattedDateObject($asset->updated_at, 'datetime'),
|
||||
'last_audit_date' => Helper::getFormattedDateObject($asset->last_audit_date, 'datetime'),
|
||||
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date, 'date'),
|
||||
'deleted_at' => Helper::getFormattedDateObject($asset->deleted_at, 'datetime'),
|
||||
'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'),
|
||||
'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'),
|
||||
|
|
|
@ -49,7 +49,9 @@ class Asset extends Depreciable
|
|||
'deleted_at',
|
||||
'purchase_date',
|
||||
'last_checkout',
|
||||
'expected_checkin'
|
||||
'expected_checkin',
|
||||
'last_audit_date',
|
||||
'next_audit_date'
|
||||
];
|
||||
|
||||
|
||||
|
@ -68,6 +70,7 @@ class Asset extends Depreciable
|
|||
'status' => 'integer',
|
||||
'purchase_cost' => 'numeric|nullable',
|
||||
'next_audit_date' => 'date|nullable',
|
||||
'last_audit_date' => 'date|nullable',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
use App\Http\Traits\UniqueUndeletedTrait;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use DB;
|
||||
|
||||
class User extends SnipeModel implements AuthenticatableContract, CanResetPasswordContract
|
||||
{
|
||||
|
@ -441,7 +442,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
|
|||
|
||||
//Ugly, ugly code because Laravel sucks at self-joins
|
||||
->orWhere(function ($query) use ($search) {
|
||||
$query->whereRaw("users.manager_id IN (select id from users where first_name LIKE ? OR last_name LIKE ?)", ["%$search%", "%$search%"]);
|
||||
$query->whereRaw(DB::getTablePrefix()."users.manager_id IN (select id from ".DB::getTablePrefix()."users where first_name LIKE ? OR last_name LIKE ?)", ["%$search%", "%$search%"]);
|
||||
});
|
||||
|
||||
|
||||
|
|
13
app/Policies/ManufacturerPolicy.php
Normal file
13
app/Policies/ManufacturerPolicy.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\Policies\SnipePermissionsPolicy;
|
||||
|
||||
class ManufacturerPolicy extends SnipePermissionsPolicy
|
||||
{
|
||||
protected function columnName()
|
||||
{
|
||||
return 'manufacturers';
|
||||
}
|
||||
}
|
|
@ -5,9 +5,31 @@ use App\Models\Company;
|
|||
use App\Models\User;
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* SnipePermissionsPolicy provides methods for handling the granular permissions used throughout Snipe-IT.
|
||||
* Each "area" of a permission (which is usually a model, like Assets, Departments, etc), has a setting
|
||||
* in config/permissions.php like view/create/edit/delete (and sometimes some extra stuff like
|
||||
* checkout/checkin, etc.)
|
||||
*
|
||||
* A Policy should exist for each of these models, however if they only use the standard view/create/edit/delete,
|
||||
* the policy can be pretty simple, for example with just one method setting the column name:
|
||||
*
|
||||
* protected function columnName()
|
||||
* {
|
||||
* return 'manufacturers';
|
||||
* }
|
||||
*
|
||||
*/
|
||||
|
||||
abstract class SnipePermissionsPolicy
|
||||
{
|
||||
// This should return the key of the model in the users json permission string.
|
||||
/**
|
||||
* This should return the key of the model in the users json permission string.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
//
|
||||
abstract protected function columnName();
|
||||
|
||||
use HandlesAuthorization;
|
||||
|
|
|
@ -201,6 +201,20 @@ class AssetPresenter extends Presenter
|
|||
"visible" => false,
|
||||
"title" => trans('admin/hardware/form.expected_checkin'),
|
||||
"formatter" => "dateDisplayFormatter"
|
||||
], [
|
||||
"field" => "last_audit_date",
|
||||
"searchable" => false,
|
||||
"sortable" => true,
|
||||
"visible" => false,
|
||||
"title" => trans('general.last_audit'),
|
||||
"formatter" => "dateDisplayFormatter"
|
||||
], [
|
||||
"field" => "next_audit_date",
|
||||
"searchable" => false,
|
||||
"sortable" => true,
|
||||
"visible" => false,
|
||||
"title" => trans('general.next_audit_date'),
|
||||
"formatter" => "dateDisplayFormatter"
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ use App\Models\License;
|
|||
use App\Models\Location;
|
||||
use App\Models\Statuslabel;
|
||||
use App\Models\Supplier;
|
||||
use App\Models\Manufacturer;
|
||||
use App\Models\User;
|
||||
use App\Policies\AccessoryPolicy;
|
||||
use App\Policies\AssetModelPolicy;
|
||||
|
@ -28,6 +29,7 @@ use App\Policies\LocationPolicy;
|
|||
use App\Policies\StatuslabelPolicy;
|
||||
use App\Policies\SupplierPolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use App\Policies\ManufacturerPolicy;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
@ -38,6 +40,8 @@ class AuthServiceProvider extends ServiceProvider
|
|||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* See SnipePermissionsPolicy for additional information.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
|
@ -54,6 +58,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
Statuslabel::class => StatuslabelPolicy::class,
|
||||
Supplier::class => SupplierPolicy::class,
|
||||
User::class => UserPolicy::class,
|
||||
Manufacturer::class => ManufacturerPolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -126,6 +131,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
|| $user->can('view', \App\Models\Department::class)
|
||||
|| $user->can('view', \App\Models\Location::class)
|
||||
|| $user->can('view', \App\Models\Company::class)
|
||||
|| $user->can('view', \App\Models\Manufacturer::class)
|
||||
|| $user->can('view', \App\Models\Depreciation::class);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
return array (
|
||||
'app_version' => 'v4.1.8-pre',
|
||||
'full_app_version' => 'v4.1.8-pre - build 3034',
|
||||
'build_version' => '3034',
|
||||
'full_app_version' => 'v4.1.8-pre - build 3068-gceca76b',
|
||||
'build_version' => '3068',
|
||||
'prerelease_version' => '',
|
||||
'hash_version' => 'g4f3c932',
|
||||
'full_hash' => 'v4.1.7-37-g4f3c932',
|
||||
'hash_version' => 'gceca76b',
|
||||
'full_hash' => 'v4.1.7-34-gceca76b',
|
||||
'branch' => 'master',
|
||||
);
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
|
||||
class NormalizeAssetLastAuditDate extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->datetime('last_audit_date')->after('assigned_type')->nullable()->default(null);
|
||||
});
|
||||
|
||||
// Grab the latest info from the Actionlog table where the action is 'audit'
|
||||
$audits = Actionlog::selectRaw('MAX(created_at) AS created_at, item_id')->where('action_type', 'audit')->where('item_type', Asset::class)->groupBy('item_id')->orderBy('created_at', 'desc')->get();
|
||||
|
||||
if ($audits) {
|
||||
foreach ($audits as $audit) {
|
||||
$assets = Asset::where('id', $audit->item_id)->first();
|
||||
$assets->last_audit_date = $audit->created_at;
|
||||
$assets->unsetEventDispatcher();
|
||||
$assets->save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->dropColumn('last_audit_date');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -151,6 +151,7 @@
|
|||
'recent_activity' => 'Recent Activity',
|
||||
'remove_company' => 'Remove Company Association',
|
||||
'reports' => 'Reports',
|
||||
'restored' => 'restored',
|
||||
'requested' => 'Requested',
|
||||
'request_canceled' => 'Request Canceled',
|
||||
'save' => 'Save',
|
||||
|
|
|
@ -32,19 +32,22 @@
|
|||
{{-- Page content --}}
|
||||
@section('content')
|
||||
<div class="row">
|
||||
|
||||
@if ($asset->deleted_at!='')
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
<i class="fa fa-exclamation-circle faa-pulse animated"></i>
|
||||
<strong>WARNING: </strong>
|
||||
This asset has been deleted.
|
||||
You must <a href="{{ route('restore/hardware', $asset->id) }}">restore it</a> before you can assign it to someone.
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
|
||||
@if ($asset->deleted_at!='')
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-danger">
|
||||
<i class="fa fa-exclamation-circle faa-pulse animated"></i>
|
||||
<strong>WARNING: </strong>
|
||||
This asset has been deleted.
|
||||
You must <a href="{{ route('restore/hardware', $asset->id) }}">restore it</a> before you can assign it to someone.
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<!-- Custom Tabs -->
|
||||
<div class="nav-tabs-custom">
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
Snipe-IT Setup
|
||||
@show
|
||||
</title>
|
||||
|
||||
<link rel="stylesheet" href="{{ url(asset('js/plugins/select2/select2.min.css')) }}">
|
||||
<link rel="stylesheet" href="{{ url(mix('css/dist/all.css')) }}">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<script nonce="{{ csrf_token() }}">
|
||||
window.snipeit = {
|
||||
settings: {
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@can('checkout', $licensedto)
|
||||
@can('checkout', $license)
|
||||
@if (($licensedto->assigned_to) || ($licensedto->asset_id))
|
||||
@if ($license->reassignable)
|
||||
<a href="{{ route('licenses.checkin', $licensedto->id) }}" class="btn btn-sm bg-purple">
|
||||
|
|
|
@ -176,6 +176,18 @@
|
|||
{{ trans('general.updated_at') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('last_audit_date', '1', '1', ['class' => 'minimal']) }}
|
||||
{{ trans('general.last_audit') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('next_audit_date', '1', '1', ['class' => 'minimal']) }}
|
||||
{{ trans('general.next_audit_date') }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox col-md-12">
|
||||
<label>
|
||||
{{ Form::checkbox('notes', '1', '1', ['class' => 'minimal']) }}
|
||||
|
|
Loading…
Reference in a new issue