PCv5/app/utils
Lephe 6f98cba65e
review of privileges and forum permissions
* Sorted privileges into categories, similar to the v4.3 style

Added privilege check utilities:
* Forum: is_news(), is_default_accessible() and is_default_postable()
* Member: can_access_forum(), can_post_in_forum(), can_edit_post(),
  and can_delete_post()

Unfortunately current_user is not a Guest when logged out, so one
cannot usually write current_user.can_*() without checking for
authentication first, so the checks are still somewhat verbose.

Reviewed forum permissions; the following permission issues have been
fixed (I have tested most but not all of them prior to fixing):

* app/routes/forum/index.py: Users that were not meant to access a
  forum could still obtain a listing of the topics
* app/routes/forum/topic.py: Users that were not meant to see topics
  could still read them by browsing the URL
* app/routes/forum/topic.py: Authenticated users could post in any
  topic, including ones that they should not have access to
* app/routes/posts/edit.py: Users with edit.posts (eg. mods) could edit
  and delete messages in forums they can't access (eg. creativecalc)

* app/templates/account/user.html: Users with admin panel access would
  see account editing links they can't use (affects developers)
* app/templates/base/navbar/forum.html: The "Forum" tab would list all
  forums including ones the user doesn't have access to
* app/templates/forum/index.html: Users would see every single forum,
  including ones they can't access
* app/template/widgets/thread.html: Anyone would see Edit/Delete links
  on every message, even though most were unusable

Miscellaneous changes:
* app/routes/forum/topic.py: Ordered comments by date as intended,
  which I assume worked by chance until now
* Removed the old assets/privs.txt files which is now superseded by the
  list implemented in app/data/groups.yaml

This commit changes group and forum information, run master.py with:
@> forums update
@> groups update
2021-02-26 18:32:45 +01:00
..
filters markdown: add linkify extension 2021-02-24 00:38:26 +01:00
markdown_extensions markdown: add linkify extension 2021-02-24 00:38:26 +01:00
validators review of privileges and forum permissions 2021-02-26 18:32:45 +01:00
bleach_allowlist.py markdown: add linkify extension 2021-02-24 00:38:26 +01:00
check_csrf.py security: add CSRF protection globally 2020-09-26 14:48:30 +02:00
converters.py fix: better PEP8 2020-08-05 22:52:56 +02:00
filesize.py fix: better PEP8 2020-08-05 22:52:56 +02:00
glados.py glados: added glados socket and example wrapper 2020-11-11 13:28:53 +01:00
ldap.py ldap: add sub-organization feature 2020-08-25 23:05:54 +02:00
notify.py fix a typo in many files 2020-08-25 22:57:45 +02:00
priv_required.py review of privileges and forum permissions 2021-02-26 18:32:45 +01:00
render.py md: improved markdown 2021-02-20 15:39:52 +01:00
send_mail.py utils: FIX titre de l'email de réinit du mot de passe 2020-07-21 22:39:09 +02:00
unicode_names.py utils: add normalization of Unicode names 2019-06-05 18:24:41 -04:00
valid_name.py fix a typo in many files 2020-08-25 22:57:45 +02:00