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 ( 6e9914...c0a34c )
by François
132:52 queued 82:40
created

ServerClient::enableClientCertificate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
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 disableUser($userId)
81
    {
82
        return $this->post('disable_user', ['user_id' => $userId]);
83
    }
84
85
    public function isDisabledUser($userId)
86
    {
87
        return $this->post('is_disabled_user', ['user_id' => $userId]);
88
    }
89
90
    public function disableClientCertificate($commonName)
91
    {
92
        return $this->post('disable_client_certificate', ['common_name' => $commonName]);
93
    }
94
95
    public function enableClientCertificate($commonName)
96
    {
97
        return $this->post('enable_client_certificate', ['common_name' => $commonName]);
98
    }
99
100
    public function killClient($commonName)
101
    {
102
        return $this->post('kill_client', ['common_name' => $commonName]);
103
    }
104
105
    public function profileInfo($profileId)
106
    {
107
        return $this->get('profile_info', ['profile_id' => $profileId]);
108
    }
109
110
//    public function userGroups($userId)
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
111
//    {
112
//        return $this->get('user_groups', ['user_id' => $userId]);
113
//    }
114
115
    public function motd()
116
    {
117
        return $this->get('motd');
118
    }
119
120
    public function setMotd($motdMessage)
121
    {
122
        return $this->post('set_motd', ['motd_message' => $motdMessage]);
123
    }
124
125
    public function deleteMotd()
126
    {
127
        return $this->post('delete_motd', []);
128
    }
129
130
    public function setVootToken($userId, $vootToken)
131
    {
132
        return $this->post(
133
            'set_voot_token',
134
            [
135
                'user_id' => $userId,
136
                'voot_token' => $vootToken,
137
            ]
138
        );
139
    }
140
141
    public function deleteOtpSecret($userId)
142
    {
143
        return $this->post('delete_otp_secret', ['user_id' => $userId]);
144
    }
145
146
//    public function setOtpSecret($userId, $otpSecret, $otpKey)
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
147
//    {
148
//        return $this->post(
149
//            'set_otp_secret',
150
//            [
151
//                'user_id' => $userId,
152
//                'otp_secret' => $otpSecret,
153
//                'otp_key' => $otpKey,
154
//            ]
155
//        );
156
//    }
157
158
//    public function verifyOtpKey($userId, $otpKey)
0 ignored issues
show
Unused Code Comprehensibility introduced by
49% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
159
//    {
160
//        return $this->post(
161
//            'verify_otp_key',
162
//            [
163
//                'user_id' => $userId,
164
//                'otp_key' => $otpKey,
165
//            ]
166
//        );
167
//    }
168
169
    public function connect($profileId, $commonName, $ip4, $ip6, $connectedAt)
170
    {
171
        return $this->post(
172
            'connect',
173
            [
174
                'profile_id' => $profileId,
175
                'common_name' => $commonName,
176
                'ip4' => $ip4,
177
                'ip6' => $ip6,
178
                'connected_at' => $connectedAt,
179
            ]
180
        );
181
    }
182
183
    public function disconnect($profileId, $commonName, $ip4, $ip6, $connectedAt, $disconnectedAt, $bytesTransferred)
184
    {
185
        return $this->post(
186
            'disconnect',
187
            [
188
                'profile_id' => $profileId,
189
                'common_name' => $commonName,
190
                'ip4' => $ip4,
191
                'ip6' => $ip6,
192
                'connected_at' => $connectedAt,
193
                'disconnected_at' => $disconnectedAt,
194
                'bytes_transferred' => $bytesTransferred,
195
            ]
196
        );
197
    }
198
}
199