mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fb651ab5ce | ||
|
c2625a7352 | ||
|
b72a2ddb1c | ||
|
0e8e6ef56f | ||
|
39fa25aee7 | ||
|
945c2e75c0 |
@ -1,8 +1,8 @@
|
|||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common curl zip unzip git gcc openssl
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common curl zip unzip git gcc openssl ufw
|
||||||
git config --global user.email "__email__"
|
git config --global user.email "__email__"
|
||||||
git config --global user.name "__name__"
|
git config --global user.name "__name__"
|
||||||
|
|
||||||
# Install Node.js
|
# Install Node.js
|
||||||
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -;
|
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
sudo DEBIAN_FRONTEND=noninteractive apt-get update
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
|
sudo DEBIAN_FRONTEND=noninteractive apt-get install nodejs -y
|
||||||
|
@ -117,6 +117,7 @@ public function deleteUser(string $username, string $host): void
|
|||||||
public function link(string $username, string $host, array $databases): void
|
public function link(string $username, string $host, array $databases): void
|
||||||
{
|
{
|
||||||
$ssh = $this->service->server->ssh();
|
$ssh = $this->service->server->ssh();
|
||||||
|
$version = $this->service->version;
|
||||||
|
|
||||||
foreach ($databases as $database) {
|
foreach ($databases as $database) {
|
||||||
$ssh->exec(
|
$ssh->exec(
|
||||||
@ -124,6 +125,7 @@ public function link(string $username, string $host, array $databases): void
|
|||||||
'username' => $username,
|
'username' => $username,
|
||||||
'host' => $host,
|
'host' => $host,
|
||||||
'database' => $database,
|
'database' => $database,
|
||||||
|
'version' => $version,
|
||||||
]),
|
]),
|
||||||
'link-user-to-database'
|
'link-user-to-database'
|
||||||
);
|
);
|
||||||
@ -132,10 +134,13 @@ public function link(string $username, string $host, array $databases): void
|
|||||||
|
|
||||||
public function unlink(string $username, string $host): void
|
public function unlink(string $username, string $host): void
|
||||||
{
|
{
|
||||||
|
$version = $this->service->version;
|
||||||
|
|
||||||
$this->service->server->ssh()->exec(
|
$this->service->server->ssh()->exec(
|
||||||
$this->getScript($this->getScriptsDir().'/unlink.sh', [
|
$this->getScript($this->getScriptsDir().'/unlink.sh', [
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
'host' => $host,
|
'host' => $host,
|
||||||
|
'version' => $version,
|
||||||
]),
|
]),
|
||||||
'unlink-user-from-databases'
|
'unlink-user-from-databases'
|
||||||
);
|
);
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
if ! sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE __database__ TO __username__;"; then
|
USER_TO_LINK='__username__'
|
||||||
|
DB_NAME='__database__'
|
||||||
|
DB_VERSION='__version__'
|
||||||
|
|
||||||
|
if ! sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"$DB_NAME\" TO $USER_TO_LINK;"; then
|
||||||
echo 'VITO_SSH_ERROR' && exit 1
|
echo 'VITO_SSH_ERROR' && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Linking to __database__ finished"
|
# Check if PostgreSQL version is 15 or greater
|
||||||
|
if [ "$DB_VERSION" -ge 15 ]; then
|
||||||
|
if ! sudo -u postgres psql -d "$DB_NAME" -c "GRANT USAGE, CREATE ON SCHEMA public TO $USER_TO_LINK;"; then
|
||||||
|
echo 'VITO_SSH_ERROR' && exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Linking to $DB_NAME finished"
|
||||||
|
@ -1,10 +1,16 @@
|
|||||||
USER_TO_REVOKE='__username__'
|
USER_TO_REVOKE='__username__'
|
||||||
|
DB_VERSION='__version__'
|
||||||
|
|
||||||
DATABASES=$(sudo -u postgres psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;")
|
DATABASES=$(sudo -u postgres psql -t -c "SELECT datname FROM pg_database WHERE datistemplate = false;")
|
||||||
|
|
||||||
for DB in $DATABASES; do
|
for DB in $DATABASES; do
|
||||||
echo "Revoking privileges in database: $DB"
|
echo "Revoking privileges in database: $DB"
|
||||||
sudo -u postgres psql -d "$DB" -c "REVOKE ALL PRIVILEGES ON DATABASE \"$DB\" FROM $USER_TO_REVOKE;"
|
sudo -u postgres psql -d "$DB" -c "REVOKE ALL PRIVILEGES ON DATABASE \"$DB\" FROM $USER_TO_REVOKE;"
|
||||||
|
|
||||||
|
# Check if PostgreSQL version is 15 or greater
|
||||||
|
if [ "$DB_VERSION" -ge 15 ]; then
|
||||||
|
sudo -u postgres psql -d "$DB" -c "REVOKE USAGE, CREATE ON SCHEMA public FROM $USER_TO_REVOKE;"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Privileges revoked from $USER_TO_REVOKE"
|
echo "Privileges revoked from $USER_TO_REVOKE"
|
||||||
|
727
composer.lock
generated
727
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ class="{{ $width }} {{ $alignmentClasses }} absolute z-50 mt-2 rounded-md"
|
|||||||
style="display: none"
|
style="display: none"
|
||||||
@if ($closeOnClick) @click="open = false" @endif
|
@if ($closeOnClick) @click="open = false" @endif
|
||||||
>
|
>
|
||||||
<div class="{{ $contentClasses }} rounded-md">
|
<div class="{{ $contentClasses }} max-h-80 overflow-y-auto rounded-md">
|
||||||
{{ $content }}
|
{{ $content }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user