This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathController.php
64 lines (57 loc) · 1.68 KB
/
Controller.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
<?php
/**
* Part of the Piwik Login Shibboleth Plug-in.
*/
namespace Piwik\Plugins\LoginShibboleth;
use Piwik\Piwik;
use Piwik\View;
use Piwik\Url;
use Piwik\Notification;
use Piwik\Plugin\ControllerAdmin;
use Piwik\Plugin\Manager as PluginManager;
use Exception;
/*
* @author Pouyan Azari <pouyan.azari@uni-wuerzburg.de>
* @license MIT
* @copyright 2014-2019 University of Wuerzburg
* @copyright 2014-2019 Pouyan Azari
*/
class Controller extends \Piwik\Plugins\Login\Controller
{
/**
* @return string
* @throws Exception
*/
public function admin()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@LoginShibboleth/index');
ControllerAdmin::setBasicVariablesAdminView($view);
if (!function_exists('ldap_connect')) {
$notification = new Notification(Piwik::translate('ShibbolethLogin_LdapFunctionsMissing'));
$notification->context = Notification::CONTEXT_ERROR;
$notification->type = Notification::TYPE_TRANSIENT;
$notification->flags = 0;
Notification\Manager::notify('ShibbolethLogin_LdapFunctionsMissing', $notification);
}
$view->servers = array();
$this->setBasicVariablesView($view);
$view->shibbolethConfig = Config::getPluginOptionValuesWithDefaults();
$view->isLoginControllerActivated = PluginManager::getInstance()->isPluginActivated('Login');
return $view->render();
}
/**
* @return string
*/
public function index()
{
return $this->login();
}
/**
* @throws Exception
*/
public function logout()
{
Url::redirectToUrl(Config::getLogoutUrl());
}
}