Initial Ladill Hosting app with Gitea deploy pipeline.
Deploy Ladill Hosting / deploy (push) Failing after 17s
Deploy Ladill Hosting / deploy (push) Failing after 17s
Shared web hosting extracted from the platform monolith, with CI deploy to /var/www/ladill-hosting matching Bird/Domains/Email. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class HostingAccountMember extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public const ROLE_DEVELOPER = 'developer';
|
||||
|
||||
private const SSH_KEY_PATTERN = '/^(ssh-(ed25519|rsa)|ecdsa-sha2-nistp(256|384|521)|sk-ssh-ed25519@openssh\\.com|sk-ecdsa-sha2-nistp256@openssh\\.com) [A-Za-z0-9+\\/]+={0,3}(?: .+)?$/';
|
||||
|
||||
protected $fillable = [
|
||||
'hosting_account_id',
|
||||
'user_id',
|
||||
'invited_by_user_id',
|
||||
'role',
|
||||
'invited_at',
|
||||
'ssh_public_key',
|
||||
'ssh_key_installed_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'invited_at' => 'datetime',
|
||||
'ssh_key_installed_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function hostingAccount(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(HostingAccount::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function invitedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'invited_by_user_id');
|
||||
}
|
||||
|
||||
public function sshKeyMarker(): string
|
||||
{
|
||||
return 'ladill-team-member-'.$this->id;
|
||||
}
|
||||
|
||||
public function hasSshAccessKey(): bool
|
||||
{
|
||||
return filled($this->ssh_public_key);
|
||||
}
|
||||
|
||||
public static function normalizeSshPublicKey(string $value): string
|
||||
{
|
||||
return trim(preg_replace('/\s+/', ' ', trim($value)) ?? '');
|
||||
}
|
||||
|
||||
public static function looksLikeSshPublicKey(?string $value): bool
|
||||
{
|
||||
if (! is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$normalized = static::normalizeSshPublicKey($value);
|
||||
|
||||
return $normalized !== '' && preg_match(self::SSH_KEY_PATTERN, $normalized) === 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user