-
Notifications
You must be signed in to change notification settings - Fork 4
/
extend.php
53 lines (40 loc) · 1.53 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* This file is part of Registration Roles.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
namespace TheTurk\RegRole;
use Flarum\Api\Controller\ShowUserController;
use Flarum\Api\Serializer\BasicUserSerializer;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Api\Serializer\GroupSerializer;
use Flarum\Extend;
use Flarum\Group\Group;
use Flarum\User\Event\Saving as UserSaving;
use Flarum\User\User;
use TheTurk\RegRole\Api\Controllers\AttachRoleController;
return [
(new Extend\Frontend('forum'))
->css(__DIR__.'/less/forum.less')
->js(__DIR__.'/js/dist/forum.js'),
(new Extend\Frontend('admin'))
->css(__DIR__.'/less/admin.less')
->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Locales(__DIR__.'/locale')),
(new Extend\Routes('api'))
->post('/regrole', 'regrole.attach', AttachRoleController::class),
(new Extend\Event())
->listen(UserSaving::class, Listeners\SetRoles::class),
(new Extend\User())
->permissionGroups(RevokeAccessFromUsers::class),
(new Extend\ApiSerializer(ForumSerializer::class))
->attributes(LoadSettings::class),
(new Extend\ApiSerializer(BasicUserSerializer::class))
->hasMany('regrole_all_groups', GroupSerializer::class),
(new Extend\Model(User::class))
->belongsToMany('regrole_all_groups', Group::class),
(new Extend\ApiController(ShowUserController::class))
->addInclude('regrole_all_groups'),
];