mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 07:19:56 +08:00
parent
d95a1481be
commit
3b529d3a40
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Database\Migration;
|
||||
use Flarum\Group\Group;
|
||||
|
||||
return Migration::addPermissions([
|
||||
// Guests can view the forum
|
||||
'viewDiscussions' => Group::GUEST_ID,
|
||||
|
||||
// Members can create and reply to discussions, and view the user list
|
||||
'startDiscussion' => Group::MEMBER_ID,
|
||||
'discussion.reply' => Group::MEMBER_ID,
|
||||
'viewUserList' => Group::MEMBER_ID,
|
||||
|
||||
// Moderators can edit + delete stuff
|
||||
'discussion.hide' => Group::MODERATOR_ID,
|
||||
'discussion.editPosts' => Group::MODERATOR_ID,
|
||||
'discussion.hidePosts' => Group::MODERATOR_ID,
|
||||
'discussion.rename' => Group::MODERATOR_ID,
|
||||
'discussion.viewIpsPosts' => Group::MODERATOR_ID,
|
||||
]);
|
@ -195,7 +195,6 @@ class InstallCommand extends AbstractCommand
|
||||
$this->application->register(PostServiceProvider::class);
|
||||
|
||||
$this->seedGroups();
|
||||
$this->seedPermissions();
|
||||
|
||||
$this->createAdminUser();
|
||||
|
||||
@ -304,35 +303,6 @@ class InstallCommand extends AbstractCommand
|
||||
}
|
||||
}
|
||||
|
||||
protected function seedPermissions()
|
||||
{
|
||||
$permissions = [
|
||||
// Guests can view the forum
|
||||
[Group::GUEST_ID, 'viewDiscussions'],
|
||||
|
||||
// Members can create and reply to discussions, and view the user list
|
||||
[Group::MEMBER_ID, 'startDiscussion'],
|
||||
[Group::MEMBER_ID, 'discussion.reply'],
|
||||
[Group::MEMBER_ID, 'viewUserList'],
|
||||
|
||||
// Moderators can edit + delete stuff
|
||||
[Group::MODERATOR_ID, 'discussion.hide'],
|
||||
[Group::MODERATOR_ID, 'discussion.editPosts'],
|
||||
[Group::MODERATOR_ID, 'discussion.hidePosts'],
|
||||
[Group::MODERATOR_ID, 'discussion.rename'],
|
||||
[Group::MODERATOR_ID, 'discussion.viewIpsPosts'],
|
||||
];
|
||||
|
||||
foreach ($permissions as &$permission) {
|
||||
$permission = [
|
||||
'group_id' => $permission[0],
|
||||
'permission' => $permission[1]
|
||||
];
|
||||
}
|
||||
|
||||
Permission::insert($permissions);
|
||||
}
|
||||
|
||||
protected function createAdminUser()
|
||||
{
|
||||
$admin = $this->adminUser;
|
||||
|
Loading…
x
Reference in New Issue
Block a user