Test Failed
Push — master ( bb7a16...9c289d )
by Stefan
08:22
created

DeploymentClassic::remove()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 0
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * *****************************************************************************
5
 * Contributions to this work were made on behalf of the GÉANT project, a 
6
 * project that has received funding from the European Union’s Framework 
7
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
8
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
9
 * 691567 (GN4-1) and No. 731122 (GN4-2).
10
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
11
 * of the copyright in all material which was developed by a member of the GÉANT
12
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
13
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
14
 * UK as a branch of GÉANT Vereniging.
15
 * 
16
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
17
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
18
 *
19
 * License: see the web/copyright.inc.php file in the file structure or
20
 *          <base_url>/copyright.php after deploying the software
21
 */
22
23
/**
24
 * This file contains the AbstractProfile class. It contains common methods for
25
 * both RADIUS/EAP profiles and SilverBullet profiles
26
 *
27
 * @author Stefan Winter <[email protected]>
28
 * @author Tomasz Wolniewicz <[email protected]>
29
 *
30
 * @package Developer
31
 *
32
 */
33
34
namespace core;
35
36
use \Exception;
37
38
/**
39
 * This class represents an EAP Profile.
40
 * Profiles can inherit attributes from their IdP, if the IdP has some. Otherwise,
41
 * one can set attribute in the Profile directly. If there is a conflict between
42
 * IdP-wide and Profile-wide attributes, the more specific ones (i.e. Profile) win.
43
 * 
44
 * @author Stefan Winter <[email protected]>
45
 * @author Tomasz Wolniewicz <[email protected]>
46
 *
47
 * @license see LICENSE file in root directory
48
 *
49
 * @package Developer
50
 */
51
class DeploymentClassic extends AbstractDeployment
52
{
53
54
    /**
55
     * Class constructor for existing deployments (use 
56
     * IdP::newDeployment() to actually create one). Retrieves all 
57
     * attributes from the DB and stores them in the priv_ arrays.
58
     * 
59
     * @param IdP        $idpObject       optionally, the institution to which this Profile belongs. Saves the construction of the IdP instance. If omitted, an extra query and instantiation is executed to find out.
60
     * @param string|int $deploymentIdRaw identifier of the deployment in the DB, or 
61
     */
62
    public function __construct($idpObject, $deploymentIdRaw = NULL)
63
    {
64
        parent::__construct($idpObject, $deploymentIdRaw); // we now have access to our INST database handle and logging
65
        $this->type = AbstractDeployment::DEPLOYMENTTYPE_MANAGED;
66
        // TODO we need to extract the SP's relevant information from the eduroam DB
67
        $propertyQuery = "SELECT ... FROM ... WHERE ...";
68
        $queryExec = $this->databaseHandle->exec($propertyQuery);
69
        while ($iterator = mysqli_fetch_object(/** @scrutinizer ignore-type */ $queryExec)) {
70
            $this->status = $iterator->status;
71
        }
72
    }
73
74
    /**
75
     * update the last_changed timestamp for this deployment
76
     * 
77
     * @return void
78
     */
79
    public function updateFreshness()
80
    {
81
        // we are always fresh - data comes from eduroam DB
82
    }
83
84
    /**
85
     * gets the last-modified timestamp (useful for caching "dirty" check)
86
     * 
87
     * @return string the date in string form, as returned by SQL
88
     */
89
    public function getFreshness()
90
    {
91
        // we are always fresh - data comes from eduroam DB
92
        $execLastChange = $this->databaseHandle->exec("SELECT NOW() as last_change");
93
        // SELECT always returns a resource, never a boolean
94
        if ($freshnessQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $execLastChange)) {
95
            return $freshnessQuery->last_change;
96
        }
97
    }
98
99
    /**
100
     * Deletes the deployment from database
101
     * 
102
     * @return void
103
     */
104
    public function remove()
105
    {
106
        // we can't delete data from the eduroam DB
107
    }
108
109
    /**
110
     * activates a deployment, but that is not how classic works
111
     * 
112
     * @return void
113
     */
114
    public function activate()
115
    {
116
        // nothing to be done, this is managed externally
117
    }
118
119
    /**
120
     * deactivates a deployment, but that is not how classic works
121
     * 
122
     * @return void
123
     */
124
    public function deactivate()
125
    {
126
        // nothing to be done, this is managed externally
127
    }
128
}