Files
opnform-host-nginx/app/Policies/TemplatePolicy.php
Chirag Chhatrala 8e47b49e9a Improve Templates (#183)
* Improve Templates

* Fix test case

* Update AI GenerateTemplate

* update openai client and GPT completer

* composer.lock

* Update types and list json with script

* Template changes

* fix on draft template

* Finish opnform templates

---------

Co-authored-by: Forms Dev <chirag+new@notionforms.io>
Co-authored-by: Julien Nahum <julien@nahum.net>
2023-09-08 13:00:28 +02:00

48 lines
1.1 KiB
PHP

<?php
namespace App\Policies;
use App\Models\Template;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class TemplatePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
return $user->admin || $user->template_editor;
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Template $template
* @return mixed
*/
public function update(User $user, Template $template)
{
return $user->admin || $user->template_editor;
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Template $template
* @return mixed
*/
public function delete(User $user, Template $template)
{
return $user->admin || $user->template_editor;
}
}