mirror of
https://github.com/filegator/filegator.git
synced 2025-08-07 07:46:33 +02:00
docs update
This commit is contained in:
44
couscous.yml
44
couscous.yml
@@ -11,26 +11,38 @@ subTitle: Documentation
|
|||||||
baseUrl: https://docs.filegator.io
|
baseUrl: https://docs.filegator.io
|
||||||
|
|
||||||
template:
|
template:
|
||||||
url: https://github.com/CouscousPHP/Template-Light
|
url: https://github.com/CouscousPHP/Template-Dark
|
||||||
|
|
||||||
github:
|
github:
|
||||||
user: filegator
|
user: filegator
|
||||||
repo: filegator
|
repo: filegator
|
||||||
|
|
||||||
menu:
|
menu:
|
||||||
items:
|
sections:
|
||||||
home:
|
main:
|
||||||
text: What is FileGator
|
name: Getting Started
|
||||||
relativeUrl: index.html
|
items:
|
||||||
install:
|
home:
|
||||||
text: Installation
|
text: What is FileGator
|
||||||
relativeUrl: install.html
|
relativeUrl: index.html
|
||||||
|
install:
|
||||||
|
text: Installation
|
||||||
|
relativeUrl: install.html
|
||||||
|
demo:
|
||||||
|
text: Demo
|
||||||
|
absoluteUrl: demo.html
|
||||||
|
license:
|
||||||
|
text: License
|
||||||
|
absoluteUrl: license.html
|
||||||
config:
|
config:
|
||||||
text: Configuration
|
name: Configuration
|
||||||
relativeUrl: configuration.html
|
items:
|
||||||
demo:
|
basic:
|
||||||
text: Demo
|
text: Options
|
||||||
absoluteUrl: demo.html
|
relativeUrl: configuration/default.html
|
||||||
license:
|
auth:
|
||||||
text: License
|
text: Auth
|
||||||
absoluteUrl: license.html
|
relativeUrl: configuration/auth.html
|
||||||
|
sessions:
|
||||||
|
text: Session
|
||||||
|
relativeUrl: configuration/session.html
|
||||||
|
@@ -1,8 +0,0 @@
|
|||||||
CREATE TABLE `sessions` (
|
|
||||||
`sess_id` varbinary(128) NOT NULL,
|
|
||||||
`sess_data` blob NOT NULL,
|
|
||||||
`sess_lifetime` mediumint(9) NOT NULL,
|
|
||||||
`sess_time` int(10) unsigned NOT NULL,
|
|
||||||
PRIMARY KEY (`sess_id`)
|
|
||||||
) CHARSET=utf8 COLLATE=utf8_bin;
|
|
||||||
|
|
@@ -1,16 +0,0 @@
|
|||||||
CREATE TABLE `users` (
|
|
||||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
|
||||||
`username` varchar(255) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`role` varchar(20) NOT NULL,
|
|
||||||
`permissions` varchar(200) NOT NULL,
|
|
||||||
`homedir` varchar(2000) NOT NULL,
|
|
||||||
`password` varchar(255) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `username` (`username`)
|
|
||||||
) CHARSET=utf8 COLLATE=utf8_bin;
|
|
||||||
|
|
||||||
INSERT INTO `users` (`username`, `name`, `role`, `permissions`, `homedir`, `password`)
|
|
||||||
VALUES
|
|
||||||
('guest', 'Guest', 'guest', '', '/', ''),
|
|
||||||
('admin', 'Admin', 'admin', 'read|write|upload|download|batchdownload|zip', '/', '$2y$10$Nu35w4pteLfc7BDCIkDPkecjw8wsH8Y2GMfIewUbXLT7zzW6WOxwq');
|
|
42
docs/configuration/auth.md
Normal file
42
docs/configuration/auth.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
### Configuring Auth service to use database
|
||||||
|
You can store your users inside mysql database (default is json file).
|
||||||
|
|
||||||
|
First, create a table ```users``` with this sql:
|
||||||
|
```
|
||||||
|
CREATE TABLE `users` (
|
||||||
|
`id` int(10) NOT NULL AUTO_INCREMENT,
|
||||||
|
`username` varchar(255) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`role` varchar(20) NOT NULL,
|
||||||
|
`permissions` varchar(200) NOT NULL,
|
||||||
|
`homedir` varchar(2000) NOT NULL,
|
||||||
|
`password` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `username` (`username`)
|
||||||
|
) CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
```
|
||||||
|
Then, import default users with this query:
|
||||||
|
|
||||||
|
```
|
||||||
|
INSERT INTO `users` (`username`, `name`, `role`, `permissions`, `homedir`, `password`)
|
||||||
|
VALUES
|
||||||
|
('guest', 'Guest', 'guest', '', '/', ''),
|
||||||
|
('admin', 'Admin', 'admin', 'read|write|upload|download|batchdownload|zip', '/', '$2y$10$Nu35w4pteLfc7BDCIkDPkecjw8wsH8Y2GMfIewUbXLT7zzW6WOxwq');
|
||||||
|
```
|
||||||
|
|
||||||
|
Ath the end, open ```configuration.php``` and update Auth handler under section ```services``` to something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
'Filegator\Services\Auth\AuthInterface' => [
|
||||||
|
'handler' => '\Filegator\Services\Auth\Adapters\Database',
|
||||||
|
'config' => [
|
||||||
|
'driver' => 'mysqli',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'username' => 'root',
|
||||||
|
'password' => 'password',
|
||||||
|
'database' => 'filegator',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
```
|
||||||
|
|
@@ -2,48 +2,6 @@
|
|||||||
All configuration options are stored inside ```configuration.php``` file.
|
All configuration options are stored inside ```configuration.php``` file.
|
||||||
In this file you can configure all the options, services and their handlers.
|
In this file you can configure all the options, services and their handlers.
|
||||||
|
|
||||||
### Configuring Auth service to use database
|
|
||||||
You can store your users inside mysql database (default is json file).
|
|
||||||
|
|
||||||
First, create a table ```users``` with this sql:
|
|
||||||
```
|
|
||||||
CREATE TABLE `users` (
|
|
||||||
`id` int(10) NOT NULL AUTO_INCREMENT,
|
|
||||||
`username` varchar(255) NOT NULL,
|
|
||||||
`name` varchar(255) NOT NULL,
|
|
||||||
`role` varchar(20) NOT NULL,
|
|
||||||
`permissions` varchar(200) NOT NULL,
|
|
||||||
`homedir` varchar(2000) NOT NULL,
|
|
||||||
`password` varchar(255) NOT NULL,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `username` (`username`)
|
|
||||||
) CHARSET=utf8 COLLATE=utf8_bin;
|
|
||||||
```
|
|
||||||
Then, import default users with this query:
|
|
||||||
|
|
||||||
```
|
|
||||||
INSERT INTO `users` (`username`, `name`, `role`, `permissions`, `homedir`, `password`)
|
|
||||||
VALUES
|
|
||||||
('guest', 'Guest', 'guest', '', '/', ''),
|
|
||||||
('admin', 'Admin', 'admin', 'read|write|upload|download|batchdownload|zip', '/', '$2y$10$Nu35w4pteLfc7BDCIkDPkecjw8wsH8Y2GMfIewUbXLT7zzW6WOxwq');
|
|
||||||
```
|
|
||||||
|
|
||||||
Ath the end, open ```configuration.php``` and update Auth handler under section ```services``` to something like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
'Filegator\Services\Auth\AuthInterface' => [
|
|
||||||
'handler' => '\Filegator\Services\Auth\Adapters\Database',
|
|
||||||
'config' => [
|
|
||||||
'driver' => 'mysqli',
|
|
||||||
'host' => 'localhost',
|
|
||||||
'username' => 'root',
|
|
||||||
'password' => 'password',
|
|
||||||
'database' => 'filegator',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Default Configuration options
|
### Default Configuration options
|
||||||
|
|
61
docs/configuration/session.md
Normal file
61
docs/configuration/session.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
### Configuring Session service to use database
|
||||||
|
|
||||||
|
First, create a table ```sessions``` with this sql:
|
||||||
|
```
|
||||||
|
CREATE TABLE `sessions` (
|
||||||
|
`sess_id` varbinary(128) NOT NULL,
|
||||||
|
`sess_data` blob NOT NULL,
|
||||||
|
`sess_lifetime` mediumint(9) NOT NULL,
|
||||||
|
`sess_time` int(10) unsigned NOT NULL,
|
||||||
|
PRIMARY KEY (`sess_id`)
|
||||||
|
) CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, open ```configuration.php``` and update Auth handler under section ```services``` to something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
|
'config' => [
|
||||||
|
'session_handler' => 'database',
|
||||||
|
'available' => [
|
||||||
|
'database' => function () {
|
||||||
|
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||||
|
'mysql://root:password@localhost:3360/filegator'
|
||||||
|
);
|
||||||
|
|
||||||
|
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $handler);
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
```
|
||||||
|
Don't forget to enter correct mysql username, password, and database.
|
||||||
|
|
||||||
|
|
||||||
|
### Tweaking session options
|
||||||
|
|
||||||
|
The Underying Symfony session [component](https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php) constructor accepts an array options.
|
||||||
|
For example you can pass ```cookie_lifetime``` parameter and extend session lifetime like this:
|
||||||
|
```
|
||||||
|
'Filegator\Services\Session\SessionStorageInterface' => [
|
||||||
|
'handler' => '\Filegator\Services\Session\Adapters\SessionStorage',
|
||||||
|
'config' => [
|
||||||
|
'session_handler' => 'database',
|
||||||
|
'available' => [
|
||||||
|
'database' => function () {
|
||||||
|
$handler = new \Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler(
|
||||||
|
'mysql://root:password@localhost:3360/filegator'
|
||||||
|
);
|
||||||
|
|
||||||
|
return new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([
|
||||||
|
'cookie_lifetime' => 365 * 24 * 60 * 60, // one year
|
||||||
|
], $handler);
|
||||||
|
},
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
```
|
Reference in New Issue
Block a user