You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -86,17 +88,24 @@ private function saveNew($imageName, $imageData, $type)
86
88
}
87
89
$fullPath = $imagePath . $imageName;
88
90
91
+
if(!is_writable(dirname(public_path($fullPath)))) thrownewImageUploadException('Image Directory ' . public_path($fullPath) . ' is not writable by the server.');
92
+
89
93
$storage->put($fullPath, $imageData);
90
94
91
-
$userId = auth()->user()->id;
92
-
$image = Image::forceCreate([
95
+
$imageDetails = [
93
96
'name' => $imageName,
94
97
'path' => $fullPath,
95
98
'url' => $this->getPublicUrl($fullPath),
96
-
'type' => $type,
97
-
'created_by' => $userId,
98
-
'updated_by' => $userId
99
-
]);
99
+
'type' => $type
100
+
];
101
+
102
+
if (auth()->user() && auth()->user()->id !== 0) {
103
+
$userId = auth()->user()->id;
104
+
$imageDetails['created_by'] = $userId;
105
+
$imageDetails['updated_by'] = $userId;
106
+
}
107
+
108
+
$image = Image::forceCreate($imageDetails);
100
109
101
110
return$image;
102
111
}
@@ -188,6 +197,7 @@ public function saveUserGravatar(User $user, $size = 500)
Copy file name to clipboardExpand all lines: readme.md
+53-6Lines changed: 53 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,12 +2,24 @@
2
2
3
3
A platform to create documentation/wiki content. General information about BookStack can be found at https://www.bookstackapp.com/
4
4
5
+
1.[Requirements](#requirements)
6
+
2.[Installation](#installation)
7
+
-[Server Rewrite Rules](#url-rewrite-rules)
8
+
3.[Updating](#updating-bookstack)
9
+
4.[Social Authentication](#social-authentication)
10
+
-[Google](#google)
11
+
-[GitHub](#github)
12
+
5.[LDAP Authentication](#ldap-authentication)
13
+
6.[Testing](#testing)
14
+
7.[License](#license)
15
+
8.[Attribution](#attribution)
16
+
5
17
6
18
## Requirements
7
19
8
20
BookStack has similar requirements to Laravel. On top of those are some front-end build tools which are only required when developing.
9
21
10
-
* PHP >= 5.5.9
22
+
* PHP >= 5.5.9, Will need to be usable from the command line.
11
23
* OpenSSL PHP Extension
12
24
* PDO PHP Extension
13
25
* MBstring PHP Extension
@@ -21,9 +33,7 @@ BookStack has similar requirements to Laravel. On top of those are some front-en
21
33
22
34
## Installation
23
35
24
-
Ensure the requirements are met before installing.
25
-
26
-
Currently BookStack requires its own domain/subdomain and will not work in a site subdirectory.
36
+
Ensure the above requirements are met before installing. Currently BookStack requires its own domain/subdomain and will not work in a site subdirectory.
27
37
28
38
This project currently uses the `release` branch of this repository as a stable channel for providing updates.
29
39
@@ -67,11 +77,11 @@ To update BookStack you can run the following command in the root directory of t
This command will update the repository that was created in the installation, install the PHP dependencies using `composer` then run the database migrations.
80
+
This command will update the repository that was created in the installation, install the PHP dependencies using `composer` then run the database migrations.
71
81
72
82
## Social Authentication
73
83
74
-
BookStack currently supports login via both Google and Github. Once enabled options for these services will show up in the login, registration and user profile pages. By default these services are disabled. To enable them you will have to create an application on the external services to obtain the require application id's and secrets. Here are instructions to do this for the current supported services:
84
+
BookStack currently supports login via both Google and GitHub. Once enabled options for these services will show up in the login, registration and user profile pages. By default these services are disabled. To enable them you will have to create an application on the external services to obtain the require application id's and secrets. Here are instructions to do this for the current supported services:
75
85
76
86
### Google
77
87
@@ -97,6 +107,43 @@ BookStack currently supports login via both Google and Github. Once enabled opti
97
107
5. Set the 'APP_URL' environment variable to be the same domain as you entered in step 3.
98
108
6. All done! Users should now be able to link to their social accounts in their account profile pages and also register/login using their Github account.
99
109
110
+
## LDAP Authentication
111
+
112
+
BookStack can be configured to allow LDAP based user login. While LDAP login is enabled you cannot log in with the standard user/password login and new user registration is disabled. BookStack will only use the LDAP server for getting user details and for authentication. Data on the LDAP server is not currently editable through BookStack.
113
+
114
+
When a LDAP user logs into BookStack for the first time their BookStack profile will be created and they will be given the default role set under the 'Default user role after registration' option in the application settings.
115
+
116
+
To set up LDAP-based authentication add or modify the following variables in your `.env` file:
117
+
118
+
```
119
+
# General auth
120
+
AUTH_METHOD=ldap
121
+
122
+
# The LDAP host, Adding a port is optional
123
+
LDAP_SERVER=ldap://example.com:389
124
+
125
+
# The base DN from where users will be searched within.
126
+
LDAP_BASE_DN=ou=People,dc=example,dc=com
127
+
128
+
# The full DN and password of the user used to search the server
129
+
# Can both be left as false to bind anonymously
130
+
LDAP_DN=false
131
+
LDAP_PASS=false
132
+
133
+
# A filter to use when searching for users
134
+
# The user-provided user-name used to replace any occurrences of '${user}'
135
+
LDAP_USER_FILTER=(&(uid=${user}))
136
+
137
+
# Set the LDAP version to use when connecting to the server.
138
+
LDAP_VERSION=false
139
+
```
140
+
141
+
You will also need to have the php-ldap extension installed on your system. It's recommended to change your `APP_DEBUG` variable to `true` while setting up LDAP to make any errors visible. Remember to change this back after LDAP is functioning.
142
+
143
+
A user in BookStack will be linked to a LDAP user via a 'uid'. If a LDAP user uid changes it can be updated in BookStack by an admin by changing the 'External Authentication ID' field on the user's profile.
144
+
145
+
You may find that you cannot log in with your initial Admin account after changing the `AUTH_METHOD` to `ldap`. To get around this set the `AUTH_METHOD` to `standard`, login with your admin account then change it back to `ldap`. You get then edit your profile and add your LDAP uid under the 'External Authentication ID' field. You will then be able to login in with that ID.
146
+
100
147
## Testing
101
148
102
149
BookStack has many integration tests that use Laravel's built-in testing capabilities which makes use of PHPUnit. To use you will need PHPUnit installed and accessible via command line. There is a `mysql_testing` database defined within the app config which is what is used by PHPUnit. This database is set with the following database name, user name and password defined as `bookstack-test`. You will have to create that database and credentials before testing.
0 commit comments