Adds self-hosted GitLab OAuth sources so Coolify can connect to a self-managed GitLab instance, list private repositories, clone over an OAuth token, and deploy (the GitLab counterpart to GitHub Apps). Hardening: authenticated, one-time team-bound OAuth callback state; token redaction in deploy logs; custom host port/path kept in clone and ls-remote URLs; submodule OAuth auth; system-wide source selection. Covered by unit and feature tests. cosigned by OpenAI Codex at M1 Max
52 lines
931 B
PHP
52 lines
931 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\GitlabApp;
|
|
use App\Models\User;
|
|
|
|
class GitlabAppPolicy
|
|
{
|
|
public function viewAny(User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function view(User $user, GitlabApp $gitlabApp): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function create(User $user): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function update(User $user, GitlabApp $gitlabApp): bool
|
|
{
|
|
if ($gitlabApp->is_system_wide) {
|
|
return true;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function delete(User $user, GitlabApp $gitlabApp): bool
|
|
{
|
|
if ($gitlabApp->is_system_wide) {
|
|
return true;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public function restore(User $user, GitlabApp $gitlabApp): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function forceDelete(User $user, GitlabApp $gitlabApp): bool
|
|
{
|
|
return false;
|
|
}
|
|
}
|