get()->all()); foreach ($all_rules as $rule) { if ($rule->path == "*") { if (\Auth::check()) { if (\Auth::user()->checkACLRules($rule) > 0) { if (\Storage::exists($path)) { return \Storage::download($path); } else { abort(404); } } } } } $path_array = explode('/',$path); $checkedPath = $path_array[0]; unset($path_array[0]); $path_array = array_values($path_array); while ($checkedPath != $path) { $rules = $all_rules->where('path','=',$checkedPath.'/*'); if ($rules->isNotEmpty()) { $access_level = 0; foreach ($rules as $r) { if (\Auth::check()) { $temp_access_level = \Auth::user()->checkACLRules($r); if ($temp_access_level > $access_level) { $access_level = $temp_access_level; } } else { if ($r->user_id == '*') { if ($r->access > $access_level) { $access_level = $r->access; } } } if ($access_level > 0) { if (\Storage::exists($path)) { return \Storage::download($path); } else { abort(404); } } } } $checkedPath = $checkedPath.'/'.$path_array[0]; unset($path_array[0]); $path_array = array_values($path_array); } abort(403); } /** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(Request $request, $id) { // } /** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // } public function guide() { return redirect('/admin/files?leftPath=Prive/Staff/Guide'); } public function instruction() { return redirect('/admin/files?leftPath=Prive/Staff/Instruction'); } public function cadet() { return redirect('/admin/files?leftPath=Prive/Cadet'); } public function staff() { return redirect('/admin/files?leftPath=Prive/Staff'); } public function etamas() { return redirect('/admin/files?leftPath=Prive/ETAMAS'); } public function officier() { return redirect('/admin/files?leftPath=Prive/Officier'); } public function publique() { return redirect('/admin/files?leftPath=Publique'); } public function show_nominativeList() { return view('admin.files.list.index'); } public function download_nominativeList() { if (\Storage::exists('/Systeme/Fichier/ListeNominative.pdf')) { return \Storage::download('/Systeme/Fichier/ListeNominative.pdf'); } return view('admin.files.list.index'); } public function edit_nominativeList() { return view('admin.files.list.edit'); } public function update_nominativeList() { \Storage::putFileAs('Systeme/Fichier',\request()->file('nominativeList'),'ListeNominative.pdf'); clog('edit','success','a modifié la liste nominative'); return redirect('/admin/nominativelist')->with('success','Modification sauvegarder avec succès !'); } }