Commit 8115a85a authored by S-Nathalia's avatar S-Nathalia
Browse files

controle de autenticação nas rotas

parent 5b487534
...@@ -564,9 +564,13 @@ class AdministradorController extends Controller ...@@ -564,9 +564,13 @@ class AdministradorController extends Controller
return redirect( route('admin.usuarios') )->with(['mensagem' => 'Usuário atualizado com sucesso']); return redirect( route('admin.usuarios') )->with(['mensagem' => 'Usuário atualizado com sucesso']);
} }
public function destroy($id) { public function verify_correlations($id){
$user = User::find($id); $user = User::find($id);
}
public function destroy($id) {
$user = User::find($id);
$adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first(); $adminResp = AdministradorResponsavel::where('user_id', '=', $id)->first();
$avaliador = Avaliador::where('user_id', '=', $id)->first(); $avaliador = Avaliador::where('user_id', '=', $id)->first();
$proponente = Proponente::where('user_id', '=', $id)->first(); $proponente = Proponente::where('user_id', '=', $id)->first();
......
...@@ -123,6 +123,11 @@ class ArquivoController extends Controller ...@@ -123,6 +123,11 @@ class ArquivoController extends Controller
$trabalho = Trabalho::where('id',$id)->first(); $trabalho = Trabalho::where('id',$id)->first();
$participantes = $trabalho->participantes; $participantes = $trabalho->participantes;
$arquivos = []; $arquivos = [];
if(Auth::user()->id != $trabalho->proponente->user->id){
return redirect()->back();
}
foreach ($participantes as $participante){ foreach ($participantes as $participante){
array_push($arquivos, $participante->planoTrabalho); array_push($arquivos, $participante->planoTrabalho);
} }
......
...@@ -96,6 +96,10 @@ class ParticipanteController extends Controller ...@@ -96,6 +96,10 @@ class ParticipanteController extends Controller
$trabalho = Trabalho::find($request->projeto_id); $trabalho = Trabalho::find($request->projeto_id);
$participantes = $trabalho->participantes; $participantes = $trabalho->participantes;
if(Auth::user()->id != $trabalho->proponente->user->id){
return redirect()->back();
}
return view('documentacaoComplementar.listar')->with(['participantes' => $participantes, 'trabalho' => $trabalho]); return view('documentacaoComplementar.listar')->with(['participantes' => $participantes, 'trabalho' => $trabalho]);
} }
......
...@@ -110,7 +110,8 @@ class ProponenteController extends Controller ...@@ -110,7 +110,8 @@ class ProponenteController extends Controller
} }
public function projetosEdital($id) { public function projetosEdital($id) {
$edital = Evento::find($id); $edital = Evento::find($id);
if(Auth::user()->proponentes != null){ if(Auth::user()->proponentes != null){
$projetos = Trabalho::where('evento_id', '=', $id)->where('proponente_id', Auth::user()->proponentes->id)->orderBy('titulo')->paginate(10); $projetos = Trabalho::where('evento_id', '=', $id)->where('proponente_id', Auth::user()->proponentes->id)->orderBy('titulo')->paginate(10);
$hoje = Carbon::today('America/Recife'); $hoje = Carbon::today('America/Recife');
......
...@@ -370,16 +370,6 @@ class TrabalhoController extends Controller ...@@ -370,16 +370,6 @@ class TrabalhoController extends Controller
public function show($id) public function show($id)
{ {
// $projeto = Auth::user()->proponentes->trabalhos()->where('id', $id)->first();
// if(Auth::user()->tipo == 'administrador'){
// $projeto = Trabalho::find($id);
// }
// if(!$projeto){
// // $projeto = Auth::user()->coordenadorComissao->trabalho()->where('id', $id)->first();
// return back()->withErrors(['Proposta não encontrada!']);
// }
$projeto = Trabalho::find($id); $projeto = Trabalho::find($id);
if(Auth::user()->id != $projeto->proponente->user->id){ if(Auth::user()->id != $projeto->proponente->user->id){
return redirect()->back(); return redirect()->back();
...@@ -1554,6 +1544,10 @@ class TrabalhoController extends Controller ...@@ -1554,6 +1544,10 @@ class TrabalhoController extends Controller
$projeto = Trabalho::find($request->projeto_id); $projeto = Trabalho::find($request->projeto_id);
$edital = Evento::find($projeto->evento_id); $edital = Evento::find($projeto->evento_id);
if(Auth::user()->id != $projeto->proponente->user->id){
return redirect()->back();
}
$participantes = $projeto->participantes; $participantes = $projeto->participantes;
$substituicoesProjeto = Substituicao::where('trabalho_id', $projeto->id)->orderBy('created_at', 'DESC')->get(); $substituicoesProjeto = Substituicao::where('trabalho_id', $projeto->id)->orderBy('created_at', 'DESC')->get();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment