]> BookStack Code Mirror - website/blob - content/blog/bookstack-release-v22-07.md
Update filesystem-permissions.md
[website] / content / blog / bookstack-release-v22-07.md
1 +++
2 categories = ["Releases"]
3 tags = ["Releases"]
4 title = "BookStack Release v22.07"
5 date = 2022-07-28T13:30:00Z
6 author = "Dan Brown"
7 image = "/images/blog-cover-images/library-chaojie-ni.jpg"
8 slug = "bookstack-release-v22-07"
9 draft = false
10 +++
11
12 For July we have what could be considered a "stepping-stone" release since it marks the start of some underlying 
13 permission system changes but it does bundle in a rich set of system enhancements & minor features. Let's jump right in.
14
15 * [Release video overview](https://youtu.be/m0iCq2MFynI)
16 * [Update instructions](https://www.bookstackapp.com/docs/admin/updates)
17 * [GitHub release page](https://github.com/BookStackApp/BookStack/releases/tag/v22.07)
18
19 ### Permission System Performance Increase
20
21 A fair amount of time this release cycle went into reviewing and refactoring the permission system.
22 This is ahead of adding future planned permission features, as I thought it best to address performance 
23 before building upon our current system any further.
24
25 With a lot of performance profiling, some significant slow-code pain-points were addressed.
26 Upon these, one of the largest performance hindrances was the due to the vast amount of permission data BookStack 
27 was generating upon changes.
28
29 For context, within Bookstack role and content permissions are calculated and flattened for simpler and more performant database queries when searching & viewing content. These are generated upon certain permission-affecting actions (role creation, content creation, permission changes, book sorting, etc.). The number of pre-calculated permission could really add-up; On a full system basis the count of such permissions would roughly be:
30
31 ```
32 (Number of roles) * (Count of shelves/books/chapters/pages) * (4-5 different permissions)
33 ```
34
35 On a large system, the quantity of pre-calculated permissions could really stack up, and just the time to insert all of this data into the database could really slow things down.
36
37 In this release, this pre-calculation is now only done for 'view' permissions, removing create/update/delete permission handling as part of this. This change can often bring a 4x speed improvement for many system actions. It may also provide a slight boost in general system view-usage performance.
38
39 These changes have meant that some views have had to change slightly.
40 In some areas, such as the move-page view, we'd only display chapters and books that the user would have permission to move into.
41 Now, we'll show all visible chapters & books but add a warning where permission is lacking:
42
43 ![Move page view with a parent book option showing a warning about lacking permission](/images/2022/07/move-permission-warning.png)
44
45 There's a high chance that the future desired permissions features will negatively impact performance so we'll continue to look for performance increasing opportunities to level out these impacts where possible.
46
47 ### Shelf Book Management Improvements
48
49 A little attention has been given to shelf-edit/create view to slightly enhance management of assigned books.
50 Book list items now have nicer hover and cursor interaction styles, and a drag handle is shown to make it clearer
51 that the books can be dragged around and re-ordered as desired. 
52
53 ![View of the books management UI for a shelf, with an active search in use](/images/2022/07/shelf-book-manage.png)
54
55 A search bar has been added to the available-books-list so you can quickly find a specific book, especially handy
56 in larger instances with many pre-existing books you'd have to filter through. This list is now sorted by name
57 to make it easier to read through, even without using the new search.
58
59 ### WYSIWYG Code Editor Language Favourites
60
61 The WYSIWYG code editor received significant changes in the last feature release. 
62 Upon feedback, it was evident that usage efficiency may have been hindered when it comes to selecting the code language, 
63 especially when the desired language is in the latter part of the code list, and hence off-screen by default. 
64
65 To remedy this, and to hopefully achieve a more efficient experience than ever before, we've added the ability to
66 favourite code languages:
67
68 ![Preview of the code editor with a filled-star symbol next to 5 code language options](/images/2022/07/code-editor-favourites.png)
69
70 Favourite languages will be automatically sorted to the top of the list, and these preferences will be stored against your BookStack user account so the favourites remain personal to you, and consistent across browsing devices.
71
72 ### Sort a Book from the Chapter
73
74 Within our BookStack Discord server it was noticeably common for users to ask "How do I re-order pages within a chapter?". 
75 A past attempt was made to add a specific chapter-sort view but this never progressed to completion. 
76 As a user-experience-focused workaround, a "Sort Book" action will now show when viewing a chapter, where permission permits:
77
78 ![Screenshot of a "Sort Book" button within a list of other actions](/images/2022/07/sort-book-from-chapter.png)
79
80 ### Adjustable IP Address Storage Precision
81
82 BookStack stores IP addresses within its audit log to provide admins with visibility of where actions are taking place from.
83 In some use-cases, this may be considered as storing personal data of others, thus problematic from a privacy perspective.
84 To address such cases, you can now set an `IP_ADDRESS_PRECISION` option in your `.env` file.
85
86 This is a numeric option, defaulting to `4` (Show entire IP address), which effectively states how many octets of an IPv4 address should be shown, or how many pairs-of-chomps of an IPv6 address should show.
87 As an example, the audit log preview below reflects usage of `IP_ADDRESS_PRECISION=2`:
88
89 ![Table view of activity, with an IP address column showing 127.0.x.x](/images/2022/07/audit-log-ip-masking.png)
90
91 ### Editor List Shortcuts
92
93 A couple of new shortcuts have been added to both page editors:
94
95 - Bullet List - `Ctrl`+`P` (`Cmd`+`P` on Mac)
96 - Numbered List - `Ctrl`+`O` (`Cmd`+`O` on Mac)
97
98 The addition of these should provide less reason for needing to take your fingers off your keyboard and therefore remain in the writing flow.
99
100 ### Tag-based CSS Customization
101
102 Tags are now much easier to use for design customization within BookStack.
103 Upon viewing of any item with tags, BookStack will format those tags into CSS classes applied to the `<body>` element
104 of the page. As an example, a tag name/value pair of `Priority: Critical` will apply the following classes to the body:
105
106 - tag-name-priority
107 - tag-value-critical
108 - tag-pair-priority-critical
109
110 This can then allow very easy content-level customization through the use of tags, with only the addition of some custom CSS in the "Custom HTML Head Content" setting. For example, you could apply a `Layout: dual` tag, along with a `.tag-pair-layout-dual .page-content p {columns: 2}` CSS rule to make paragraphs dual-column on those tagged pages.
111
112 Some normalization is applied to generate the classes. See our [docs section about tag classes](/docs/admin/hacking-bookstack/#tag-classes) for full details.
113
114 ### New "Activity Logged" Logical Theme System Event
115
116 Our [Logical Theme System](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/logical-theme-system.md), used to customize server-side functionality, has received a new `activity_logged` event. This allows you to run custom logic upon any system-logged event such as those visible in the audit log. 
117
118 This can be very powerful, as it provides a lot of visibility into system actions. As an example, the below customization would write out the HTML content of a page to the local filesystem, upon any update or create event:
119
120 ```php
121 <?php
122
123 use BookStack\Actions\ActivityType;
124 use BookStack\Entities\Models\Page;
125 use BookStack\Facades\Theme;
126 use BookStack\Theming\ThemeEvents;
127
128 Theme::listen(ThemeEvents::ACTIVITY_LOGGED, function (string $activityType, $detail) {
129
130     if (!$detail instanceof Page) {
131         return;
132     }
133
134     $validTypes = [ActivityType::PAGE_UPDATE, ActivityType::PAGE_CREATE];
135     if (!in_array($activityType, $validTypes)) {
136         return;
137     }
138
139     $outPath = "/output/directory/{$detail->id}.html";
140     file_put_contents($outPath, $detail->html);
141 });
142 ```
143
144 ### Underlying Library Updates
145
146 There have been some significant underlying updates done to libraries used in BookStack.
147 Hopefully these should have little impact to usage while providing some enhancements. Notably:
148
149 - TinyMCE (WYSIWYG Editor) was updated to version 6
150 - DomPDF (Default PDF render) was updated to version 2
151
152 ### Translations
153
154 A usual shout-out again  to our wonderful wordsmiths of different languages that have provided translation content since the  original v22.06 release:
155
156 - Leonardo Mario Martinez (leonardo.m.martinez) - *Spanish, Argentina*
157 - pedromcsousa - *Portuguese*
158 - Vitaliy (gviabcua) - *Ukrainian*
159 - scureza - *Italian*
160 - SmokingCrop - *Dutch*
161 - 10935336 - *Chinese Simplified*
162 - Statium - *Russian*
163 - Éric Gaspar (erga) - *French*
164 - na3shkw - *Japanese*
165 - Marcus Silber (marcus.silber82) - *German*
166 - PellNet - *Croatian*
167 - Maciej Lebiest (Szwendacz) - *Polish*
168 - Ole Aldric (Swoy) - *Norwegian Bokmal*
169 - Winetradr - *German*
170 - Indrek Haav (IndrekHaav) - *Estonian*
171 - m0uch0 - *Spanish*
172 - Sebastian Klaus (sebklaus) - *German*
173 - Filip Antala (AntalaFilip) - *Slovak*
174 - nutsflag - *French*
175 - Nicolas Pawlak (Mikolajek) - *French*
176 - mcgong (GongMingCai) - *Chinese Simplified; Chinese Traditional*
177 - Nanang Setia Budi (sefidananang) - *Indonesian*
178 - Андрей Павлов (andrei.pavlov) - *Russian*
179 - @smartshogu - *German*
180
181
182 ### Next Steps
183
184 For the next release I think I may take a detour to look at tracking cross-content links within BookStack for better referencing and url-change handling. This is after writing & discussing my [URL scheme proposal](https://github.com/BookStackApp/BookStack/issues/3520) which I think may be the wrong approach, so I'd like to explore a more direct and pragmatic option.
185
186 I'll continue to keep an eye on the permission system, and possibly perform another round of performance improvements there, before diving deeper into the new feature additions in that space.
187
188 ### Full List of Changes
189
190 **Released in v22.07**
191
192 * Added 'Sort Book' action to chapters. ([#3598](https://github.com/BookStackApp/BookStack/pull/3598), [#2335](https://github.com/BookStackApp/BookStack/issues/2335))
193 * Added ability to favourite code languages in the WYSIWYG code editor. ([#3593](https://github.com/BookStackApp/BookStack/pull/3593), [#3542](https://github.com/BookStackApp/BookStack/issues/3542))
194 * Added option to set IP address storage precision. ([#3560](https://github.com/BookStackApp/BookStack/issues/3560))
195 * Added tag-based css classes to the HTML body tag for tag-based content CSS targeting. ([#3583](https://github.com/BookStackApp/BookStack/issues/3583))
196 * Added new Logical Theme System event, emitted upon any system activity event. ([#3572](https://github.com/BookStackApp/BookStack/issues/3572))
197 * Added editor shortcuts for bullet and numbered lists. ([#3599](https://github.com/BookStackApp/BookStack/pull/3599), [#1269](https://github.com/BookStackApp/BookStack/issues/1269))
198 * Updated shelf book management interface with better usability and book search bar. ([#3591](https://github.com/BookStackApp/BookStack/pull/3591), [#3266](https://github.com/BookStackApp/BookStack/issues/3266))
199 * Updated translations with latest changes from Crowdin. ([#3600](https://github.com/BookStackApp/BookStack/pull/3600), [#3545](https://github.com/BookStackApp/BookStack/pull/3545))
200 * Updated WYSIWYG editor to TinyMCE 6. ([#3580](https://github.com/BookStackApp/BookStack/pull/3580), [#3517](https://github.com/BookStackApp/BookStack/issues/3517))
201 * Updated DOMPDF, and other PHP dependencies. ([#3579](https://github.com/BookStackApp/BookStack/pull/3579))
202 * Updated permission system to only "cache" view-based permissions for better performance, and made many other performance improvements. ([#3569](https://github.com/BookStackApp/BookStack/pull/3569))
203 * Updated WYSIWYG color options to have no names, for better cross-language usage. ([#3530](https://github.com/BookStackApp/BookStack/issues/3530))
204 * Updated tests to use ssddanbrown/asserthtml library. ([#3519](https://github.com/BookStackApp/BookStack/issues/3519))
205 * Fixed comment count translation in Chinese translations. Thanks to [@GongMingCai](https://github.com/BookStackApp/BookStack/pull/3556). ([#3556](https://github.com/BookStackApp/BookStack/pull/3556))
206 * Fixed issue where `AVATAR_URL=false` would not properly disable Gravatar fetching. ([#1835](https://github.com/BookStackApp/BookStack/issues/1835))
207 * Fixed some German translation typos and grammar. Thanks to [@smartshogu](https://github.com/BookStackApp/BookStack/pull/3570). ([#3570](https://github.com/BookStackApp/BookStack/pull/3570))
208 * Fixed issue where WYSIWYG toolbar would remain when after inserting a drawing. ([#3597](https://github.com/BookStackApp/BookStack/issues/3597))
209
210 **Released in v22.06.2**
211
212 * Updated translations with latest CrowdIn changes. ([#3540](https://github.com/BookStackApp/BookStack/pull/3540), [#3531](https://github.com/BookStackApp/BookStack/pull/3531))
213 * Fixed bug causing LDAP/SAML2 group mapping to fail if the "External Auth Ids" role field contained upper case characters. ([#3535](https://github.com/BookStackApp/BookStack/issues/3535))
214 * Fixed differing behaviour, between select button and double-click, in the link selector popup. ([#3534](https://github.com/BookStackApp/BookStack/issues/3534))
215
216 **Released in v22.06.1**
217
218 * Updated entity-selector-popup to reset state upon successful selection. ([#3528](https://github.com/BookStackApp/BookStack/issues/3528))
219 * Updated translations with latest CrowdIn changes. ([#3526](https://github.com/BookStackApp/BookStack/pull/3526))
220 * Fixed non-translated settings category options. ([#3529](https://github.com/BookStackApp/BookStack/issues/3529))
221 * Fixed issue where tags would not be saved upon book update. ([#3527](https://github.com/BookStackApp/BookStack/issues/3527))
222 * Fixed long code in "Custom Head" setting breaking page layout. ([#3523](https://github.com/BookStackApp/BookStack/issues/3523))
223
224 ----
225
226 <span style="font-size: 0.8em;opacity:0.9;">Header Image Credits: <span>Photo by <a href="https://unsplash.com/@ncj51518?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Chaojie Ni</a> on <a href="https://unsplash.com/s/photos/books?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
227   </span></span>