- Added new automation-related routes and controllers for managing automations. - Introduced automation nodes in the UI with distinct styles and interactions. - Updated sidebar to include navigation for automations. - Enhanced post creation logic to support automation metadata. - Refactored content type and platform enums into types for better type safety. - Added localization for automation-related terms in English, Spanish, and Portuguese. - Improved error handling in various components to accommodate new features.
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Automation;
|
|
use App\Models\User;
|
|
|
|
class AutomationPolicy
|
|
{
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return $user->currentWorkspace !== null;
|
|
}
|
|
|
|
public function view(User $user, Automation $automation): bool
|
|
{
|
|
return $automation->workspace_id === $user->current_workspace_id;
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
return $user->currentWorkspace !== null;
|
|
}
|
|
|
|
public function update(User $user, Automation $automation): bool
|
|
{
|
|
return $automation->workspace_id === $user->current_workspace_id;
|
|
}
|
|
|
|
public function delete(User $user, Automation $automation): bool
|
|
{
|
|
return $automation->workspace_id === $user->current_workspace_id;
|
|
}
|
|
|
|
public function activate(User $user, Automation $automation): bool
|
|
{
|
|
return $this->update($user, $automation);
|
|
}
|
|
|
|
public function pause(User $user, Automation $automation): bool
|
|
{
|
|
return $this->update($user, $automation);
|
|
}
|
|
}
|