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 ( b0d894...2cf1d1 )
by François
111:37 queued 102:37
created

ServerClient::userList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 profileList()
111
    {
112
        return $this->get('profile_list');
113
    }
114
115
    public function hasOtpSecret($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
116
    {
117
        // XXX not yet implemented
118
        return false;
119
    }
120
121
    public function userGroups($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
122
    {
123
        // XXX not yet implemented
124
        // return $this->get('user_groups', ['user_id' => $userId]);
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% 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...
125
126
        return [];
127
    }
128
129
    public function motd()
130
    {
131
        return $this->get('motd');
132
    }
133
134
    public function setMotd($motdMessage)
135
    {
136
        return $this->post('set_motd', ['motd_message' => $motdMessage]);
137
    }
138
139
    public function deleteMotd()
140
    {
141
        return $this->post('delete_motd', []);
142
    }
143
144
    public function setVootToken($userId, $vootToken)
145
    {
146
        return $this->post(
147
            'set_voot_token',
148
            [
149
                'user_id' => $userId,
150
                'voot_token' => $vootToken,
151
            ]
152
        );
153
    }
154
155
    public function deleteOtpSecret($userId)
156
    {
157
        return $this->post('delete_otp_secret', ['user_id' => $userId]);
158
    }
159
160
//    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...
161
//    {
162
//        return $this->post(
163
//            'set_otp_secret',
164
//            [
165
//                'user_id' => $userId,
166
//                'otp_secret' => $otpSecret,
167
//                'otp_key' => $otpKey,
168
//            ]
169
//        );
170
//    }
171
172
//    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...
173
//    {
174
//        return $this->post(
175
//            'verify_otp_key',
176
//            [
177
//                'user_id' => $userId,
178
//                'otp_key' => $otpKey,
179
//            ]
180
//        );
181
//    }
182
183
    public function connect($profileId, $commonName, $ip4, $ip6, $connectedAt)
184
    {
185
        return $this->post(
186
            'connect',
187
            [
188
                'profile_id' => $profileId,
189
                'common_name' => $commonName,
190
                'ip4' => $ip4,
191
                'ip6' => $ip6,
192
                'connected_at' => $connectedAt,
193
            ]
194
        );
195
    }
196
197
    public function disconnect($profileId, $commonName, $ip4, $ip6, $connectedAt, $disconnectedAt, $bytesTransferred)
198
    {
199
        return $this->post(
200
            'disconnect',
201
            [
202
                'profile_id' => $profileId,
203
                'common_name' => $commonName,
204
                'ip4' => $ip4,
205
                'ip6' => $ip6,
206
                'connected_at' => $connectedAt,
207
                'disconnected_at' => $disconnectedAt,
208
                'bytes_transferred' => $bytesTransferred,
209
            ]
210
        );
211
    }
212
}
213