mirror of
https://github.com/flarum/core.git
synced 2025-07-24 18:21:33 +02:00
Rename viewDiscussions => viewForum, viewUserList => searchUsers (#2854)
This naming is clearer as to the intended effect. Changes include: - A migration to rename all permissions - Updating the seed migration to use the original naming from the start - Replacing usage of the old names with new names in code - Throwing warnings when the old names are used.
This commit is contained in:
committed by
GitHub
parent
06f63a2087
commit
d64750b3eb
@@ -12,12 +12,12 @@ use Illuminate\Database\Schema\Builder;
|
||||
|
||||
$rows = [
|
||||
// Guests can view the forum
|
||||
['permission' => 'viewDiscussions', 'group_id' => Group::GUEST_ID],
|
||||
['permission' => 'viewForum', 'group_id' => Group::GUEST_ID],
|
||||
|
||||
// Members can create and reply to discussions, and view the user list
|
||||
// Members can create and reply to discussions, and search users
|
||||
['permission' => 'startDiscussion', 'group_id' => Group::MEMBER_ID],
|
||||
['permission' => 'discussion.reply', 'group_id' => Group::MEMBER_ID],
|
||||
['permission' => 'viewUserList', 'group_id' => Group::MEMBER_ID],
|
||||
['permission' => 'searchUsers', 'group_id' => Group::MEMBER_ID],
|
||||
|
||||
// Moderators can edit + delete stuff
|
||||
['permission' => 'discussion.hide', 'group_id' => Group::MODERATOR_ID],
|
||||
|
36
migrations/2021_05_10_000000_rename_permissions.php
Normal file
36
migrations/2021_05_10_000000_rename_permissions.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
|
||||
return [
|
||||
'up' => function (Builder $schema) {
|
||||
$db = $schema->getConnection();
|
||||
|
||||
$db->table('group_permission')
|
||||
->where('permission', 'LIKE', 'viewDiscussions')
|
||||
->update(['permission' => $db->raw("REPLACE(permission, 'viewDiscussions', 'viewForum')")]);
|
||||
|
||||
$db->table('group_permission')
|
||||
->where('permission', 'LIKE', 'viewUserList')
|
||||
->update(['permission' => $db->raw("REPLACE(permission, 'viewUserList', 'searchUsers')")]);
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
$db = $schema->getConnection();
|
||||
|
||||
$db->table('group_permission')
|
||||
->where('permission', 'LIKE', 'viewForum')
|
||||
->update(['permission' => $db->raw("REPLACE(permission, 'viewForum', 'viewDiscussions')")]);
|
||||
|
||||
$db->table('group_permission')
|
||||
->where('permission', 'LIKE', 'searchUsers')
|
||||
->update(['permission' => $db->raw("REPLACE(permission, 'searchUsers', 'viewUserList')")]);
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user