feat: token permissions

feat: handle sensitive data
feat: handle read-only data
This commit is contained in:
Andras Bacsai
2024-07-02 12:15:58 +02:00
parent 1249b1ece9
commit c39d6dd407
28 changed files with 328 additions and 201 deletions

View File

@@ -195,7 +195,7 @@ class StandaloneClickhouse extends BaseModel
protected function internalDbUrl(): Attribute
{
return new Attribute(
get: fn () => "clickhouse://{$this->clickhouse_user}:{$this->clickhouse_password}@{$this->uuid}:9000/{$this->clickhouse_db}",
get: fn () => "clickhouse://{$this->clickhouse_admin_user}:{$this->clickhouse_admin_password}@{$this->uuid}:9000/{$this->clickhouse_db}",
);
}
@@ -204,7 +204,7 @@ class StandaloneClickhouse extends BaseModel
return new Attribute(
get: function () {
if ($this->is_public && $this->public_port) {
return "clickhouse://{$this->clickhouse_user}:{$this->clickhouse_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->clickhouse_db}";
return "clickhouse://{$this->clickhouse_admin_user}:{$this->clickhouse_admin_password}@{$this->destination->server->getIp}:{$this->public_port}/{$this->clickhouse_db}";
}
return null;
@@ -212,15 +212,6 @@ class StandaloneClickhouse extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -212,15 +212,6 @@ class StandaloneDragonfly extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -212,15 +212,6 @@ class StandaloneKeydb extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -212,15 +212,6 @@ class StandaloneMariadb extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -232,15 +232,6 @@ class StandaloneMongodb extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -213,15 +213,6 @@ class StandaloneMysql extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -213,15 +213,6 @@ class StandalonePostgresql extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);

View File

@@ -208,15 +208,6 @@ class StandaloneRedis extends BaseModel
);
}
public function get_db_url(bool $useInternal = false)
{
if ($this->is_public && ! $useInternal) {
return $this->externalDbUrl;
} else {
return $this->internalDbUrl;
}
}
public function environment()
{
return $this->belongsTo(Environment::class);