Commit Graph

26 Commits

Author SHA1 Message Date
Lephe db0e42d285
programs: add tag input and display (#114)
* Add a TagListField which automatically validates its input against the
  TagInformation database, and has a richer .selected_tags() method
* Add a dynamic tag input widget, available through a macro (*import
  with context*), that supports both JS and non-JS input
* Add a TagInformation.all_tags() function
* Add colored tag display to all themes
* Fix a bug causing programs to have no names
* Add tags: games.action, games.narrative, courses.informatics

[MASTER] Run the 'update-tags' command of master.py.
2022-06-14 23:19:41 +01:00
Lephe c74abf3fcc
post: add a tagging system, with a common base set of tags
Adds the tagging system, with 3 types of tags:
* Calculator models grouped by compatibility classes
* Programming languages
* Game, tools, and course categories

[MIGRATION] This commit contains a new version of the schema.
[BREAKS] This commit breaks existing tag assignments.
[MASTER] Run the 'update-tags' command of master.py.
2022-06-12 18:26:47 +01:00
Lephe 9727c2a986 forum: add an action to change the top comment of a topic
This also prepares the thread_leader macro for top comments of
topics, programs, etc. which have extra stuff to render and more
specific actions.
2021-07-12 18:37:06 +02:00
Lephe b533f8a161 forum: replace comment action links with contextual menu
The menu works with HTML/CSS only, and JS support will also allow
closing it by clicking outside of it (instead of closing allow when
clicking on the menu icon again).
2021-07-12 18:37:06 +02:00
Eragon 78b6448167
Correct typo 2021-07-08 16:45:22 +02:00
Darks 8bdf3909ea
login_as: fixed some issues
See https://gitea.planet-casio.com/devs/PCv5/issues/90#issuecomment-1131
2021-03-06 11:36:35 +01:00
Darks 87ef91b9e3
login_as: add function to login as arbitrary account 2021-03-05 23:56:03 +01:00
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
Lephe d50b58cd24
(random improvements on texts) 2021-02-26 18:31:10 +01:00
Lephe 75f3a90f20
master.py: update forums with stateful logic
The create-forums function has been replaced with an [update] subcommand
of [forums]. This new function tries its best to keep existing forum
objects, which is especially important once content has been created.

Forums are identified by their URL. Changing the URL means the forum
needs to be recreated. If the URL doesn't changed, metadata is updated
without removing topics and subforums in that forum.

* Improve the update model for forums in master.py
* Fix a typo in the prefix for the tool projects subforum
* Add the admin and assoc boards for permission testing
2020-11-01 10:50:52 +01:00
Darks 56a584c535
attachments: added attachments system
Still need some work on it…
2020-08-01 21:26:06 +02:00
Lephe 19e4ee2e30
trophies: generate icons dynamically in the master script
DATABASE UPDATE: Run the [create-trophies] command of the master script
to obtain icons.
2020-07-22 11:53:35 +02:00
Lephe 5566cb6262
trophies: add "Survivant de la v42"
DATABASE UPDATE: Use the [create-trophies] command of the master script
to recreate trophies.
2020-07-22 10:20:37 +02:00
Darks c0f2552e03
trophies: fix le ! en fin de description 2020-07-20 19:43:38 +02:00
Darks 1b17234623
trophies: ADD hidden parameter, FIX admin panel 2020-07-20 19:35:05 +02:00
Lephe c4bfef4765
trophies: add descriptions
DATABASE UPDATE: run [flask db upgrade], then use the [create-trophies]
command of the master script to recreate trophies.
2020-07-19 22:27:00 +02:00
Darks 19d09a71df
Passage des routes en français (#41) 2019-12-16 23:57:50 +01:00
Darks 415cfd8d8f
Ajout des conditions de création de topics
– L'utilisateur a le droit 'write-everywhere'
– C'est un topic de news et l'utilisateur a le droit 'write-news'
— Ce n'est pas un topic de news et le topic est une feuille de l'arbre 
du forum

Je me rends compte que c'est foireux pour la gestion des permissions. 
Faudra reprendre ça pour faire quelque chose de plus modulable…
2019-12-10 23:01:40 +01:00
Lephe 8a0ba309e0
forum: restructure models and add topic creation
This changes fixes #25 by restructuring the forum models in a way
compatible with the polymorphic behavior of SQLAlchemy. Incidentally,
the new form turns out to be more appropriate for our use than the
polymorphic one originally used.

The migration for this task is non-trivial because the Thread class was
created with a foreign-key id which thus had no auto-increment or
associated sequence. The most reliable way of getting it back was to
recreate the table because SQLAlchemy ony performs automated sequence
introduction at table creation time. Four separate migration files
perform the whole change.

This commit also adds views and forms to create topics, and the
boilerplate for an advanced markup editor that can be used as a widget.
2019-09-09 08:11:38 +02:00
Lephe aa75ff09a1
forum: implement forum tree generation
This commit adds a forum tree YAML file (URL-based rather than an
actual tree...) and the 'forums' and 'create-forums' commands for
the master script.

A page /admin/forums is also used to currently display the forum
tree, although this will probably be turned into a full table with
forum descriptions, and a form with edition capabilities.
2019-09-09 08:11:37 +02:00
Darks 2e80a56596
Ajout d'un groupe `nologin` (corrige #22)
Les comptes GLaDOS et PlanèteCasio sont automatiquement ajoutés au 
groupe "No login", qui empêche l'utilisateur de se connecter, et ce même 
si les identifiants sont corrects.
2019-09-03 09:28:07 +02:00
Darks 15a4d38ea0
Ajout des notifications 2019-09-01 12:30:41 +02:00
Lephe 4cefe39c36 trophies: automatically remove undeserved trophies
... and other minor edits from the trophies branch.
2019-08-19 17:26:22 +02:00
Darks 1d638689c6
Modifications on trophies and titles #10 (and more)
- remove `title` attribute
- do the migration of db
- add initialization routine in `master.py`
- add default trophies and titles in `data/trophies.yaml`
- add `add_trophy` method in `Member` class
- add `update_trophies` method in `Member` class
- add form in admin panel to give a trophy to a member
- same to remove a trophy
- change `if request.method == "POST"` to `if form.submit.data`
2019-06-11 00:15:23 +02:00
Darks 809859268a
Petite correction sur les droits 2019-06-07 01:56:18 +02:00
Lephe 725e768520 groups: move default group data to a suitable place 2019-02-16 17:12:41 +01:00