Skip to content

Commit

Permalink
fixed routes permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
HUET Benjamin committed Mar 8, 2017
1 parent e3ef0d6 commit 64f4c7d
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 24 deletions.
24 changes: 12 additions & 12 deletions src/Http/Controllers/OperationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function update(Request $request)
return $operation;
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function delete(Request $request)
Expand All @@ -154,11 +154,11 @@ public function delete(Request $request)
if ($operation != null) {
if (auth()->user()->has('calendar.deleteAll') || $operation->user->id == auth()->user()->id) {
Operation::destroy($operation->id);
return redirect()->back();
return redirect()->route('operation.index');
}
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function close(Request $request)
Expand All @@ -170,11 +170,11 @@ public function close(Request $request)
$operation->end_at = Carbon::now('UTC');
$operation->save();

return redirect()->back();
return redirect()->route('operation.index');
}
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function cancel(Request $request)
Expand All @@ -188,11 +188,11 @@ public function cancel(Request $request)
$operation->notify = $request->get('notify');
$operation->save();

return redirect()->back();
return redirect()->route('operation.index');
}
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function activate(Request $request)
Expand All @@ -206,11 +206,11 @@ public function activate(Request $request)
$operation->notify = $request->get('notify');
$operation->save();

return redirect()->back();
return redirect()->route('operation.index');
}
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function subscribe(Request $request)
Expand All @@ -230,11 +230,11 @@ public function subscribe(Request $request)
'comment' => $request->comment
]
);
return redirect()->back();
return redirect()->route('operation.index');
}
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

public function find($operation_id) {
Expand All @@ -243,7 +243,7 @@ public function find($operation_id) {
return response()->json($operation);
}

return redirect()->route('auth.unauthorized');
return redirect()->back('error', 'An error occurred while processing the request.');
}

}
5 changes: 4 additions & 1 deletion src/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
], function () {

Route::resource('operation', 'OperationController', [
'only' => ['index', 'store']
'only' => ['index', 'store'],
'names' => [
'index' => 'operation.index'
]
]);

Route::post('operation/subscribe', [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmActivate" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmActivate">
<div class="modal-dialog" role="document">
<div class="modal-content">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmCancel" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmCancel">
<div class="modal-dialog" role="document">
<div class="modal-content">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmClose" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmClose">
<div class="modal-dialog" role="document">
<div class="modal-content">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmDelete" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalConfirmDelete">
<div class="modal-dialog" role="document">
<div class="modal-content">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalCreateOperation" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalCreateOperation">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header modal-calendar modal-calendar-green">
Expand Down
10 changes: 6 additions & 4 deletions src/resources/views/operation/includes/modals/details.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@foreach($ops_all as $op)
<div class="modal fade @if($default_op == $op->id) default-op @endif" tabindex="-1" role="dialog" id="modalDetails-{{ $op->id }}" data-backdrop="static" data-keyboard="false">
<div class="modal fade @if($default_op == $op->id) default-op @endif" tabindex="-1" role="dialog" id="modalDetails-{{ $op->id }}">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">

Expand Down Expand Up @@ -113,9 +113,11 @@

<h3 style="display: inline;">{{ trans('calendar::seat.attendees') }}</h3>
<div class="pull-right">
<button type="button" class="btn btn-primary btn-xs" data-dismiss="modal" data-toggle="modal" data-op-id="{{ $op->id }}" data-target="#modalSubscribe">
<i class="fa fa-reply"></i>&nbsp;&nbsp; Subscribe
</button>
@if($op->status == 'incoming')
<button type="button" class="btn btn-primary btn-xs" data-dismiss="modal" data-toggle="modal" data-op-id="{{ $op->id }}" data-target="#modalSubscribe">
<i class="fa fa-reply"></i>&nbsp;&nbsp; Subscribe
</button>
@endif
@include('calendar::operation.includes.attendees')
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade modal-subscribe" tabindex="-1" role="dialog" id="modalSubscribe" data-backdrop="static" data-keyboard="false">
<div class="modal fade modal-subscribe" tabindex="-1" role="dialog" id="modalSubscribe">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="modal fade" tabindex="-1" role="dialog" id="modalUpdateOperation" data-backdrop="static" data-keyboard="false">
<div class="modal fade" tabindex="-1" role="dialog" id="modalUpdateOperation">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">

Expand Down

0 comments on commit 64f4c7d

Please sign in to comment.