Disallow uploads if app is locked

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-11-03 13:52:23 -07:00
parent 7cb1ca8754
commit 3c7d63c060
3 changed files with 19 additions and 1 deletions

View file

@ -27,10 +27,16 @@ class AccessoriesFilesController extends Controller
*/
public function store(AssetFileRequest $request, $accessoryId = null)
{
if (config('app.lock_passwords')) {
return redirect()->route('accessories.show', ['accessory'=>$accessoryId])->with('error', trans('general.feature_disabled'));
}
$accessory = Accessory::find($accessoryId);
if (isset($accessory->id)) {
$this->authorize('update', $accessory);
$this->authorize('accessories.files', $accessory);
if ($request->hasFile('file')) {
if (! Storage::exists('private_uploads/accessories')) {
@ -129,9 +135,12 @@ class AccessoriesFilesController extends Controller
*/
public function show($accessoryId = null, $fileId = null, $download = true)
{
\Log::debug('Private filesystem is: '.config('filesystems.default'));
$accessory = Accessory::find($accessoryId);
// the accessory is valid
if (isset($accessory->id)) {
$this->authorize('view', $accessory);

View file

@ -27,6 +27,11 @@ class ComponentsFilesController extends Controller
*/
public function store(AssetFileRequest $request, $componentId = null)
{
if (config('app.lock_passwords')) {
return redirect()->route('components.show', ['component'=>$componentId])->with('error', trans('general.feature_disabled'));
}
$component = Component::find($componentId);
if (isset($component->id)) {

View file

@ -27,6 +27,10 @@ class ConsumablesFilesController extends Controller
*/
public function store(AssetFileRequest $request, $consumableId = null)
{
if (config('app.lock_passwords')) {
return redirect()->route('consumables.show', ['consumable'=>$consumableId])->with('error', trans('general.feature_disabled'));
}
$consumable = Consumable::find($consumableId);
if (isset($consumable->id)) {