/
Plugin.php
81 lines (64 loc) · 2.78 KB
/
Plugin.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace Martin\SSOLogin;
use Event, View;
use System\Classes\PluginBase;
use System\Classes\SettingsManager;
use System\Classes\CombineAssets;
use Martin\SSOLogin\Models\Settings;
class Plugin extends PluginBase {
public $elevated = true;
public function boot() {
\Backend\Controllers\Auth::extend(function($controller) {
if(\Backend\Classes\BackendController::$action == 'signin') {
if(Settings::get('google_button') == 'light') {
$CSS[] = 'ssologin-light.css';
} else {
$CSS[] = 'ssologin.css';
}
if(Settings::get('hide_login_fields') == 1) {
$CSS[] = 'hide-login.css';
}
$controller->addCss(CombineAssets::combine($CSS, plugins_path() . '/martin/ssologin/assets/css/'));
}
});
Event::listen('backend.auth.extendSigninView', function($controller) {
return View::make("martin.ssologin::login");
});
}
public function pluginDetails() {
return [
'name' => 'martin.ssologin::lang.plugin.name',
'description' => 'martin.ssologin::lang.plugin.description',
'author' => 'Martin M.',
'icon' => 'icon-key'
];
}
public function registerSettings() {
return [
'settings' => [
'label' => 'martin.ssologin::lang.plugin.name',
'description' => 'martin.ssologin::lang.plugin.description',
'icon' => 'icon-key',
'class' => '\Martin\SSOLogin\Models\Settings',
'order' => 800,
'permissions' => ['martin.ssologin.access'],
'category' => 'system::lang.system.categories.system'
],
'logs' => [
'label' => 'martin.ssologin::lang.plugin.name',
'description' => 'martin.ssologin::lang.plugin.description_log',
'icon' => 'icon-key',
'url' => \Backend::url('martin/ssologin/logs'),
'order' => 800,
'permissions' => ['martin.ssologin.access'],
'category' => SettingsManager::CATEGORY_LOGS,
],
];
}
public function registerPermissions() {
return [
'martin.ssologin.access' => ['tab' => 'system::lang.permissions.name', 'label' => 'martin.ssologin::lang.plugin.permissions'],
];
}
}
?>