mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-14 08:42:38 -04:00
Socialite's GitLab provider fetches the user from /api/v3/user, which GitLab removed in 11.0 (410 Gone). Add App\Auth\GitlabProvider that reads /api/v4/user with a bearer token and register it in the socialite helper, for both gitlab.com and self-hosted base URLs. Environment variable copyValue now checks the 'update' policy on the variable instead of the member role of the current team, so members can no longer copy values after switching to a team they own. Remove the redundant member check from ShowHardcoded. Add tests for the GitLab v4 user lookup and the team-switch copy case.
63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Project\Shared\EnvironmentVariable;
|
|
|
|
use App\Models\EnvironmentVariable;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Component;
|
|
|
|
class ShowHardcoded extends Component
|
|
{
|
|
public bool $showEnvironmentType = true;
|
|
|
|
public array $env;
|
|
|
|
public string $key;
|
|
|
|
#[Locked]
|
|
public ?string $value = null;
|
|
|
|
public ?string $comment = null;
|
|
|
|
public ?string $serviceName = null;
|
|
|
|
#[Locked]
|
|
public bool $isPreview = false;
|
|
|
|
#[Locked]
|
|
public ?string $resourceableType = null;
|
|
|
|
#[Locked]
|
|
public ?int $resourceableId = null;
|
|
|
|
public function mount()
|
|
{
|
|
$this->key = $this->env['key'];
|
|
$this->value = $this->env['value'] ?? null;
|
|
$this->comment = $this->env['comment'] ?? null;
|
|
$this->serviceName = $this->env['service_name'] ?? null;
|
|
}
|
|
|
|
public function copyValue(): ?string
|
|
{
|
|
$environmentVariable = EnvironmentVariable::make([
|
|
'value' => $this->value,
|
|
'is_preview' => $this->isPreview,
|
|
'resourceable_type' => $this->resourceableType,
|
|
'resourceable_id' => $this->resourceableId,
|
|
]);
|
|
$resource = $environmentVariable->resourceable;
|
|
|
|
if (! $resource || auth()->user()->cannot('update', $resource)) {
|
|
return null;
|
|
}
|
|
|
|
return $environmentVariable->resolveReferencedValue();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.project.shared.environment-variable.show-hardcoded');
|
|
}
|
|
}
|