Commit e4e62a67 authored by ZeMKI's avatar ZeMKI

Policies bugfix

parent bd160264
......@@ -34,7 +34,7 @@ class InterviewPolicy
*/
public function view(User $user, Interview $interview)
{
if (! $user->can('read-studies', Study::where('id', '=', $interview->study_id)->first()->name)) {
if (! $user->can('read-studies', Study::where('id', '=', $interview->study_id)->first()->id)) {
abort(403, 'You are not allowed to read this study');
}
......@@ -102,7 +102,7 @@ class InterviewPolicy
}
public function exportall(User $user, $study){
if ( $user->can('read-studies', Study::where('id', '=', $study)->first()->name)) {
if ( $user->can('read-studies', Study::where('id', '=', $study)->first()->id)) {
abort(403, 'You are not allowed to read this study');
}
......
......@@ -34,7 +34,7 @@ class SortingPolicy
*/
public function view(User $user, Interview $interview)
{
if (! $user->can('read-studies', Study::where('id', '=', $interview->study_id)->first()->name)) {
if (! $user->can('read-studies', Study::where('id', '=', $interview->study_id)->first()->id)) {
abort(403, 'You are not allowed to read this study');
}
......
......@@ -53,7 +53,7 @@ class StudyPolicy
*/
public function update(User $user, Study $study)
{
if (! $user->can('update-studies', $study->name)) {
if (! $user->can('update-studies', $study->id)) {
abort(403, "you can't edit this study");
}
......
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