flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.29k stars 832 forks source link

[Tags?] Migrating an old database to 1.0 resets tag scoped permissions #2924

Closed iPurpl3x closed 3 years ago

iPurpl3x commented 3 years ago

Bug Report

Current Behavior After migrating some instances to 1.0, I noticed a recurrent problem: All tag scoped permissions get reset to admin only.

Steps to Reproduce

  1. Take a old database (tested with beta.13 and beta.15)
  2. Make sure there are some tag-scoped permissions that are allowing something for other groups than admins
  3. Install Flarum 1.0
  4. Run migrations via cmd
  5. Open the permissions pages and see that all tag-scoped tags are reset to allowing admins only.

Expected Behavior The permissions should stay the same after the migration.

Environment

/opt/flarum # php flarum info
Flarum core 1.0.2
PHP version: 8.0.6
Loaded extensions: Core, date, libxml, pcre, zlib, filter, hash, json, readline, Reflection, SPL, session, ctype, curl, dom, fileinfo, gd, gmp, mbstring, openssl, PDO, standard, tokenizer, xmlwriter, zip, exif, mysqlnd, Phar, pdo_mysql, igbinary, redis, Zend OPcache, xdebug
+-----------------------------------+---------------+------------------------------------------+
| Flarum Extensions                 |               |                                          |
+-----------------------------------+---------------+------------------------------------------+
| ID                                | Version       | Commit                                   |
+-----------------------------------+---------------+------------------------------------------+
| flarum-tags                       | v1.0.3        |                                          |
| flarum-flags                      | v1.0.0        |                                          |
| flarum-approval                   | v1.0.0        |                                          |
| flarum-suspend                    | v1.0.0        |                                          |
| fof-linguist                      | 1.0.0         |                                          |
| fof-impersonate                   | 1.0.0         |                                          |
| flarum-subscriptions              | v1.0.0        |                                          |
| flarum-markdown                   | v1.0.1        |                                          |
| flarum-lang-english               | v1.0.0        |                                          |
| flarum-statistics                 | v1.0.0        |                                          |
| fof-pages                         | 1.0.1         |                                          |
| fof-links                         | 1.0.0         |                                          |
| flarum-akismet                    | v1.0.0        |                                          |
| flarum-sticky                     | v1.0.0        |                                          |
| flarum-mentions                   | v1.0.0        |                                          |
| flarum-lock                       | v1.0.0        |                                          |
| flarum-emoji                      | v1.0.0        |                                          |
| flarum-bbcode                     | v1.0.0        |                                          |
| askvortsov-rich-text              | v2.0.3        |                                          |
+-----------------------------------+---------------+------------------------------------------+
Base URL: http://localhost:8888
Installation path: /opt/flarum
Debug mode: ON

Additional Context After looking into the database, I can observe that actually nothing really changes in the permissions during the migration. But still the UI shows that the permissions are reset and if I try to access a restricted tag with a previously allowed user (not admin), the permission isn't granted. So this makes this bug very very strange...

Ornanovitch commented 3 years ago

Open the permissions pages and see that all tag-scoped tags are reset to allowing admins only

I'm facing the very same issue from beta 16, very strange indeed!

Ornanovitch commented 3 years ago

@iPurpl3x do you have or did you have "Help Tags" extension enabled? On my side after disabling it, ti's obvious all permissions are really reset (before it seemed to be just on some random discussions)

iPurpl3x commented 3 years ago

@Ornanovitch No I never used this "Help Tags" extension.

Ornanovitch commented 3 years ago

OK! After rethinking I think this extension didn't broke a lot of things: what I had to do to resolve this was to toggle the first permission view forum on for all tags/groups, it automatically toggled correctly the rest of the columns...

iPurpl3x commented 3 years ago

@Ornanovitch OK thanks for sharing the workaround but this is not a viable solution, the scale of the deployments that I will have to do for the 1.0 update is not manually manageable like that !

Ornanovitch commented 3 years ago

I imagine! That was also for bringing some clues about what's going on

imorland commented 3 years ago

https://github.com/flarum/core/pull/2941