GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 665fed...9a70b4 )
by François
02:35
created

ServerClient::disableUser()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
/**
3
 *  Copyright (C) 2016 SURFnet.
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as
7
 *  published by the Free Software Foundation, either version 3 of the
8
 *  License, or (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace SURFnet\VPN\Common\HttpClient;
20
21
class ServerClient extends BaseClient
22
{
23
    public function __construct(HttpClientInterface $httpClient, $baseUri)
24
    {
25
        parent::__construct($httpClient, $baseUri);
26
    }
27
28
    public function clientConnections()
29
    {
30
        return $this->get('client_connections');
31
    }
32
33
    public function log($dateTime, $ipAddress)
34
    {
35
        return $this->get(
36
            'log',
37
            [
38
                'date_time' => $dateTime,
39
                'ip_address' => $ipAddress,
40
            ]
41
        );
42
    }
43
44
    public function stats()
45
    {
46
        return $this->get('stats');
47
    }
48
49
    public function addClientCertificate($userId, $displayName)
50
    {
51
        return $this->post(
52
            'add_client_certificate',
53
            [
54
                'user_id' => $userId,
55
                'display_name' => $displayName,
56
            ]
57
        );
58
    }
59
60
    public function addServerCertificate($commonName)
61
    {
62
        return $this->post(
63
            'add_server_certificate',
64
            [
65
                'common_name' => $commonName,
66
            ]
67
        );
68
    }
69
70
    public function listClientCertificates($userId)
71
    {
72
        return $this->get('list_client_certificates', ['user_id' => $userId]);
73
    }
74
75
    public function enableUser($userId)
76
    {
77
        return $this->post('enable_user', ['user_id' => $userId]);
78
    }
79
80
    public function userList()
81
    {
82
        return $this->get('user_list');
83
    }
84
85
    public function disableUser($userId)
86
    {
87
        return $this->post('disable_user', ['user_id' => $userId]);
88
    }
89
90
    public function isDisabledUser($userId)
91
    {
92
        return $this->get('is_disabled_user', ['user_id' => $userId]);
93
    }
94
95
    public function disableClientCertificate($commonName)
96
    {
97
        return $this->post('disable_client_certificate', ['common_name' => $commonName]);
98
    }
99
100
    public function enableClientCertificate($commonName)
101
    {
102
        return $this->post('enable_client_certificate', ['common_name' => $commonName]);
103
    }
104
105
    public function killClient($commonName)
106
    {
107
        return $this->post('kill_client', ['common_name' => $commonName]);
108
    }
109
110
    public function instanceNumber()
111
    {
112
        return $this->get('instance_number');
113
    }
114
115
    public function profileList()
116
    {
117
        return $this->get('profile_list');
118
    }
119
120
    public function hasTotpSecret($userId)
121
    {
122
        return $this->get('has_totp_secret', ['user_id' => $userId]);
123
    }
124
125
    public function userGroups($userId)
126
    {
127
        return $this->get('user_groups', ['user_id' => $userId]);
128
    }
129
130
    public function motd()
131
    {
132
        return $this->get('motd');
133
    }
134
135
    public function setMotd($motdMessage)
136
    {
137
        return $this->post('set_motd', ['motd_message' => $motdMessage]);
138
    }
139
140
    public function deleteMotd()
141
    {
142
        return $this->post('delete_motd', []);
143
    }
144
145
    public function setVootToken($userId, $vootToken)
146
    {
147
        return $this->post(
148
            'set_voot_token',
149
            [
150
                'user_id' => $userId,
151
                'voot_token' => $vootToken,
152
            ]
153
        );
154
    }
155
156
    public function deleteTotpSecret($userId)
157
    {
158
        return $this->post('delete_totp_secret', ['user_id' => $userId]);
159
    }
160
161
    public function setTotpSecret($userId, $totpSecret, $totpKey)
162
    {
163
        return $this->post(
164
            'set_totp_secret',
165
            [
166
                'user_id' => $userId,
167
                'totp_secret' => $totpSecret,
168
                'totp_key' => $totpKey,
169
            ]
170
        );
171
    }
172
173
    public function verifyTotpKey($userId, $totpKey)
174
    {
175
        return $this->post(
176
            'verify_totp_key',
177
            [
178
                'user_id' => $userId,
179
                'totp_key' => $totpKey,
180
            ]
181
        );
182
    }
183
184
    public function connect($profileId, $commonName, $ip4, $ip6, $connectedAt)
185
    {
186
        return $this->post(
187
            'connect',
188
            [
189
                'profile_id' => $profileId,
190
                'common_name' => $commonName,
191
                'ip4' => $ip4,
192
                'ip6' => $ip6,
193
                'connected_at' => $connectedAt,
194
            ]
195
        );
196
    }
197
198
    public function disconnect($profileId, $commonName, $ip4, $ip6, $connectedAt, $disconnectedAt, $bytesTransferred)
199
    {
200
        return $this->post(
201
            'disconnect',
202
            [
203
                'profile_id' => $profileId,
204
                'common_name' => $commonName,
205
                'ip4' => $ip4,
206
                'ip6' => $ip6,
207
                'connected_at' => $connectedAt,
208
                'disconnected_at' => $disconnectedAt,
209
                'bytes_transferred' => $bytesTransferred,
210
            ]
211
        );
212
    }
213
}
214