Additional doc blocks, added private_uploads path

This commit is contained in:
snipe 2016-03-25 15:50:08 -07:00
parent 27543d16f6
commit bddb7fca23
25 changed files with 229 additions and 45 deletions

View file

@ -5,7 +5,7 @@
* *
* PHP version 5.5.9 * PHP version 5.5.9
* @package Snipe-IT * @package Snipe-IT
* @version v3.0 * @version v1.0
*/ */
namespace App\Http\Controllers; namespace App\Http\Controllers;

View file

@ -1,26 +1,34 @@
<?php <?php
/**
* This controller handles all actions related to Asset Maintenance for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v2.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\AssetMaintenance; use App\Models\AssetMaintenance;
use Carbon\Carbon; use Carbon\Carbon;
use App\Models\Company; use App\Models\Company;
use DB; use DB;
use Input; use Input;
use Lang; use Lang;
use Log; use Log;
use Mail; use Mail;
use Redirect; use Redirect;
use Response; use Response;
use Slack; use Slack;
use Str; use Str;
use App\Models\Supplier; use App\Models\Supplier;
use TCPDF; use TCPDF;
use Validator; use Validator;
use View; use View;
use App\Models\Setting; use App\Models\Setting;
use App\Models\Asset; use App\Models\Asset;
use App\Helpers\Helper; use App\Helpers\Helper;
class AssetMaintenancesController extends Controller class AssetMaintenancesController extends Controller
{ {
@ -30,13 +38,13 @@ class AssetMaintenancesController extends Controller
->with('error', Lang::get('general.insufficient_permissions')); ->with('error', Lang::get('general.insufficient_permissions'));
} }
/** /**
* getIndex * getIndex
* *
* @return mixed * @return mixed
* @author Vincent Sposato <vincent.sposato@gmail.com> * @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0 * @version v1.0
*/ */
public function getIndex() public function getIndex()
{ {

View file

@ -734,7 +734,7 @@ class AssetsController extends Controller
public function getImportUpload() public function getImportUpload()
{ {
$path = storage_path().'/app/private_uploads/imports/assets'; $path = config('app.private_uploads').'/imports/assets';
$files = array(); $files = array();
if (!Company::isCurrentUserAuthorized()) { if (!Company::isCurrentUserAuthorized()) {
@ -780,7 +780,7 @@ class AssetsController extends Controller
} elseif (!config('app.lock_passwords')) { } elseif (!config('app.lock_passwords')) {
$files = Input::file('files'); $files = Input::file('files');
$path = storage_path().'/app/private_uploads/imports/assets'; $path = config('app.private_uploads').'/imports/assets';
$results = array(); $results = array();
foreach ($files as $file) { foreach ($files as $file) {
@ -838,9 +838,9 @@ class AssetsController extends Controller
} }
$output = new BufferedOutput; $output = new BufferedOutput;
Artisan::call('asset-import:csv', ['filename'=> storage_path().'/app/private_uploads/imports/assets/'.$filename, '--email_format'=>'firstname.lastname', '--username_format'=>'firstname.lastname'], $output); Artisan::call('asset-import:csv', ['filename'=> config('app.private_uploads').'/imports/assets/'.$filename, '--email_format'=>'firstname.lastname', '--username_format'=>'firstname.lastname'], $output);
$display_output = $output->fetch(); $display_output = $output->fetch();
$file = storage_path().'/app/private_uploads/imports/assets/'.str_replace('.csv', '', $filename).'-output-'.date("Y-m-d-his").'.txt'; $file = config('app.private_uploads').'/imports/assets/'.str_replace('.csv', '', $filename).'-output-'.date("Y-m-d-his").'.txt';
file_put_contents($file, $display_output); file_put_contents($file, $display_output);
@ -948,7 +948,7 @@ class AssetsController extends Controller
} }
// the asset is valid // the asset is valid
$destinationPath = storage_path().'/private_uploads/app/imports/assets'; $destinationPath = config('app.private_uploads').'/imports/assets';
@ -1001,7 +1001,7 @@ class AssetsController extends Controller
public function getDeleteFile($assetId = null, $fileId = null) public function getDeleteFile($assetId = null, $fileId = null)
{ {
$asset = Asset::find($assetId); $asset = Asset::find($assetId);
$destinationPath = storage_path().'private_uploads/app/imports/assets'; $destinationPath = config('app.private_uploads').'/imports/assets';
// the asset is valid // the asset is valid
if (isset($asset->id)) { if (isset($asset->id)) {

View file

@ -1,4 +1,13 @@
<?php namespace App\Http\Controllers; <?php
/**
* This controller handles all actions related to Asset Categories for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Models\Category as Category; use App\Models\Category as Category;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions for users changing their email address in their profile
* for the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input; use Input;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to users changing
* their passwords in the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input; use Input;

View file

@ -1,4 +1,13 @@
<?php namespace App\Http\Controllers; <?php
/**
* This controller handles all actions related to Company support for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v2.0
*/
namespace App\Http\Controllers;
use App\Models\Company; use App\Models\Company;
use Input; use Input;

View file

@ -1,4 +1,13 @@
<?php namespace App\Http\Controllers; <?php
/**
* This controller handles all actions related to Asset Models for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Models\Actionlog; use App\Models\Actionlog;

View file

@ -1,4 +1,13 @@
<?php namespace App\Http\Controllers; <?php
/**
* This controller handles all actions related to Consumables for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.8
*/
namespace App\Http\Controllers;
use App\Helpers\Helper; use App\Helpers\Helper;
use App\Models\Actionlog; use App\Models\Actionlog;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to Custom Asset Fields for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v2.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use View; use View;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to the admin dashboard
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Controllers\AdminController; use App\Http\Controllers\AdminController;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to Asset Depreciation
* for the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input; use Input;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to User Groups for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Config; use Config;

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles all actions related to Licenses and
* License Seats for the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Assets; use Assets;
@ -790,7 +799,7 @@ class LicensesController extends Controller
$license = License::find($licenseId); $license = License::find($licenseId);
// the license is valid // the license is valid
$destinationPath = storage_path().'/app/private_uploads'; $destinationPath = config('app.private_uploads').'/licenses';
if (isset($license->id)) { if (isset($license->id)) {
@ -866,7 +875,7 @@ class LicensesController extends Controller
public function getDeleteFile($licenseId = null, $fileId = null) public function getDeleteFile($licenseId = null, $fileId = null)
{ {
$license = License::find($licenseId); $license = License::find($licenseId);
$destinationPath = storage_path().'/app/private_uploads'; $destinationPath = config('app.private_uploads').'/licenses';
// the license is valid // the license is valid
if (isset($license->id)) { if (isset($license->id)) {

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles all actions related to Locations for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input; use Input;

View file

@ -1,4 +1,12 @@
<?php <?php
/**
* This controller handles all actions related to Manufacturers for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Company; use App\Models\Company;

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles user profile editing
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Image; use Image;

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles all reporting actions for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Accessory; use App\Models\Accessory;

View file

@ -421,7 +421,9 @@ class SettingsController extends Controller
*/ */
public function getBackups() public function getBackups()
{ {
$path = storage_path().'/app/'.config('laravel-backup.destination.path');
$path = config('app.private_uploads').'/backups';
$files = array(); $files = array();
if ($handle = opendir($path)) { if ($handle = opendir($path)) {
@ -479,7 +481,7 @@ class SettingsController extends Controller
public function downloadFile($filename = null) public function downloadFile($filename = null)
{ {
if (!config('app.lock_passwords')) { if (!config('app.lock_passwords')) {
$path = storage_path().'/app/'.config('laravel-backup.destination.path'); $path = config('app.private_uploads').'/backups';
$file = $path.'/'.$filename; $file = $path.'/'.$filename;
if (file_exists($file)) { if (file_exists($file)) {
return Response::download($file); return Response::download($file);

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles all actions related to Status Labels for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Input; use Input;

View file

@ -1,4 +1,13 @@
<?php <?php
/**
* This controller handles all actions related to Suppliers for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use Image; use Image;

View file

@ -938,7 +938,7 @@ class UsersController extends Controller
$user = User::find($userId); $user = User::find($userId);
$destinationPath = storage_path() . '/app/private_uploads/users'; $destinationPath = config('app.private_uploads') . '/users';
if (isset($user->id)) { if (isset($user->id)) {
@ -986,7 +986,7 @@ class UsersController extends Controller
public function getDeleteFile($userId = null, $fileId = null) public function getDeleteFile($userId = null, $fileId = null)
{ {
$user = User::find($userId); $user = User::find($userId);
$destinationPath = app_path() . '/private_uploads'; $destinationPath = config('app.private_uploads').'/users';
// the license is valid // the license is valid
if (isset($user->id)) { if (isset($user->id)) {

View file

@ -1,4 +1,14 @@
<?php <?php
/**
* This controller handles all actions that allow a logged in user
* to view the assets assigned to them (and request an asset) for
* the Snipe-IT Asset Management application.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v1.0
*/
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Accessory; use App\Models\Accessory;

View file

@ -111,13 +111,29 @@ return [
'log' => env('APP_LOG', 'single'), 'log' => env('APP_LOG', 'single'),
/*
|--------------------------------------------------------------------------
| Default Storage path for private uploads
|--------------------------------------------------------------------------
| This is the path for any uploaded files that have to be run through the
| auth system to ensure they are not visible to the public. These should be
| stored somewhere outside of the web root so that an unautenticated user
| cannot access them.
|
| For example: license keys, contracts, etc.
|
*/
'private_uploads' => storage_path().'/private_uploads',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Demo Mode Lockdown | Demo Mode Lockdown
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Normal users will never need to edit this. This option lets you run a | Normal users will never need to edit this. This option lets you run a
| version of Snipe-IT with limited functionality to prevent demo abuse. | version of Snipe-IT with limited functionality to prevent demo abuse.
| |
*/ */

View file

@ -0,0 +1,2 @@
*
!.gitignore