Bugfix Image Serving, view update
This commit is contained in:
parent
ea9fdc6a82
commit
3cfda95c9e
2 changed files with 7 additions and 5 deletions
|
|
@ -4,20 +4,22 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ImageController extends Controller
|
||||
{
|
||||
public function getImage($category, $imageName) {
|
||||
Log::debug("File request for category: ".$category.", File: ".$imageName);
|
||||
$user=Auth::user();
|
||||
error_log("getImage");
|
||||
if ($user) {
|
||||
error_log("User exists");
|
||||
if ($user->role == "ADMIN" || $user->role == "GUEST") {
|
||||
error_log("User has proper role: ".$user->role);
|
||||
|
||||
if ($user->role == "ADMIN" || $user->role == "MEMBER") {
|
||||
Log::info("User has proper role: ".$user->role.", serving content");
|
||||
return response()->file(storage_path() . "/img_storage/".$category."/" . $imageName);
|
||||
}
|
||||
}
|
||||
|
||||
error_log("User is not authorized");
|
||||
Log::debug("User is not authorized");
|
||||
return response()->file(public_path()."/img/placeholder/icon_unknown.png");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue