Skip to content

Commit

Permalink
Added defaults for user properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Snyder committed Mar 2, 2023
1 parent 29e5d9a commit 6e38258
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions backend/Services/Auth/Adapters/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ class Header extends JsonFile
protected $username_header_key;
protected $fullname_header_key;
protected $non_header_users;
protected $user_defaults;

public function init(array $config = [])
{
parent::init($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
Expand Down Expand Up @@ -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",
];
}

Expand Down
7 changes: 7 additions & 0 deletions configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '2.2'

services:

filegator:
image: filegator/filegator:latest
ports:
Expand Down
Empty file added private/.gitkeep
Empty file.

0 comments on commit 6e38258

Please sign in to comment.