From: Vincent Vanwaelscappel Date: Mon, 2 Jun 2025 13:52:18 +0000 (+0200) Subject: #7567 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=35e61c0b1c01e1d063ccf10dd1e80ec8c9560661;p=cubist_cms-back.git #7567 --- diff --git a/src/app/Magic/Models/ExternalServer.php b/src/app/Magic/Models/ExternalServer.php index 844091a..0ae9ad5 100644 --- a/src/app/Magic/Models/ExternalServer.php +++ b/src/app/Magic/Models/ExternalServer.php @@ -2,6 +2,7 @@ namespace Cubist\Backpack\Magic\Models; +use Cubist\Backpack\Magic\Fields\Code; use Cubist\Backpack\Magic\Fields\Integer; use Cubist\Backpack\Magic\Fields\Password; use Cubist\Backpack\Magic\Fields\SelectFromArray; @@ -12,6 +13,7 @@ use Cubist\Net\Transfer\FTP; use Cubist\Net\Transfer\IServer; use Cubist\Net\Transfer\SFTP; use Cubist\Net\Transfer\S3; +use Cubist\Net\Transfer\GCS; class ExternalServer extends CubistMagicAbstractModel implements IServer { @@ -30,7 +32,6 @@ class ExternalServer extends CubistMagicAbstractModel implements IServer $this->addField('protocol', SelectFromArray::class, __('Protocole'), ['options' => $this->getProtocols(), 'default' => 'SFTP', 'column' => true, 'allows_null' => false]); $this->addField('ftp_mode', SelectFromArray::class, __('Mode FTP'), ['when' => ['protocol' => $this->getFTPProtocols()], 'options' => ['1' => __('Actif'), '0' => __('Passif')], 'default' => '1']); $this->addField('host', Text::class, __('Hôte'), ['default' => '', 'column' => true, 'column_label' => __('Serveur'), 'column_function_name' => 'getServerColumn', 'column_type' => 'model_function', 'when' => ['protocol' => $this->getHostProtocols()]]); - $this->addField('project_id', Text::class, __('Identifiant du projet'), ['default' => '', 'when' => ['protocol' => ['GCS']]]); $this->addField('port', Integer::class, __('Port'), ['hint' => __('Laisser vide pour utiliser le port par défaut'), 'default' => '', 'min' => 1, 'max' => 65536, 'when' => ['protocol' => $this->getPortProtocols()]]); $this->addField('username', Text::class, __('Nom d\'utilisateur'), ['when' => ['protocol' => $this->getUsernameProtocols()]]); $this->addField('password', Password::class, __('Mot de passe'), ['when' => ['protocol' => $this->getPasswordProtocols()]]); @@ -38,7 +39,7 @@ class ExternalServer extends CubistMagicAbstractModel implements IServer $this->addField('region', Text::class, __('Région'), ['default' => 'eu-west-3', 'when' => ['s3_provider' => 'AWS', 'protocol' => $this->getS3Protocols()]]); $this->addField('endpoint', URL::class, __('Endpoint'), ['when' => ['s3_provider' => 'Minio', 'protocol' => $this->getS3Protocols()]]); $this->addField('access_key', Text::class, __('Clé d\'accès'), ['when' => ['protocol' => $this->getS3Protocols()]]); - $this->addField('api_key', Text::class, __('Clé d\'API'), ['when' => ['protocol' => ['GCS']]]); + $this->addField('gcs_service_account_key', Code::class, 'Google cloud service account key', ['language' => 'javascript', 'when' => ['protocol' => ['GCS']]]); $this->addField('secret', Password::class, __('Secret'), ['when' => ['protocol' => $this->getS3Protocols()]]); $this->addField('bucket', Text::class, __('Bucket'), ['when' => ['protocol' => $this->getCloudStorageProtocols()]]); $this->addField('base_path', Text::class, __('Chemin de base'), ['default' => '/']); @@ -209,6 +210,11 @@ class ExternalServer extends CubistMagicAbstractModel implements IServer return $this->s3_provider; } + public function getGCSServiceAccountKey() + { + return $this->gcs_service_account_key; + } + public function getSettings() { return ['ftp_mode' => $this->ftp_mode];