Allow users to create private form templates (#210)
* Allow users to create private form templates * Improve back-end efficiency --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -18,7 +18,7 @@ class TemplatePolicy
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
return $user->admin || $user->template_editor;
|
||||
return $user !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,7 +30,7 @@ class TemplatePolicy
|
||||
*/
|
||||
public function update(User $user, Template $template)
|
||||
{
|
||||
return $user->admin || $user->template_editor;
|
||||
return $user->admin || $user->template_editor || $template->creator_id === $user->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,6 +42,6 @@ class TemplatePolicy
|
||||
*/
|
||||
public function delete(User $user, Template $template)
|
||||
{
|
||||
return $user->admin || $user->template_editor;
|
||||
return $user->admin || $user->template_editor || $template->creator_id === $user->id;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user