From 6e38258ba89d1ed30183bc2c602d2f412900f205 Mon Sep 17 00:00:00 2001 From: Jeremy Snyder Date: Thu, 2 Mar 2023 13:52:00 -0500 Subject: [PATCH] Added defaults for user properties --- backend/Services/Auth/Adapters/Header.php | 8 +++++--- configuration.php | 7 +++++++ docker-compose.yml | 1 - private/.gitkeep | 0 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 private/.gitkeep diff --git a/backend/Services/Auth/Adapters/Header.php b/backend/Services/Auth/Adapters/Header.php index 2d55a42..98c0106 100644 --- a/backend/Services/Auth/Adapters/Header.php +++ b/backend/Services/Auth/Adapters/Header.php @@ -15,6 +15,7 @@ class Header extends JsonFile protected $username_header_key; protected $fullname_header_key; protected $non_header_users; + protected $user_defaults; public function init(array $config = []) { @@ -22,6 +23,7 @@ public function init(array $config = []) $this->username_header_key = strtolower($config["username_header_key"]); $this->fullname_header_key = strtolower($config["fullname_header_key"]); $this->ignore_users = $config["ignore_users"] ?? []; + $this->user_defaults = $config["user_defaults"] ?? []; } private function useNormalAuth($username): bool @@ -52,9 +54,9 @@ private function headerUser(): array return [ "username" => $username_header, "name" => $fullname_header, - "role" => "user", - "homedir" => "/", - "permissions" => "read", + "role" => $this->user_defaults["role"] ?? "user", + "homedir" => $this->user_defaults["homedir"] ?? "/share", + "permissions" => $this->user_defaults["permissions"] ?? "read", ]; } diff --git a/configuration.php b/configuration.php index 3450087..5716618 100644 --- a/configuration.php +++ b/configuration.php @@ -109,6 +109,13 @@ function () { 'username_header_key' => 'FILEGATOR-USERNAME', 'fullname_header_key' => 'FILEGATOR-FULLNAME', 'ignore_users' => ['admin'], + 'user_defaults' => [ + 'role' => 'user', + 'homedir' => '/share', + // Pipe-delimited list of the following items: + // read|write|upload|download|batchdownload|zip + 'permissions' => 'read', + ] ], ], 'Filegator\Services\Router\Router' => [ diff --git a/docker-compose.yml b/docker-compose.yml index e03b044..e0d5bd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ version: '2.2' services: - filegator: image: filegator/filegator:latest ports: diff --git a/private/.gitkeep b/private/.gitkeep new file mode 100644 index 0000000..e69de29