@@ -211,7 +211,7 @@ |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!empty($this->attributes['internal:realm'][0])) { |
214 | - $config['user_realm'] = $this->attributes['internal:realm'][0]; |
|
214 | + $config['user_realm'] = $this->attributes['internal:realm'][0]; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | if(!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * |
55 | 55 | */ |
56 | 56 | public function writeInstaller() { |
57 | - $installerPath = $this->installerBasename . ".py"; |
|
57 | + $installerPath = $this->installerBasename.".py"; |
|
58 | 58 | $this->copyFile("main.py", $installerPath); |
59 | - $installer = fopen($installerPath,"a"); |
|
59 | + $installer = fopen($installerPath, "a"); |
|
60 | 60 | if ($installer === FALSE) { |
61 | 61 | throw new Exception("Unable to open installer file for writing!"); |
62 | 62 | } |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $out .= "<p>"; |
84 | 84 | if ($ssidCount > 1) { |
85 | 85 | if ($ssidCount > 2) { |
86 | - $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'])) . " "; |
|
86 | + $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to the following networks:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']))." "; |
|
87 | 87 | } else { |
88 | - $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid'])) . " "; |
|
88 | + $out .= sprintf(_("In addition to <strong>%s</strong> the installer will also configure access to:"), implode(', ', CONFIG_CONFASSISTANT['CONSORTIUM']['ssid']))." "; |
|
89 | 89 | } |
90 | 90 | $iterator = 0; |
91 | 91 | foreach ($this->attributes['internal:SSID'] as $ssid => $v) { |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | * @return void |
124 | 124 | */ |
125 | 125 | private function writeConfigLine($file, $prefix, $name, $text) { |
126 | - $out = $prefix . $name . ' = "' . $text; |
|
127 | - fwrite($file, wordwrap($out, 70, " \" \\\n \"") . "\n"); |
|
126 | + $out = $prefix.$name.' = "'.$text; |
|
127 | + fwrite($file, wordwrap($out, 70, " \" \\\n \"")."\n"); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'user_cert_missing' => _("personal certificate file not found"), |
164 | 164 | ]; |
165 | 165 | foreach ($messages as $name => $value) { |
166 | - $this->writeConfigLine($file, 'Messages.', $name, $value . '"'); |
|
166 | + $this->writeConfigLine($file, 'Messages.', $name, $value.'"'); |
|
167 | 167 | } |
168 | 168 | \core\common\Entity::outOfThePotatoes(); |
169 | 169 | } |
@@ -207,39 +207,39 @@ discard block |
||
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($outerId !== NULL) { |
210 | - $configRaw['anonymous_identity'] = '"' . $outerId . '"'; |
|
210 | + $configRaw['anonymous_identity'] = '"'.$outerId.'"'; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | if (!empty($this->attributes['internal:realm'][0])) { |
214 | 214 | $config['user_realm'] = $this->attributes['internal:realm'][0]; |
215 | 215 | } |
216 | 216 | |
217 | - if(!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
|
217 | + if (!empty($this->attributes['internal:hint_userinput_suffix'][0]) && $this->attributes['internal:hint_userinput_suffix'][0] == 1) { |
|
218 | 218 | $configRaw['hint_user_input'] = "True"; |
219 | 219 | } |
220 | 220 | |
221 | - if(!empty($this->attributes['internal:verify_userinput_suffix'][0]) && $this->attributes['internal:verify_userinput_suffix'][0] == 1) { |
|
221 | + if (!empty($this->attributes['internal:verify_userinput_suffix'][0]) && $this->attributes['internal:verify_userinput_suffix'][0] == 1) { |
|
222 | 222 | $configRaw['verify_user_realm_input'] = "True"; |
223 | 223 | } |
224 | 224 | |
225 | 225 | foreach ($config as $name => $value) { |
226 | - $this->writeConfigLine($file, 'Config.', $name, $value . '"'); |
|
226 | + $this->writeConfigLine($file, 'Config.', $name, $value.'"'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | foreach ($configRaw as $name => $value) { |
230 | - fwrite($file, 'Config.' . $name . ' = ' . $value . "\n"); |
|
230 | + fwrite($file, 'Config.'.$name.' = '.$value."\n"); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | if ($tou === '') { |
234 | - fwrite($file, 'Config.tou = ""' . "\n"); |
|
234 | + fwrite($file, 'Config.tou = ""'."\n"); |
|
235 | 235 | } else { |
236 | - fwrite($file, 'Config.tou = """' . $tou . '"""' . "\n"); |
|
236 | + fwrite($file, 'Config.tou = """'.$tou.'"""'."\n"); |
|
237 | 237 | } |
238 | 238 | |
239 | - fwrite($file, 'Config.CA = """' . $this->mkCAfile() . '"""' . "\n"); |
|
239 | + fwrite($file, 'Config.CA = """'.$this->mkCAfile().'"""'."\n"); |
|
240 | 240 | $sbUserFile = $this->mkSbUserFile(); |
241 | 241 | if ($sbUserFile !== '') { |
242 | - fwrite($file, 'Config.sb_user_file = """' . $sbUserFile . '"""' . "\n"); |
|
242 | + fwrite($file, 'Config.sb_user_file = """'.$sbUserFile.'"""'."\n"); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | $out .= "'DNS:$oneServer'"; |
293 | 293 | } |
294 | - return "[" . $out. "]"; |
|
294 | + return "[".$out."]"; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | foreach ($ssids as $ssid => $cipher) { |
306 | 306 | $outArray[] = "'$ssid'"; |
307 | 307 | } |
308 | - return '[' . implode(', ', $outArray) . ']'; |
|
308 | + return '['.implode(', ', $outArray).']'; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $outArray[] = "'$ssid'"; |
322 | 322 | } |
323 | 323 | } |
324 | - return '[' . implode(', ', $outArray) . ']'; |
|
324 | + return '['.implode(', ', $outArray).']'; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return string |
331 | 331 | */ |
332 | - private function mkCAfile(){ |
|
332 | + private function mkCAfile() { |
|
333 | 333 | $out = ''; |
334 | 334 | $cAlist = $this->attributes['internal:CAs'][0]; |
335 | 335 | foreach ($cAlist as $oneCa) { |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | */ |
346 | 346 | private function mkIntro() { |
347 | 347 | \core\common\Entity::intoThePotatoes(); |
348 | - $out = _("This installer has been prepared for {0}") . '\n\n' . _("More information and comments:") . '\n\nEMAIL: {1}\nWWW: {2}\n\n' . |
|
348 | + $out = _("This installer has been prepared for {0}").'\n\n'._("More information and comments:").'\n\nEMAIL: {1}\nWWW: {2}\n\n'. |
|
349 | 349 | _("Installer created with software from the GEANT project."); |
350 | 350 | \core\common\Entity::outOfThePotatoes(); |
351 | 351 | return $out; |
@@ -201,8 +201,7 @@ |
||
201 | 201 | |
202 | 202 | if ($this->selectedEap == \core\common\EAP::EAPTYPE_TLS && isset($this->attributes['eap-specific:tls_use_other_id']) && $this->attributes['eap-specific:tls_use_other_id'][0] == 'on') { |
203 | 203 | $configRaw['use_other_tls_id'] = "True"; |
204 | - } |
|
205 | - else { |
|
204 | + } else { |
|
206 | 205 | $configRaw['use_other_tls_id'] = "False"; |
207 | 206 | } |
208 | 207 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | * @author Stefan Winter <[email protected]> |
26 | 26 | * @package Core |
27 | 27 | */ |
28 | -require_once dirname(dirname(__FILE__)) . "/config/_config.php"; |
|
28 | +require_once dirname(dirname(__FILE__))."/config/_config.php"; |
|
29 | 29 | |
30 | 30 | $Gui = new \web\lib\user\Gui(); |
31 | 31 | // ... unless overwritten by direct GET/POST parameter in the request or a SESSION setting |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } else { |
147 | 147 | $this->databaseHandle->exec("INSERT INTO ownership (user_id, institution_id, blesslevel, orig_mail) VALUES(?, ?, ?, ?)", "siss", $owner, $catId, $level, $destMail); |
148 | 148 | } |
149 | - $this->loggerInstance->writeAudit((string) $owner, "OWN", "IdP " . $invitationDetails->cat_institution_id . " - added user as owner"); |
|
149 | + $this->loggerInstance->writeAudit((string) $owner, "OWN", "IdP ".$invitationDetails->cat_institution_id." - added user as owner"); |
|
150 | 150 | common\Entity::outOfThePotatoes(); |
151 | 151 | return new IdP($invitationDetails->cat_institution_id); |
152 | 152 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $idp = new IdP($fed->newIdP($owner, $invitationDetails->invite_issuer_level, $invitationDetails->invite_dest_mail, $bestnameguess)); |
169 | 169 | } |
170 | 170 | $idp->addAttribute("general:instname", 'C', $bestnameguess); |
171 | - $this->loggerInstance->writeAudit($owner, "NEW", "IdP " . $idp->identifier . " - created from invitation"); |
|
171 | + $this->loggerInstance->writeAudit($owner, "NEW", "IdP ".$idp->identifier." - created from invitation"); |
|
172 | 172 | |
173 | 173 | // in case we have more admins in the queue which were invited to |
174 | 174 | // administer the same inst but haven't redeemed their invitations |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | WHERE invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0 AND name = ? AND country = ? AND ( cat_institution_id IS NULL OR external_db_uniquehandle IS NULL ) ", "ss", $invitationDetails->name, $invitationDetails->country); |
183 | 183 | // SELECT -> resource, no boolean |
184 | 184 | while ($pendingDetail = mysqli_fetch_object(/** @scrutinizer ignore-type */ $otherPending)) { |
185 | - $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = " . $idp->identifier . " WHERE id = " . $pendingDetail->id); |
|
185 | + $this->databaseHandle->exec("UPDATE invitations SET cat_institution_id = ".$idp->identifier." WHERE id = ".$pendingDetail->id); |
|
186 | 186 | } |
187 | 187 | common\Entity::outOfThePotatoes(); |
188 | 188 | return $idp; |
@@ -276,9 +276,9 @@ discard block |
||
276 | 276 | $retval = []; |
277 | 277 | $invitations = $this->databaseHandle->exec("SELECT cat_institution_id, country, name, invite_issuer_level, invite_dest_mail, invite_token , TIMESTAMPADD(DAY, 1, invite_created) as expiry |
278 | 278 | FROM invitations |
279 | - WHERE cat_institution_id " . ( $idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL") . " AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0"); |
|
279 | + WHERE cat_institution_id " . ($idpIdentifier != 0 ? "= $idpIdentifier" : "IS NULL")." AND invite_created >= TIMESTAMPADD(DAY, -1, NOW()) AND used = 0"); |
|
280 | 280 | // SELECT -> resource, not boolean |
281 | - $this->loggerInstance->debug(4, "Retrieving pending invitations for " . ($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation" ) . ".\n"); |
|
281 | + $this->loggerInstance->debug(4, "Retrieving pending invitations for ".($idpIdentifier != 0 ? "IdP $idpIdentifier" : "IdPs awaiting initial creation").".\n"); |
|
282 | 282 | while ($invitationQuery = mysqli_fetch_object(/** @scrutinizer ignore-type */ $invitations)) { |
283 | 283 | $retval[] = ["country" => $invitationQuery->country, "name" => $invitationQuery->name, "mail" => $invitationQuery->invite_dest_mail, "token" => $invitationQuery->invite_token, "expiry" => $invitationQuery->expiry]; |
284 | 284 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @author Stefan Winter <[email protected]> |
28 | 28 | * @package UserGUI |
29 | 29 | */ |
30 | -require dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
30 | +require dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
31 | 31 | $API = new \core\UserAPI(); |
32 | 32 | $loggerInstance = new \core\common\Logging(); |
33 | 33 | $validator = new \web\lib\common\InputValidation(); |
@@ -76,5 +76,5 @@ discard block |
||
76 | 76 | if ($accountPageUrl === FALSE) { |
77 | 77 | throw new Exception("Unable to find our accountstatus.php page."); |
78 | 78 | } |
79 | - header("Location: ../accountstatus/accountstatus.php?token=" . $cleanToken . "&errorcode=GENERATOR_CONSUMED"); |
|
79 | + header("Location: ../accountstatus/accountstatus.php?token=".$cleanToken."&errorcode=GENERATOR_CONSUMED"); |
|
80 | 80 | } |
81 | 81 | \ No newline at end of file |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | */ |
27 | 27 | ?> |
28 | 28 | <?php |
29 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
30 | -require_once dirname(dirname(dirname(__FILE__))) . "/core/phpqrcode.php"; |
|
29 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
30 | +require_once dirname(dirname(dirname(__FILE__)))."/core/phpqrcode.php"; |
|
31 | 31 | |
32 | 32 | |
33 | 33 | $deco = new \web\lib\admin\PageDecoration(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } else { |
41 | 41 | $link = 'http://'; |
42 | 42 | } |
43 | -$link .= $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME']; |
|
43 | +$link .= $_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']; |
|
44 | 44 | $link = htmlspecialchars($link); |
45 | 45 | |
46 | 46 | const QRCODE_PIXELS_PER_SYMBOL = 12; |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | <div class='infobox' style='text-align:center;'> |
77 | 77 | <h2><?php echo sprintf(_("%s download area QR code"), $uiElements->nomenclatureInst); ?></h2> |
78 | 78 | <?php |
79 | - $idpLevelUrl = ( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] . dirname(dirname($_SERVER['SCRIPT_NAME'])) . "?idp=" . $my_inst->identifier; |
|
79 | + $idpLevelUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://').$_SERVER['SERVER_NAME'].dirname(dirname($_SERVER['SCRIPT_NAME']))."?idp=".$my_inst->identifier; |
|
80 | 80 | // never NULL, because $filename is FALSE; but make Scrutinizer happy |
81 | 81 | $rawQr = QRcode::png($idpLevelUrl, FALSE, QR_ECLEVEL_Q, QRCODE_PIXELS_PER_SYMBOL); |
82 | 82 | if ($rawQr === NULL) { |
83 | 83 | throw new Exception("Something went seriously wrong during QR code generation!"); |
84 | 84 | } |
85 | - $uri = "data:image/png;base64," . base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, QRCODE_PIXELS_PER_SYMBOL)); |
|
85 | + $uri = "data:image/png;base64,".base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, QRCODE_PIXELS_PER_SYMBOL)); |
|
86 | 86 | $size = getimagesize($uri); |
87 | - echo "<img width='" . ($size[0] / 4) . "' height='" . ($size[1] / 4) . "' src='$uri' alt='QR-code'/>"; |
|
87 | + echo "<img width='".($size[0] / 4)."' height='".($size[1] / 4)."' src='$uri' alt='QR-code'/>"; |
|
88 | 88 | ?> |
89 | 89 | <br> |
90 | 90 | <?php echo "<a href='$idpLevelUrl'>$idpLevelUrl</a>"; ?> |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | </td> |
114 | 114 | <td> |
115 | 115 | <form action='edit_idp_result.php?inst_id=<?php echo $my_inst->identifier; ?>' method='post' accept-charset='UTF-8'> |
116 | - <button class='delete' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php echo ( CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'] === NULL ? sprintf(_("After deleting the %s, you can not recreate it yourself - you need a new invitation token from the %s administrator!"), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed) . " " : "" ) . sprintf(_("Do you really want to delete your %s %s?"), $uiElements->nomenclatureInst, $my_inst->name); ?>')"><?php echo sprintf(_("Delete %s"), $uiElements->nomenclatureInst); ?></button> |
|
116 | + <button class='delete' type='submit' name='submitbutton' value='<?php echo web\lib\common\FormElements::BUTTON_DELETE; ?>' onclick="return confirm('<?php echo (CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration'] === NULL ? sprintf(_("After deleting the %s, you can not recreate it yourself - you need a new invitation token from the %s administrator!"), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed)." " : "").sprintf(_("Do you really want to delete your %s %s?"), $uiElements->nomenclatureInst, $my_inst->name); ?>')"><?php echo sprintf(_("Delete %s"), $uiElements->nomenclatureInst); ?></button> |
|
117 | 117 | </form> |
118 | 118 | |
119 | 119 | </td> |
@@ -134,21 +134,21 @@ discard block |
||
134 | 134 | <?php |
135 | 135 | if (CONFIG['FUNCTIONALITY_LOCATIONS']['DIAGNOSTICS'] !== NULL) { |
136 | 136 | echo "<tr> |
137 | - <td>" . _("Check another realm's reachability") . "</td> |
|
137 | + <td>" . _("Check another realm's reachability")."</td> |
|
138 | 138 | <td><form method='post' action='../diag/action_realmcheck.php?inst_id=$my_inst->identifier' accept-charset='UTF-8'> |
139 | 139 | <input type='text' name='realm' id='realm'> |
140 | 140 | <input type='hidden' name='comefrom' id='comefrom' value='$link'/> |
141 | - <button type='submit'>" . _("Go!") . "</button> |
|
141 | + <button type='submit'>"._("Go!")."</button> |
|
142 | 142 | </form> |
143 | 143 | </td> |
144 | 144 | </tr>"; |
145 | 145 | } |
146 | 146 | if (CONFIG_CONFASSISTANT['CONSORTIUM']['name'] == "eduroam") { // SW: APPROVED |
147 | 147 | echo "<tr> |
148 | - <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed) . "</td> |
|
148 | + <td>" . sprintf(_("Check %s server status"), $uiElements->nomenclatureFed)."</td> |
|
149 | 149 | <td> |
150 | 150 | <form action='https://monitor.eduroam.org/mon_direct.php' accept-charset='UTF-8'> |
151 | - <button type='submit'>" . _("Go!") . "</button> |
|
151 | + <button type='submit'>" . _("Go!")."</button> |
|
152 | 152 | </form> |
153 | 153 | </td> |
154 | 154 | </tr>"; |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | <?php |
160 | 160 | $profiles_for_this_idp = $my_inst->listProfiles(); |
161 | 161 | if (count($profiles_for_this_idp) == 0) { // no profiles yet. |
162 | - echo "<h2>" . sprintf(_("There are not yet any profiles for your %s."), $uiElements->nomenclatureInst) . "</h2>"; |
|
162 | + echo "<h2>".sprintf(_("There are not yet any profiles for your %s."), $uiElements->nomenclatureInst)."</h2>"; |
|
163 | 163 | } |
164 | 164 | if (count($profiles_for_this_idp) > 0) { // no profiles yet. |
165 | - echo "<h2>" . sprintf(_("Profiles for this %s"), $uiElements->nomenclatureInst) . "</h2>"; |
|
165 | + echo "<h2>".sprintf(_("Profiles for this %s"), $uiElements->nomenclatureInst)."</h2>"; |
|
166 | 166 | } |
167 | 167 | // if there is one profile and it is of type Silver Bullet, display a very |
168 | 168 | // simple widget with just a "Manage" button |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | echo _("Information needed!"); |
189 | 189 | echo "<ul style='margin:1px'>"; |
190 | 190 | foreach ($completeness as $missing_attrib) { |
191 | - echo "<li>" . $uiElements->displayName($missing_attrib) . "</li>"; |
|
191 | + echo "<li>".$uiElements->displayName($missing_attrib)."</li>"; |
|
192 | 192 | } |
193 | 193 | echo "</ul>"; |
194 | 194 | echo "</div>"; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | if ($readonly === FALSE) { |
203 | 203 | ?> |
204 | 204 | <form action='edit_silverbullet.php?inst_id=<?php echo $my_inst->identifier; ?>&profile_id=<?php echo $profile_list->identifier; ?>' method='POST'> |
205 | - <button <?php echo ( is_array($completeness) ? "disabled" : "" ); ?> type='submit' name='sb_action' value='sb_edit'><?php echo _("Manage User Base"); ?></button> |
|
205 | + <button <?php echo (is_array($completeness) ? "disabled" : ""); ?> type='submit' name='sb_action' value='sb_edit'><?php echo _("Manage User Base"); ?></button> |
|
206 | 206 | </form> |
207 | 207 | <?php |
208 | 208 | } |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | $has_overrides = TRUE; |
235 | 235 | } |
236 | 236 | } |
237 | - $buffer_eaptypediv = "<div style='margin-bottom:40px; float:left;'>" . _("<strong>EAP Types</strong> (in order of preference):") . "<br/>"; |
|
237 | + $buffer_eaptypediv = "<div style='margin-bottom:40px; float:left;'>"._("<strong>EAP Types</strong> (in order of preference):")."<br/>"; |
|
238 | 238 | $typelist = $profile_list->getEapMethodsinOrderOfPreference(); |
239 | 239 | $allcomplete = TRUE; |
240 | 240 | foreach ($typelist as $eaptype) { |
241 | 241 | $buffer_eaptypediv .= $eaptype->getPrintableRep(); |
242 | 242 | $completeness = $profile_list->isEapTypeDefinitionComplete($eaptype); |
243 | 243 | if ($completeness === true) { |
244 | - $buffer_eaptypediv .= " <div class='acceptable'>" . _("OK") . "</div>"; |
|
244 | + $buffer_eaptypediv .= " <div class='acceptable'>"._("OK")."</div>"; |
|
245 | 245 | } else { |
246 | 246 | $buffer_eaptypediv .= " <div class='notacceptable'>"; |
247 | 247 | $buffer_eaptypediv .= _("Information needed!"); |
248 | 248 | if (is_array($completeness)) { |
249 | 249 | $buffer_eaptypediv .= "<ul style='margin:1px'>"; |
250 | 250 | foreach ($completeness as $missing_attrib) { |
251 | - $buffer_eaptypediv .= "<li>" . $uiElements->displayName($missing_attrib) . "</li>"; |
|
251 | + $buffer_eaptypediv .= "<li>".$uiElements->displayName($missing_attrib)."</li>"; |
|
252 | 252 | } |
253 | 253 | $buffer_eaptypediv .= "</ul>"; |
254 | 254 | } |
@@ -260,12 +260,12 @@ discard block |
||
260 | 260 | foreach ($attribs as $attrib) { |
261 | 261 | if ($attrib['level'] == "Method" && !preg_match("/^internal:/", $attrib['name']) && !$justOnce) { |
262 | 262 | $justOnce = TRUE; |
263 | - $buffer_eaptypediv .= "<img src='../resources/images/icons/Letter-E-blue-icon.png' alt='" . _("Options on EAP Method/Device level are in effect.") . "'>"; |
|
263 | + $buffer_eaptypediv .= "<img src='../resources/images/icons/Letter-E-blue-icon.png' alt='"._("Options on EAP Method/Device level are in effect.")."'>"; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | $buffer_eaptypediv .= "<br/>"; |
267 | 267 | } |
268 | - $buffer_headline = "<div style='padding-bottom:20px;'><h2 style='overflow:auto; display:inline; padding-bottom: 10px;'>" . sprintf(_("Profile: %s"), $profile_name) . "</h2>"; |
|
268 | + $buffer_headline = "<div style='padding-bottom:20px;'><h2 style='overflow:auto; display:inline; padding-bottom: 10px;'>".sprintf(_("Profile: %s"), $profile_name)."</h2>"; |
|
269 | 269 | |
270 | 270 | $buffer_headline .= "<span style='float:right;'>"; |
271 | 271 | $readiness = $profile_list->readinessLevel(); |
@@ -297,18 +297,18 @@ discard block |
||
297 | 297 | if (CONFIG['FUNCTIONALITY_LOCATIONS']['DIAGNOSTICS'] == "LOCAL") { |
298 | 298 | $diagUrl = "../diag/"; |
299 | 299 | } else { |
300 | - $diagUrl = CONFIG['FUNCTIONALITY_LOCATIONS']['DIAGNOSTICS'] . "/diag/"; |
|
300 | + $diagUrl = CONFIG['FUNCTIONALITY_LOCATIONS']['DIAGNOSTICS']."/diag/"; |
|
301 | 301 | } |
302 | - echo "<form action='" . $diagUrl . "action_realmcheck.php?inst_id=$my_inst->identifier&profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'> |
|
302 | + echo "<form action='".$diagUrl."action_realmcheck.php?inst_id=$my_inst->identifier&profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'> |
|
303 | 303 | <input type='hidden' name='comefrom' id='comefrom-$profilecount' value='$link'/> |
304 | - <button type='submit' name='profile_action' value='check' " . ($has_realm ? "" : "disabled='disabled' title='" . _("The realm can only be checked if you configure the realm!") . "'") . "> |
|
305 | - " . _("Check realm reachability") . " |
|
304 | + <button type='submit' name='profile_action' value='check' ".($has_realm ? "" : "disabled='disabled' title='"._("The realm can only be checked if you configure the realm!")."'")."> |
|
305 | + " . _("Check realm reachability")." |
|
306 | 306 | </button> |
307 | 307 | </form>"; |
308 | 308 | } |
309 | 309 | echo "<form action='overview_installers.php?inst_id=$my_inst->identifier&profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'> |
310 | - <button type='submit' name='profile_action' value='check' " . ($has_eaptypes ? "" : "disabled='disabled' title='" . _("You have not fully configured any supported EAP types!") . "'") . "> |
|
311 | - " . _("Installer Fine-Tuning and Download") . " |
|
310 | + <button type='submit' name='profile_action' value='check' ".($has_eaptypes ? "" : "disabled='disabled' title='"._("You have not fully configured any supported EAP types!")."'")."> |
|
311 | + " . _("Installer Fine-Tuning and Download")." |
|
312 | 312 | </button> |
313 | 313 | </form> |
314 | 314 | </div>"; |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | echo " <div class='buttongroupprofilebox' style='clear:both;'> |
318 | 318 | <form action='edit_profile.php?inst_id=$my_inst->identifier&profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'> |
319 | 319 | <hr/> |
320 | - <button type='submit' name='profile_action' value='edit'>" . _("Edit") . "</button> |
|
320 | + <button type='submit' name='profile_action' value='edit'>"._("Edit")."</button> |
|
321 | 321 | </form> |
322 | 322 | <form action='edit_profile_result.php?inst_id=$my_inst->identifier&profile_id=$profile_list->identifier' method='post' accept-charset='UTF-8'> |
323 | - <button class='delete' type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_DELETE . "' onclick=\"return confirm('" . sprintf(_("Do you really want to delete the profile %s?"), $profile_name) . "')\"> |
|
324 | - " . _("Delete") . " |
|
323 | + <button class='delete' type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_DELETE."' onclick=\"return confirm('".sprintf(_("Do you really want to delete the profile %s?"), $profile_name)."')\"> |
|
324 | + " . _("Delete")." |
|
325 | 325 | </button> |
326 | 326 | </form> |
327 | 327 | </div>"; |
@@ -330,24 +330,24 @@ discard block |
||
330 | 330 | // dummy width to keep a little distance |
331 | 331 | echo "<div style='width:20px;'></div>"; |
332 | 332 | if ($readiness == core\AbstractProfile::READINESS_LEVEL_SHOWTIME) { |
333 | - echo "<div style='display: table-cell; text-align:center;'><p><strong>" . _("User Download Link") . "</strong></p>"; |
|
334 | - $displayurl = $idpLevelUrl . "&profile=" . $profile_list->identifier; |
|
335 | - $QRurl = $idpLevelUrl . "&profile=" . $profile_list->identifier; |
|
333 | + echo "<div style='display: table-cell; text-align:center;'><p><strong>"._("User Download Link")."</strong></p>"; |
|
334 | + $displayurl = $idpLevelUrl."&profile=".$profile_list->identifier; |
|
335 | + $QRurl = $idpLevelUrl."&profile=".$profile_list->identifier; |
|
336 | 336 | echo "<a href='$displayurl' style='white-space: nowrap; text-align: center;'>"; |
337 | 337 | $rawQr = QRcode::png($QRurl, FALSE, QR_ECLEVEL_Q, QRCODE_PIXELS_PER_SYMBOL); |
338 | 338 | if ($rawQr === NULL) { |
339 | 339 | throw new Exception("Something went seriously wrong during QR code generation!"); |
340 | 340 | } |
341 | - $uri = "data:image/png;base64," . base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, QRCODE_PIXELS_PER_SYMBOL)); |
|
341 | + $uri = "data:image/png;base64,".base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, QRCODE_PIXELS_PER_SYMBOL)); |
|
342 | 342 | $size = getimagesize($uri); |
343 | - echo "<img width='" . ($size[0] / 4) . "' height='" . ($size[1] / 4) . "' src='$uri' alt='QR-code'/>"; |
|
343 | + echo "<img width='".($size[0] / 4)."' height='".($size[1] / 4)."' src='$uri' alt='QR-code'/>"; |
|
344 | 344 | |
345 | 345 | //echo "<nobr>$displayurl</nobr></a>"; |
346 | 346 | echo "<p>$displayurl</p></a>"; |
347 | 347 | echo "</div>"; |
348 | 348 | // dummy width to keep a little distance |
349 | 349 | echo "<div style='width:20px;'></div>"; |
350 | - echo "<div style='display: table-cell; min-width:200px;'><p><strong>" . _("User Downloads") . "</strong></p><table>"; |
|
350 | + echo "<div style='display: table-cell; min-width:200px;'><p><strong>"._("User Downloads")."</strong></p><table>"; |
|
351 | 351 | $stats = $profile_list->getUserDownloadStats(); |
352 | 352 | foreach ($stats as $dev => $count) { |
353 | 353 | echo "<tr><td><strong>$dev</strong></td><td>$count</td></tr>"; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * <base_url>/copyright.php after deploying the software |
20 | 20 | */ |
21 | 21 | |
22 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
22 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
23 | 23 | |
24 | 24 | $Tests = [ |
25 | 25 | 'cat_base_url', |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'mailer', |
38 | 38 | ]; |
39 | 39 | |
40 | -if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL" ) { |
|
40 | +if (CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_SILVERBULLET'] == "LOCAL" || CONFIG['FUNCTIONALITY_LOCATIONS']['CONFASSISTANT_RADIUS'] == "LOCAL") { |
|
41 | 41 | $Tests[] = 'makensis'; |
42 | 42 | $Tests[] = 'makensis=>NSISmodules'; |
43 | 43 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | $message = "Your configuration appears to be fine."; |
72 | 72 | break; |
73 | 73 | default: |
74 | - throw new Exception("The result code level " . $test->test_result['global'] . " is not defined!"); |
|
74 | + throw new Exception("The result code level ".$test->test_result['global']." is not defined!"); |
|
75 | 75 | } |
76 | 76 | $uiElements = new web\lib\admin\UIElements(); |
77 | - $out .= $uiElements->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>" . $message . "<br>See below for details<br><hr>"); |
|
77 | + $out .= $uiElements->boxFlexible($test->test_result['global'], "<br><strong>Test Summary</strong><br>".$message."<br>See below for details<br><hr>"); |
|
78 | 78 | foreach ($test->out as $testValue) { |
79 | 79 | foreach ($testValue as $o) { |
80 | 80 | $out .= $uiElements->boxFlexible($o['level'], $o['message']); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * <base_url>/copyright.php after deploying the software |
21 | 21 | */ |
22 | 22 | |
23 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
23 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Checks if the profile is a valid SB profile belonging to the federation |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $inputRaw = file_get_contents('php://input'); |
70 | 70 | $inputDecoded = json_decode($inputRaw, TRUE); |
71 | 71 | if (!is_array($inputDecoded)) { |
72 | - $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data." . json_last_error_msg() . $inputRaw); |
|
72 | + $adminApi->returnError(web\lib\admin\API::ERROR_MALFORMED_REQUEST, "Unable to decode JSON POST data.".json_last_error_msg().$inputRaw); |
|
73 | 73 | exit(1); |
74 | 74 | } |
75 | 75 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | throw new Exception("A required parameter is missing, and this wasn't caught earlier?!"); |
159 | 159 | } |
160 | 160 | $newtokens = $mgmt->createTokens(true, [$admin], $idp); |
161 | - $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0]; |
|
161 | + $URL = "https://".$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME'])."/action_enrollment.php?token=".array_keys($newtokens)[0]; |
|
162 | 162 | $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]]; |
163 | 163 | // done with the essentials - display in response. But if we also have an email address, send it there |
164 | 164 | $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | if ($found) { |
196 | 196 | $adminApi->returnSuccess([]); |
197 | 197 | } |
198 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier); |
|
198 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP ".$idp->identifier); |
|
199 | 199 | break; |
200 | 200 | case web\lib\admin\API::ACTION_STATISTICS_FED: |
201 | 201 | $adminApi->returnSuccess($fed->downloadStats("array")); |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | $outer = ""; |
243 | 243 | $profile->setAnonymousIDSupport(FALSE); |
244 | 244 | } else { |
245 | - $outer = $outer . "@"; |
|
245 | + $outer = $outer."@"; |
|
246 | 246 | $profile->setAnonymousIDSupport(TRUE); |
247 | 247 | } |
248 | - $profile->setRealm($outer . $realm); |
|
248 | + $profile->setRealm($outer.$realm); |
|
249 | 249 | } |
250 | 250 | /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */ |
251 | 251 | $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER); |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | // extract relevant subset of information from cert objects |
474 | 474 | $certDetails = []; |
475 | 475 | foreach ($certs as $cert) { |
476 | - $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation]; |
|
476 | + $certDetails[$cert->ca_type.":".$cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation]; |
|
477 | 477 | } |
478 | 478 | $adminApi->returnSuccess($certDetails); |
479 | 479 | break; |
@@ -417,7 +417,7 @@ |
||
417 | 417 | $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
418 | 418 | $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME); |
419 | 419 | $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
420 | - $certCN = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTCN); |
|
420 | + $certCN = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTCN); |
|
421 | 421 | if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE && $certCN === FALSE) { |
422 | 422 | // we need at least one of those |
423 | 423 | $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, certificate serial, or certificate CN is required."); |
@@ -115,213 +115,213 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | switch ($inputDecoded['ACTION']) { |
118 | - case web\lib\admin\API::ACTION_NEWINST: |
|
119 | - // create the inst, no admin, no attributes |
|
120 | - $idp = new \core\IdP($fed->newIdP("PENDING", "API")); |
|
121 | - // now add all submitted attributes |
|
122 | - $inputs = $adminApi->uglify($scrubbedParameters); |
|
123 | - $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]); |
|
124 | - $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]); |
|
125 | - break; |
|
126 | - case web\lib\admin\API::ACTION_DELINST: |
|
127 | - try { |
|
128 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
129 | - } catch (Exception $e) { |
|
130 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
131 | - exit(1); |
|
132 | - } |
|
133 | - $idp->destroy(); |
|
134 | - $adminApi->returnSuccess([]); |
|
135 | - break; |
|
136 | - case web\lib\admin\API::ACTION_ADMIN_LIST: |
|
137 | - try { |
|
138 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
139 | - } catch (Exception $e) { |
|
140 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
141 | - exit(1); |
|
142 | - } |
|
143 | - $adminApi->returnSuccess($idp->listOwners()); |
|
144 | - break; |
|
145 | - case web\lib\admin\API::ACTION_ADMIN_ADD: |
|
146 | - // IdP in question |
|
147 | - try { |
|
148 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
149 | - } catch (Exception $e) { |
|
150 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
151 | - exit(1); |
|
152 | - } |
|
153 | - // here is the token |
|
154 | - $mgmt = new core\UserManagement(); |
|
155 | - // we know we have an admin ID but scrutinizer wants this checked more explicitly |
|
156 | - $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID); |
|
157 | - if ($admin === FALSE) { |
|
158 | - throw new Exception("A required parameter is missing, and this wasn't caught earlier?!"); |
|
159 | - } |
|
160 | - $newtokens = $mgmt->createTokens(true, [$admin], $idp); |
|
161 | - $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0]; |
|
162 | - $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]]; |
|
163 | - // done with the essentials - display in response. But if we also have an email address, send it there |
|
164 | - $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL); |
|
165 | - if ($email !== FALSE) { |
|
166 | - $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed); |
|
167 | - $success["EMAIL SENT"] = $sent["SENT"]; |
|
168 | - if ($sent["SENT"] === TRUE) { |
|
169 | - $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"]; |
|
170 | - } |
|
171 | - } |
|
172 | - $adminApi->returnSuccess($success); |
|
173 | - break; |
|
174 | - case web\lib\admin\API::ACTION_ADMIN_DEL: |
|
175 | - // IdP in question |
|
176 | - try { |
|
177 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
178 | - } catch (Exception $e) { |
|
179 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
180 | - exit(1); |
|
181 | - } |
|
182 | - $currentAdmins = $idp->listOwners(); |
|
183 | - $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID); |
|
184 | - if ($toBeDeleted === FALSE) { |
|
185 | - throw new Exception("A required parameter is missing, and this wasn't caught earlier?!"); |
|
186 | - } |
|
187 | - $found = FALSE; |
|
188 | - foreach ($currentAdmins as $oneAdmin) { |
|
189 | - if ($oneAdmin['MAIL'] == $toBeDeleted) { |
|
190 | - $found = TRUE; |
|
191 | - $mgmt = new core\UserManagement(); |
|
192 | - $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']); |
|
118 | + case web\lib\admin\API::ACTION_NEWINST: |
|
119 | + // create the inst, no admin, no attributes |
|
120 | + $idp = new \core\IdP($fed->newIdP("PENDING", "API")); |
|
121 | + // now add all submitted attributes |
|
122 | + $inputs = $adminApi->uglify($scrubbedParameters); |
|
123 | + $optionParser->processSubmittedFields($idp, $inputs["POST"], $inputs["FILES"]); |
|
124 | + $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_CAT_INST_ID => $idp->identifier]); |
|
125 | + break; |
|
126 | + case web\lib\admin\API::ACTION_DELINST: |
|
127 | + try { |
|
128 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
129 | + } catch (Exception $e) { |
|
130 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
131 | + exit(1); |
|
193 | 132 | } |
194 | - } |
|
195 | - if ($found) { |
|
133 | + $idp->destroy(); |
|
196 | 134 | $adminApi->returnSuccess([]); |
197 | - } |
|
198 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier); |
|
199 | - break; |
|
200 | - case web\lib\admin\API::ACTION_STATISTICS_FED: |
|
201 | - $adminApi->returnSuccess($fed->downloadStats("array")); |
|
202 | - break; |
|
203 | - case \web\lib\admin\API::ACTION_FEDERATION_LISTIDP: |
|
204 | - $retArray = []; |
|
205 | - $idpIdentifier = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID); |
|
206 | - if ($idpIdentifier === FALSE) { |
|
207 | - $allIdPs = $fed->listIdentityProviders(0); |
|
208 | - foreach ($allIdPs as $instanceId => $oneIdP) { |
|
209 | - $theIdP = $oneIdP["instance"]; |
|
210 | - $retArray[$instanceId] = $theIdP->getAttributes(); |
|
211 | - } |
|
212 | - } else { |
|
135 | + break; |
|
136 | + case web\lib\admin\API::ACTION_ADMIN_LIST: |
|
213 | 137 | try { |
214 | - $thisIdP = $validator->IdP($idpIdentifier); |
|
138 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
215 | 139 | } catch (Exception $e) { |
216 | 140 | $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
217 | 141 | exit(1); |
218 | 142 | } |
219 | - $retArray[$idpIdentifier] = $thisIdP->getAttributes(); |
|
220 | - } |
|
221 | - foreach ($retArray as $instNumber => $oneInstData) { |
|
222 | - foreach ($oneInstData as $attribNumber => $oneAttrib) { |
|
223 | - if ($oneAttrib['name'] == "general:logo_file") { |
|
224 | - // JSON doesn't cope well with raw binary data, so b64 it |
|
225 | - $retArray[$instNumber][$attribNumber]['value'] = base64_encode($oneAttrib['value']); |
|
143 | + $adminApi->returnSuccess($idp->listOwners()); |
|
144 | + break; |
|
145 | + case web\lib\admin\API::ACTION_ADMIN_ADD: |
|
146 | + // IdP in question |
|
147 | + try { |
|
148 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
149 | + } catch (Exception $e) { |
|
150 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
151 | + exit(1); |
|
152 | + } |
|
153 | + // here is the token |
|
154 | + $mgmt = new core\UserManagement(); |
|
155 | + // we know we have an admin ID but scrutinizer wants this checked more explicitly |
|
156 | + $admin = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID); |
|
157 | + if ($admin === FALSE) { |
|
158 | + throw new Exception("A required parameter is missing, and this wasn't caught earlier?!"); |
|
159 | + } |
|
160 | + $newtokens = $mgmt->createTokens(true, [$admin], $idp); |
|
161 | + $URL = "https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['SCRIPT_NAME']) . "/action_enrollment.php?token=" . array_keys($newtokens)[0]; |
|
162 | + $success = ["TOKEN URL" => $URL, "TOKEN" => array_keys($newtokens)[0]]; |
|
163 | + // done with the essentials - display in response. But if we also have an email address, send it there |
|
164 | + $email = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TARGETMAIL); |
|
165 | + if ($email !== FALSE) { |
|
166 | + $sent = \core\common\OutsideComm::adminInvitationMail($email, "EXISTING-FED", array_keys($newtokens)[0], $idp->name, $fed); |
|
167 | + $success["EMAIL SENT"] = $sent["SENT"]; |
|
168 | + if ($sent["SENT"] === TRUE) { |
|
169 | + $success["EMAIL TRANSPORT SECURE"] = $sent["TRANSPORT"]; |
|
226 | 170 | } |
227 | 171 | } |
228 | - } |
|
229 | - $adminApi->returnSuccess($retArray); |
|
230 | - break; |
|
231 | - case \web\lib\admin\API::ACTION_NEWPROF_RADIUS: |
|
232 | - // fall-through intended: both get mostly identical treatment |
|
233 | - case web\lib\admin\API::ACTION_NEWPROF_SB: |
|
234 | - try { |
|
235 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
236 | - } catch (Exception $e) { |
|
237 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
238 | - exit(1); |
|
239 | - } |
|
240 | - if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) { |
|
241 | - $type = "RADIUS"; |
|
242 | - } else { |
|
243 | - $type = "SILVERBULLET"; |
|
244 | - } |
|
245 | - $profile = $idp->newProfile($type); |
|
246 | - if ($profile === NULL) { |
|
247 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support."); |
|
248 | - exit(1); |
|
249 | - } |
|
250 | - $inputs = $adminApi->uglify($scrubbedParameters); |
|
251 | - $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]); |
|
252 | - if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) { |
|
253 | - // auto-accept ToU? |
|
254 | - if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) { |
|
255 | - $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1); |
|
256 | - } |
|
257 | - // we're done at this point |
|
258 | - $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]); |
|
259 | - continue; |
|
260 | - } |
|
261 | - if (!$profile instanceof core\ProfileRADIUS) { |
|
262 | - throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS."); |
|
263 | - } |
|
264 | - /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM'; |
|
265 | - const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */ |
|
266 | - $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM); |
|
267 | - $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE); |
|
268 | - if ($realm !== FALSE) { |
|
269 | - if ($outer === FALSE) { |
|
270 | - $outer = ""; |
|
271 | - $profile->setAnonymousIDSupport(FALSE); |
|
172 | + $adminApi->returnSuccess($success); |
|
173 | + break; |
|
174 | + case web\lib\admin\API::ACTION_ADMIN_DEL: |
|
175 | + // IdP in question |
|
176 | + try { |
|
177 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
178 | + } catch (Exception $e) { |
|
179 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
180 | + exit(1); |
|
181 | + } |
|
182 | + $currentAdmins = $idp->listOwners(); |
|
183 | + $toBeDeleted = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_ADMINID); |
|
184 | + if ($toBeDeleted === FALSE) { |
|
185 | + throw new Exception("A required parameter is missing, and this wasn't caught earlier?!"); |
|
186 | + } |
|
187 | + $found = FALSE; |
|
188 | + foreach ($currentAdmins as $oneAdmin) { |
|
189 | + if ($oneAdmin['MAIL'] == $toBeDeleted) { |
|
190 | + $found = TRUE; |
|
191 | + $mgmt = new core\UserManagement(); |
|
192 | + $mgmt->removeAdminFromIdP($idp, $oneAdmin['ID']); |
|
193 | + } |
|
194 | + } |
|
195 | + if ($found) { |
|
196 | + $adminApi->returnSuccess([]); |
|
197 | + } |
|
198 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The admin with ID $toBeDeleted is not associated to IdP " . $idp->identifier); |
|
199 | + break; |
|
200 | + case web\lib\admin\API::ACTION_STATISTICS_FED: |
|
201 | + $adminApi->returnSuccess($fed->downloadStats("array")); |
|
202 | + break; |
|
203 | + case \web\lib\admin\API::ACTION_FEDERATION_LISTIDP: |
|
204 | + $retArray = []; |
|
205 | + $idpIdentifier = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID); |
|
206 | + if ($idpIdentifier === FALSE) { |
|
207 | + $allIdPs = $fed->listIdentityProviders(0); |
|
208 | + foreach ($allIdPs as $instanceId => $oneIdP) { |
|
209 | + $theIdP = $oneIdP["instance"]; |
|
210 | + $retArray[$instanceId] = $theIdP->getAttributes(); |
|
211 | + } |
|
272 | 212 | } else { |
273 | - $outer = $outer . "@"; |
|
274 | - $profile->setAnonymousIDSupport(TRUE); |
|
213 | + try { |
|
214 | + $thisIdP = $validator->IdP($idpIdentifier); |
|
215 | + } catch (Exception $e) { |
|
216 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
217 | + exit(1); |
|
218 | + } |
|
219 | + $retArray[$idpIdentifier] = $thisIdP->getAttributes(); |
|
275 | 220 | } |
276 | - $profile->setRealm($outer . $realm); |
|
277 | - } |
|
278 | - /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */ |
|
279 | - $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER); |
|
280 | - if ($testuser !== FALSE) { |
|
281 | - $profile->setRealmCheckUser(TRUE, $testuser); |
|
282 | - } |
|
283 | - /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM'; |
|
221 | + foreach ($retArray as $instNumber => $oneInstData) { |
|
222 | + foreach ($oneInstData as $attribNumber => $oneAttrib) { |
|
223 | + if ($oneAttrib['name'] == "general:logo_file") { |
|
224 | + // JSON doesn't cope well with raw binary data, so b64 it |
|
225 | + $retArray[$instNumber][$attribNumber]['value'] = base64_encode($oneAttrib['value']); |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + $adminApi->returnSuccess($retArray); |
|
230 | + break; |
|
231 | + case \web\lib\admin\API::ACTION_NEWPROF_RADIUS: |
|
232 | + // fall-through intended: both get mostly identical treatment |
|
233 | + case web\lib\admin\API::ACTION_NEWPROF_SB: |
|
234 | + try { |
|
235 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
236 | + } catch (Exception $e) { |
|
237 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
238 | + exit(1); |
|
239 | + } |
|
240 | + if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) { |
|
241 | + $type = "RADIUS"; |
|
242 | + } else { |
|
243 | + $type = "SILVERBULLET"; |
|
244 | + } |
|
245 | + $profile = $idp->newProfile($type); |
|
246 | + if ($profile === NULL) { |
|
247 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support."); |
|
248 | + exit(1); |
|
249 | + } |
|
250 | + $inputs = $adminApi->uglify($scrubbedParameters); |
|
251 | + $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]); |
|
252 | + if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) { |
|
253 | + // auto-accept ToU? |
|
254 | + if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) { |
|
255 | + $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1); |
|
256 | + } |
|
257 | + // we're done at this point |
|
258 | + $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]); |
|
259 | + continue; |
|
260 | + } |
|
261 | + if (!$profile instanceof core\ProfileRADIUS) { |
|
262 | + throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS."); |
|
263 | + } |
|
264 | + /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM'; |
|
265 | + const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */ |
|
266 | + $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM); |
|
267 | + $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE); |
|
268 | + if ($realm !== FALSE) { |
|
269 | + if ($outer === FALSE) { |
|
270 | + $outer = ""; |
|
271 | + $profile->setAnonymousIDSupport(FALSE); |
|
272 | + } else { |
|
273 | + $outer = $outer . "@"; |
|
274 | + $profile->setAnonymousIDSupport(TRUE); |
|
275 | + } |
|
276 | + $profile->setRealm($outer . $realm); |
|
277 | + } |
|
278 | + /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */ |
|
279 | + $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER); |
|
280 | + if ($testuser !== FALSE) { |
|
281 | + $profile->setRealmCheckUser(TRUE, $testuser); |
|
282 | + } |
|
283 | + /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM'; |
|
284 | 284 | const AUXATTRIB_PROFILE_INPUT_VERIFY = 'ATTRIB-PROFILE-VERIFYREALM'; */ |
285 | - $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT); |
|
286 | - $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY); |
|
287 | - if ($enforce !== FALSE) { |
|
288 | - $profile->setInputVerificationPreference($enforce, $hint); |
|
289 | - } |
|
290 | - /* const AUXATTRIB_PROFILE_EAPTYPE */ |
|
291 | - $iterator = 1; |
|
292 | - foreach ($scrubbedParameters as $oneParam) { |
|
293 | - if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) { |
|
294 | - $type = new \core\common\EAP($oneParam["VALUE"]); |
|
295 | - $profile->addSupportedEapMethod($type, $iterator); |
|
296 | - $iterator = $iterator + 1; |
|
285 | + $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT); |
|
286 | + $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY); |
|
287 | + if ($enforce !== FALSE) { |
|
288 | + $profile->setInputVerificationPreference($enforce, $hint); |
|
297 | 289 | } |
298 | - } |
|
299 | - // reinstantiate $profile freshly from DB - it was updated in the process |
|
300 | - $profileFresh = new core\ProfileRADIUS($profile->identifier); |
|
301 | - $profileFresh->prepShowtime(); |
|
302 | - $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]); |
|
303 | - break; |
|
304 | - case web\lib\admin\API::ACTION_ENDUSER_NEW: |
|
305 | - // fall-through intentional, those two actions are doing nearly identical things |
|
306 | - case web\lib\admin\API::ACTION_ENDUSER_CHANGEEXPIRY: |
|
307 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
308 | - if ($prof_id === FALSE) { |
|
309 | - exit(1); |
|
310 | - } |
|
311 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
312 | - if ($evaluation === FALSE) { |
|
313 | - exit(1); |
|
314 | - } |
|
315 | - list($idp, $profile) = $evaluation; |
|
316 | - $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME)); |
|
317 | - $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY); |
|
318 | - if ($expiryRaw === FALSE) { |
|
319 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request."); |
|
290 | + /* const AUXATTRIB_PROFILE_EAPTYPE */ |
|
291 | + $iterator = 1; |
|
292 | + foreach ($scrubbedParameters as $oneParam) { |
|
293 | + if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) { |
|
294 | + $type = new \core\common\EAP($oneParam["VALUE"]); |
|
295 | + $profile->addSupportedEapMethod($type, $iterator); |
|
296 | + $iterator = $iterator + 1; |
|
297 | + } |
|
298 | + } |
|
299 | + // reinstantiate $profile freshly from DB - it was updated in the process |
|
300 | + $profileFresh = new core\ProfileRADIUS($profile->identifier); |
|
301 | + $profileFresh->prepShowtime(); |
|
302 | + $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]); |
|
320 | 303 | break; |
321 | - } |
|
322 | - $expiry = new DateTime($expiryRaw); |
|
323 | - try { |
|
324 | - switch ($inputDecoded['ACTION']) { |
|
304 | + case web\lib\admin\API::ACTION_ENDUSER_NEW: |
|
305 | + // fall-through intentional, those two actions are doing nearly identical things |
|
306 | + case web\lib\admin\API::ACTION_ENDUSER_CHANGEEXPIRY: |
|
307 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
308 | + if ($prof_id === FALSE) { |
|
309 | + exit(1); |
|
310 | + } |
|
311 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
312 | + if ($evaluation === FALSE) { |
|
313 | + exit(1); |
|
314 | + } |
|
315 | + list($idp, $profile) = $evaluation; |
|
316 | + $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME)); |
|
317 | + $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY); |
|
318 | + if ($expiryRaw === FALSE) { |
|
319 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request."); |
|
320 | + break; |
|
321 | + } |
|
322 | + $expiry = new DateTime($expiryRaw); |
|
323 | + try { |
|
324 | + switch ($inputDecoded['ACTION']) { |
|
325 | 325 | case web\lib\admin\API::ACTION_ENDUSER_NEW: |
326 | 326 | $retval = $profile->addUser($user, $expiry); |
327 | 327 | break; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $retval = 1; // function doesn't have any failure vectors not raising an Exception and doesn't return a value |
335 | 335 | } |
336 | 336 | break; |
337 | - } |
|
337 | + } |
|
338 | 338 | } catch (Exception $e) { |
339 | 339 | $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?"); |
340 | 340 | exit(1); |
@@ -345,25 +345,25 @@ discard block |
||
345 | 345 | } |
346 | 346 | $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]); |
347 | 347 | break; |
348 | - case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
|
349 | - // fall-through intended: both actions are very similar |
|
350 | - case \web\lib\admin\API::ACTION_TOKEN_NEW: |
|
351 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
352 | - if ($profile_id === FALSE) { |
|
353 | - exit(1); |
|
354 | - } |
|
355 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
356 | - if ($evaluation === FALSE) { |
|
357 | - exit(1); |
|
358 | - } |
|
359 | - list($idp, $profile) = $evaluation; |
|
360 | - $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID)); |
|
361 | - if ($userId === FALSE) { |
|
362 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer."); |
|
363 | - exit(1); |
|
364 | - } |
|
365 | - $additionalInfo = []; |
|
366 | - switch ($inputDecoded['ACTION']) { // this is where the two differ |
|
348 | + case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
|
349 | + // fall-through intended: both actions are very similar |
|
350 | + case \web\lib\admin\API::ACTION_TOKEN_NEW: |
|
351 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
352 | + if ($profile_id === FALSE) { |
|
353 | + exit(1); |
|
354 | + } |
|
355 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
356 | + if ($evaluation === FALSE) { |
|
357 | + exit(1); |
|
358 | + } |
|
359 | + list($idp, $profile) = $evaluation; |
|
360 | + $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID)); |
|
361 | + if ($userId === FALSE) { |
|
362 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer."); |
|
363 | + exit(1); |
|
364 | + } |
|
365 | + $additionalInfo = []; |
|
366 | + switch ($inputDecoded['ACTION']) { // this is where the two differ |
|
367 | 367 | case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
368 | 368 | $result = $profile->deactivateUser($userId); |
369 | 369 | break; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | } |
398 | 398 | break; |
399 | - } |
|
399 | + } |
|
400 | 400 | |
401 | 401 | if ($result !== TRUE) { |
402 | 402 | $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "These parameters did not lead to an existing, active user."); |
@@ -404,69 +404,69 @@ discard block |
||
404 | 404 | } |
405 | 405 | $adminApi->returnSuccess($additionalInfo); |
406 | 406 | break; |
407 | - case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY: |
|
408 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
409 | - if ($profile_id === FALSE) { |
|
410 | - exit(1); |
|
411 | - } |
|
412 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
413 | - if ($evaluation === FALSE) { |
|
414 | - exit(1); |
|
415 | - } |
|
416 | - list($idp, $profile) = $evaluation; |
|
417 | - $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
418 | - $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME); |
|
419 | - $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
420 | - $certCN = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTCN); |
|
421 | - if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE && $certCN === FALSE) { |
|
422 | - // we need at least one of those |
|
423 | - $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, certificate serial, or certificate CN is required."); |
|
424 | - break; |
|
425 | - } |
|
426 | - if ($certSerial !== FALSE) { // we got a cert serial |
|
427 | - $serial = explode(":", $certSerial); |
|
428 | - $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
407 | + case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY: |
|
408 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
409 | + if ($profile_id === FALSE) { |
|
410 | + exit(1); |
|
429 | 411 | } |
430 | - if ($certCN !== FALSE) { // we got a cert CN |
|
431 | - $cert = new \core\SilverbulletCertificate($certCN); |
|
432 | - } |
|
433 | - if ($cert !== NULL) { // we found a cert; verify it and extract userId |
|
434 | - if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
435 | - return $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Certificate not found."); |
|
412 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
413 | + if ($evaluation === FALSE) { |
|
414 | + exit(1); |
|
436 | 415 | } |
437 | - if ($cert->profileId != $profile->identifier) { |
|
438 | - return $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Certificate does not belong to this profile."); |
|
416 | + list($idp, $profile) = $evaluation; |
|
417 | + $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
418 | + $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME); |
|
419 | + $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
420 | + $certCN = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTCN); |
|
421 | + if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE && $certCN === FALSE) { |
|
422 | + // we need at least one of those |
|
423 | + $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, certificate serial, or certificate CN is required."); |
|
424 | + break; |
|
439 | 425 | } |
440 | - $userId = $cert->userId; |
|
441 | - } |
|
442 | - if ($userId !== FALSE) { |
|
443 | - $userList = $profile->getUserById($userId); |
|
444 | - } |
|
445 | - if ($userName !== FALSE) { |
|
446 | - $userList = $profile->getUserByName($userName); |
|
447 | - } |
|
448 | - if (count($userList) === 1) { |
|
449 | - foreach ($userList as $oneUserId => $oneUserName) { |
|
450 | - return $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $oneUserName, \web\lib\admin\API::AUXATTRIB_SB_USERID => $oneUserId]); |
|
426 | + if ($certSerial !== FALSE) { // we got a cert serial |
|
427 | + $serial = explode(":", $certSerial); |
|
428 | + $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
429 | + } |
|
430 | + if ($certCN !== FALSE) { // we got a cert CN |
|
431 | + $cert = new \core\SilverbulletCertificate($certCN); |
|
451 | 432 | } |
452 | - } |
|
453 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "No matching user found in this profile."); |
|
454 | - break; |
|
455 | - case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
|
456 | - // fall-through: those two are similar |
|
457 | - case \web\lib\admin\API::ACTION_TOKEN_LIST: |
|
458 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
459 | - if ($profile_id === FALSE) { |
|
460 | - exit(1); |
|
461 | - } |
|
462 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
463 | - if ($evaluation === FALSE) { |
|
464 | - exit(1); |
|
465 | - } |
|
466 | - list($idp, $profile) = $evaluation; |
|
467 | - $allUsers = $profile->listAllUsers(); |
|
468 | - // this is where they differ |
|
469 | - switch ($inputDecoded['ACTION']) { |
|
433 | + if ($cert !== NULL) { // we found a cert; verify it and extract userId |
|
434 | + if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
435 | + return $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Certificate not found."); |
|
436 | + } |
|
437 | + if ($cert->profileId != $profile->identifier) { |
|
438 | + return $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Certificate does not belong to this profile."); |
|
439 | + } |
|
440 | + $userId = $cert->userId; |
|
441 | + } |
|
442 | + if ($userId !== FALSE) { |
|
443 | + $userList = $profile->getUserById($userId); |
|
444 | + } |
|
445 | + if ($userName !== FALSE) { |
|
446 | + $userList = $profile->getUserByName($userName); |
|
447 | + } |
|
448 | + if (count($userList) === 1) { |
|
449 | + foreach ($userList as $oneUserId => $oneUserName) { |
|
450 | + return $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $oneUserName, \web\lib\admin\API::AUXATTRIB_SB_USERID => $oneUserId]); |
|
451 | + } |
|
452 | + } |
|
453 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "No matching user found in this profile."); |
|
454 | + break; |
|
455 | + case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
|
456 | + // fall-through: those two are similar |
|
457 | + case \web\lib\admin\API::ACTION_TOKEN_LIST: |
|
458 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
459 | + if ($profile_id === FALSE) { |
|
460 | + exit(1); |
|
461 | + } |
|
462 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
463 | + if ($evaluation === FALSE) { |
|
464 | + exit(1); |
|
465 | + } |
|
466 | + list($idp, $profile) = $evaluation; |
|
467 | + $allUsers = $profile->listAllUsers(); |
|
468 | + // this is where they differ |
|
469 | + switch ($inputDecoded['ACTION']) { |
|
470 | 470 | case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
471 | 471 | $adminApi->returnSuccess($allUsers); |
472 | 472 | break; |
@@ -485,105 +485,105 @@ discard block |
||
485 | 485 | $infoSet[$oneTokenObject->userId] = [\web\lib\admin\API::AUXATTRIB_TOKEN => $oneTokenObject->invitationTokenString, "STATUS" => $oneTokenObject->invitationTokenStatus]; |
486 | 486 | } |
487 | 487 | $adminApi->returnSuccess($infoSet); |
488 | - } |
|
489 | - break; |
|
490 | - case \web\lib\admin\API::ACTION_TOKEN_REVOKE: |
|
491 | - $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN); |
|
492 | - if ($tokenRaw === FALSE) { |
|
493 | - exit(1); |
|
494 | - } |
|
495 | - $token = new core\SilverbulletInvitation($tokenRaw); |
|
496 | - if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
|
497 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token."); |
|
498 | - exit(1); |
|
499 | - } |
|
500 | - $token->revokeInvitation(); |
|
501 | - $adminApi->returnSuccess([]); |
|
502 | - break; |
|
503 | - case \web\lib\admin\API::ACTION_CERT_LIST: |
|
504 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
505 | - $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
506 | - if ($prof_id === FALSE || !is_int($user_id)) { |
|
507 | - exit(1); |
|
508 | - } |
|
509 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
510 | - if ($evaluation === FALSE) { |
|
511 | - exit(1); |
|
512 | - } |
|
513 | - list($idp, $profile) = $evaluation; |
|
514 | - $invitations = $profile->userStatus($user_id); |
|
515 | - // now pull out cert information from the object |
|
516 | - $certs = []; |
|
517 | - foreach ($invitations as $oneInvitation) { |
|
518 | - $certs = array_merge($certs, $oneInvitation->associatedCertificates); |
|
519 | - } |
|
520 | - // extract relevant subset of information from cert objects |
|
521 | - $certDetails = []; |
|
522 | - foreach ($certs as $cert) { |
|
523 | - $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation]; |
|
524 | - } |
|
525 | - $adminApi->returnSuccess($certDetails); |
|
526 | - break; |
|
527 | - case \web\lib\admin\API::ACTION_CERT_REVOKE: |
|
528 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
529 | - if ($prof_id === FALSE) { |
|
530 | - exit(1); |
|
531 | - } |
|
532 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
533 | - if ($evaluation === FALSE) { |
|
534 | - exit(1); |
|
535 | - } |
|
536 | - list($idp, $profile) = $evaluation; |
|
537 | - // tear apart the serial |
|
538 | - $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
539 | - if ($serialRaw === FALSE) { |
|
540 | - exit(1); |
|
541 | - } |
|
542 | - $serial = explode(":", $serialRaw); |
|
543 | - $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
544 | - if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
545 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
546 | - } |
|
547 | - if ($cert->profileId != $profile->identifier) { |
|
548 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
549 | - } |
|
550 | - $cert->revokeCertificate(); |
|
551 | - $adminApi->returnSuccess([]); |
|
488 | + } |
|
552 | 489 | break; |
553 | - case \web\lib\admin\API::ACTION_CERT_ANNOTATE: |
|
554 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
555 | - if ($prof_id === FALSE) { |
|
556 | - exit(1); |
|
557 | - } |
|
558 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
559 | - if ($evaluation === FALSE) { |
|
560 | - exit(1); |
|
561 | - } |
|
562 | - list($idp, $profile) = $evaluation; |
|
563 | - // tear apart the serial |
|
564 | - $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
565 | - if ($serialRaw === FALSE) { |
|
566 | - exit(1); |
|
567 | - } |
|
568 | - $serial = explode(":", $serialRaw); |
|
569 | - $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
570 | - if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
571 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
572 | - } |
|
573 | - if ($cert->profileId != $profile->identifier) { |
|
574 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
575 | - } |
|
576 | - $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION); |
|
577 | - if ($annotationRaw === FALSE) { |
|
578 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation."); |
|
490 | + case \web\lib\admin\API::ACTION_TOKEN_REVOKE: |
|
491 | + $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN); |
|
492 | + if ($tokenRaw === FALSE) { |
|
493 | + exit(1); |
|
494 | + } |
|
495 | + $token = new core\SilverbulletInvitation($tokenRaw); |
|
496 | + if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
|
497 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token."); |
|
498 | + exit(1); |
|
499 | + } |
|
500 | + $token->revokeInvitation(); |
|
501 | + $adminApi->returnSuccess([]); |
|
579 | 502 | break; |
580 | - } |
|
581 | - $annotation = json_decode($annotationRaw, TRUE); |
|
582 | - $cert->annotate($annotation); |
|
583 | - $adminApi->returnSuccess([]); |
|
503 | + case \web\lib\admin\API::ACTION_CERT_LIST: |
|
504 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
505 | + $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
506 | + if ($prof_id === FALSE || !is_int($user_id)) { |
|
507 | + exit(1); |
|
508 | + } |
|
509 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
510 | + if ($evaluation === FALSE) { |
|
511 | + exit(1); |
|
512 | + } |
|
513 | + list($idp, $profile) = $evaluation; |
|
514 | + $invitations = $profile->userStatus($user_id); |
|
515 | + // now pull out cert information from the object |
|
516 | + $certs = []; |
|
517 | + foreach ($invitations as $oneInvitation) { |
|
518 | + $certs = array_merge($certs, $oneInvitation->associatedCertificates); |
|
519 | + } |
|
520 | + // extract relevant subset of information from cert objects |
|
521 | + $certDetails = []; |
|
522 | + foreach ($certs as $cert) { |
|
523 | + $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username, "ANNOTATION" => $cert->annotation]; |
|
524 | + } |
|
525 | + $adminApi->returnSuccess($certDetails); |
|
526 | + break; |
|
527 | + case \web\lib\admin\API::ACTION_CERT_REVOKE: |
|
528 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
529 | + if ($prof_id === FALSE) { |
|
530 | + exit(1); |
|
531 | + } |
|
532 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
533 | + if ($evaluation === FALSE) { |
|
534 | + exit(1); |
|
535 | + } |
|
536 | + list($idp, $profile) = $evaluation; |
|
537 | + // tear apart the serial |
|
538 | + $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
539 | + if ($serialRaw === FALSE) { |
|
540 | + exit(1); |
|
541 | + } |
|
542 | + $serial = explode(":", $serialRaw); |
|
543 | + $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
544 | + if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
545 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
546 | + } |
|
547 | + if ($cert->profileId != $profile->identifier) { |
|
548 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
549 | + } |
|
550 | + $cert->revokeCertificate(); |
|
551 | + $adminApi->returnSuccess([]); |
|
552 | + break; |
|
553 | + case \web\lib\admin\API::ACTION_CERT_ANNOTATE: |
|
554 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
555 | + if ($prof_id === FALSE) { |
|
556 | + exit(1); |
|
557 | + } |
|
558 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
559 | + if ($evaluation === FALSE) { |
|
560 | + exit(1); |
|
561 | + } |
|
562 | + list($idp, $profile) = $evaluation; |
|
563 | + // tear apart the serial |
|
564 | + $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
565 | + if ($serialRaw === FALSE) { |
|
566 | + exit(1); |
|
567 | + } |
|
568 | + $serial = explode(":", $serialRaw); |
|
569 | + $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
570 | + if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
571 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
572 | + } |
|
573 | + if ($cert->profileId != $profile->identifier) { |
|
574 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
575 | + } |
|
576 | + $annotationRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTANNOTATION); |
|
577 | + if ($annotationRaw === FALSE) { |
|
578 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Unable to extract annotation."); |
|
579 | + break; |
|
580 | + } |
|
581 | + $annotation = json_decode($annotationRaw, TRUE); |
|
582 | + $cert->annotate($annotation); |
|
583 | + $adminApi->returnSuccess([]); |
|
584 | 584 | |
585 | - break; |
|
585 | + break; |
|
586 | 586 | |
587 | - default: |
|
588 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet."); |
|
587 | + default: |
|
588 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet."); |
|
589 | 589 | } |
590 | 590 | \ No newline at end of file |
@@ -67,45 +67,45 @@ |
||
67 | 67 | // let's start the numbering at 1 |
68 | 68 | $this->qaArray = [ |
69 | 69 | 1 => ["AREA" => AbstractTest::INFRA_DEVICE, |
70 | - "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"), |
|
71 | - "FACTOR_YES" => 0.8, // that's good, but it doesn't mean strikingly much |
|
72 | - "FACTOR_NO" => 2, // that's bad, and points strongly to a config on this end |
|
73 | - "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)], |
|
70 | + "TXT" => _("Have you ever used the network succesfully, e.g. at your home institution without roaming?"), |
|
71 | + "FACTOR_YES" => 0.8, // that's good, but it doesn't mean strikingly much |
|
72 | + "FACTOR_NO" => 2, // that's bad, and points strongly to a config on this end |
|
73 | + "VERDICTLECTURE" => sprintf(_("If your device has never worked before with this setup, then very likely your device configuation is wrong. %s"), $confAssistantText)], |
|
74 | 74 | 2 => ["AREA" => AbstractTest::INFRA_DEVICE, |
75 | - "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
|
76 | - "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging |
|
77 | - "FACTOR_NO" => 3, // that is almost a smoking gun |
|
78 | - "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)], |
|
75 | + "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
|
76 | + "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging |
|
77 | + "FACTOR_NO" => 3, // that is almost a smoking gun |
|
78 | + "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)], |
|
79 | 79 | 3 => ["AREA" => AbstractTest::INFRA_DEVICE, |
80 | - "TXT" => _("Did you recently change the configuration on your device?"), |
|
81 | - "FACTOR_YES" => 3, // that is almost a smoking gun |
|
82 | - "FACTOR_NO" => 0.6, // encouraging |
|
83 | - "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")], |
|
80 | + "TXT" => _("Did you recently change the configuration on your device?"), |
|
81 | + "FACTOR_YES" => 3, // that is almost a smoking gun |
|
82 | + "FACTOR_NO" => 0.6, // encouraging |
|
83 | + "VERDICTLECTURE" => _("Accounts only need to be configured once, and can then be used anywhere on the planet without any changes. If you recently changed the configuration, that change may very well be at fault. You should never change your network configuration unless explicitly instructed so by your Identity Provider; even in the case of temporary login issues.")], |
|
84 | 84 | 4 => ["AREA" => AbstractTest::INFRA_DEVICE, |
85 | - "TXT" => _("Did you recently change your password?"), |
|
86 | - "FACTOR_YES" => 1.5, // that doesn't mean it is the source of the problem, but it /might/ be that the user forgot to provide the new password |
|
87 | - "FACTOR_NO" => 0.6, // encouraging |
|
88 | - "VERDICTLECTURE" => _("When you change your password, you also need to supply the new password in the device configuration.")], |
|
85 | + "TXT" => _("Did you recently change your password?"), |
|
86 | + "FACTOR_YES" => 1.5, // that doesn't mean it is the source of the problem, but it /might/ be that the user forgot to provide the new password |
|
87 | + "FACTOR_NO" => 0.6, // encouraging |
|
88 | + "VERDICTLECTURE" => _("When you change your password, you also need to supply the new password in the device configuration.")], |
|
89 | 89 | 5 => ["AREA" => AbstractTest::INFRA_DEVICE, |
90 | - "TXT" => _("If you use more than one device: do your other devices still work?"), |
|
91 | - "FACTOR_YES" => 0.33, // seems that all is okay with the account as such |
|
92 | - "FACTOR_NO" => 3, // now that is suspicious indeed |
|
93 | - "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),], |
|
90 | + "TXT" => _("If you use more than one device: do your other devices still work?"), |
|
91 | + "FACTOR_YES" => 0.33, // seems that all is okay with the account as such |
|
92 | + "FACTOR_NO" => 3, // now that is suspicious indeed |
|
93 | + "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),], |
|
94 | 94 | 6 => ["AREA" => AbstractTest::INFRA_SP_80211, |
95 | - "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), |
|
96 | - "FACTOR_YES" => 3, |
|
97 | - "FACTOR_NO" => 0.33, |
|
98 | - "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")], |
|
95 | + "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), |
|
96 | + "FACTOR_YES" => 3, |
|
97 | + "FACTOR_NO" => 0.33, |
|
98 | + "VERDICTLECTURE" => _("The network is likely overloaded at this location and point in time. You may have to wait until later before you get a better connectivity. If you think the network should be reinforced for more capacity at this place, you should inform the hotspot provider. [MGW: add contact info]")], |
|
99 | 99 | 7 => ["AREA" => AbstractTest::INFRA_SP_80211, |
100 | - "TXT" => _("Does the connection get better when you move around?"), |
|
101 | - "FACTOR_YES" => 3, |
|
102 | - "FACTOR_NO" => 0.33, |
|
103 | - "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")], |
|
100 | + "TXT" => _("Does the connection get better when you move around?"), |
|
101 | + "FACTOR_YES" => 3, |
|
102 | + "FACTOR_NO" => 0.33, |
|
103 | + "VERDICTLECTURE" => _("You should move to a different location to achieve better network coverage and service. If you think the exact spot you are at deserves better coverage, you should inform the hotspot provider. [MGW: add contact info]")], |
|
104 | 104 | 8 => ["AREA" => AbstractTest::INFRA_SP_LAN, |
105 | - "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), |
|
106 | - "FACTOR_YES" => 5, // gotcha |
|
107 | - "FACTOR_YES" => 0.5, // the user saying no is not conclusive; maybe the device isn't that verbose or he's not looking at the right spot |
|
108 | - "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")], |
|
105 | + "TXT" => _("Do you see errors stating something similar to 'Unable to get IP address'?"), |
|
106 | + "FACTOR_YES" => 5, // gotcha |
|
107 | + "FACTOR_YES" => 0.5, // the user saying no is not conclusive; maybe the device isn't that verbose or he's not looking at the right spot |
|
108 | + "VERDICTLECTURE" => _("The evidence at hand suggests that there may be an infrastructure problem at this particular hotspot provider. There is nothing you can do to solve this problem locally. Please be patient and try again at a later time.")], |
|
109 | 109 | ]; |
110 | 110 | \core\common\Entity::outOfThePotatoes(); |
111 | 111 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | use \Exception; |
25 | 25 | |
26 | -require_once dirname(dirname(__DIR__)) . "/config/_config.php"; |
|
26 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * This class talks to end users, asking them annoying questions to get to the |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | "TXT" => _("Did the device previously work when roaming, i.e. at other hotspots away from your home institution?"), |
76 | 76 | "FACTOR_YES" => 0.6, // that's good, and somewhat encouraging |
77 | 77 | "FACTOR_NO" => 3, // that is almost a smoking gun |
78 | - "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"),$confAssistantText)], |
|
78 | + "VERDICTLECTURE" => sprintf(_("If roaming consistently does not work, then very likely your device configuration is wrong. Typical errors causing this symptom include: using a routing ('outer') username without the @realm.tld suffix - those potentially work at your home organisation, but can not be used when roaming. %s"), $confAssistantText)], |
|
79 | 79 | 3 => ["AREA" => AbstractTest::INFRA_DEVICE, |
80 | 80 | "TXT" => _("Did you recently change the configuration on your device?"), |
81 | 81 | "FACTOR_YES" => 3, // that is almost a smoking gun |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | "TXT" => _("If you use more than one device: do your other devices still work?"), |
91 | 91 | "FACTOR_YES" => 0.33, // seems that all is okay with the account as such |
92 | 92 | "FACTOR_NO" => 3, // now that is suspicious indeed |
93 | - "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"),], |
|
93 | + "VERDICTLECTURE" => _("If all devices stopped working simultaneously, there may be a problem with your account as such. Maybe your account expired, or you were forced to change the password? These questions are best answered by your Identity Provider [MGW: display contact info]"), ], |
|
94 | 94 | 6 => ["AREA" => AbstractTest::INFRA_SP_80211, |
95 | 95 | "TXT" => _("Is the place you are currently at heavily crowded, or is a network-intensive workload going on?"), |
96 | 96 | "FACTOR_YES" => 3, |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | $questionDetails = $this->qaArray[$questionNumber]; |
125 | 125 | if ($answer === TRUE) { |
126 | 126 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR_YES"]; |
127 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_YES"]."\n"); |
|
127 | + $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_YES"]."\n"); |
|
128 | 128 | $factor = $questionDetails["FACTOR_YES"]; |
129 | 129 | } elseif ($answer === FALSE) { |
130 | 130 | $this->possibleFailureReasons[$questionDetails['AREA']] = $this->possibleFailureReasons[$questionDetails['AREA']] * $questionDetails["FACTOR_NO"]; |
131 | - $this->loggerInstance->debug(3,"Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_NO"]."\n"); |
|
131 | + $this->loggerInstance->debug(3, "Adjusting ".$questionDetails['AREA']." by ".$questionDetails["FACTOR_NO"]."\n"); |
|
132 | 132 | $factor = $questionDetails["FACTOR_NO"]; |
133 | 133 | } else { |
134 | 134 | $factor = 1; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $this->additionalFindings["QUESTIONSASKED"] = $this->previousQuestions; |
139 | 139 | $_SESSION["SUSPECTS"] = $this->possibleFailureReasons; |
140 | 140 | $_SESSION["EVIDENCE"] = $this->additionalFindings; |
141 | - $this->loggerInstance->debug(3,$_SESSION['SUSPECTS']); |
|
142 | - $this->loggerInstance->debug(3,$_SESSION['EVIDENCE']); |
|
141 | + $this->loggerInstance->debug(3, $_SESSION['SUSPECTS']); |
|
142 | + $this->loggerInstance->debug(3, $_SESSION['EVIDENCE']); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | // if both are identical, take any of the questions in the pool of both |
159 | 159 | foreach ($this->qaArray as $questionNumber => $questionDetails) { |
160 | 160 | // if we find a question we didn't ask before AND it is related to our currently high-scoring problem area, ask it |
161 | - if (!array_key_exists($questionNumber, $this->previousQuestions) && ( $questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory) ) { |
|
161 | + if (!array_key_exists($questionNumber, $this->previousQuestions) && ($questionDetails["AREA"] == $highestCategory || $questionDetails["AREA"] == $nextCategory)) { |
|
162 | 162 | return json_encode(["NEXTEXISTS" => TRUE, "NUMBER" => $questionNumber, "TEXT" => $questionDetails["TXT"]]); |
163 | 163 | } |
164 | 164 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return string JSON encoded array with all the info we have |
172 | 172 | */ |
173 | 173 | public function getCurrentGuessState() { |
174 | - return json_encode([ "SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings ]); |
|
174 | + return json_encode(["SUSPECTS" => $this->possibleFailureReasons, "EVIDENCE" => $this->additionalFindings]); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | common\Entity::intoThePotatoes(); |
155 | 155 | $mail = \core\common\OutsideComm::mailHandle(); |
156 | 156 | // who to whom? |
157 | - $mail->FromName = CONFIG['APPEARANCE']['productname'] . " Notification System"; |
|
158 | - $mail->addReplyTo(CONFIG['APPEARANCE']['support-contact']['developer-mail'], CONFIG['APPEARANCE']['productname'] . " " . _("Feedback")); |
|
157 | + $mail->FromName = CONFIG['APPEARANCE']['productname']." Notification System"; |
|
158 | + $mail->addReplyTo(CONFIG['APPEARANCE']['support-contact']['developer-mail'], CONFIG['APPEARANCE']['productname']." "._("Feedback")); |
|
159 | 159 | $mail->addAddress($mailaddr[0]["value"]); |
160 | 160 | // what do we want to say? |
161 | 161 | $mail->Subject = $subject; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | $lookFor .= "$name"; |
220 | 220 | } |
221 | - $finding = preg_match("/^(" . $lookFor . "):(.*)/", $oneRow->user_id, $matches); |
|
221 | + $finding = preg_match("/^(".$lookFor."):(.*)/", $oneRow->user_id, $matches); |
|
222 | 222 | if ($finding === 0 || $finding === FALSE) { |
223 | 223 | return FALSE; |
224 | 224 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | $matchedProviders[] = $idp; |
237 | 237 | $name = $idp; |
238 | 238 | if ($skipCurl == 0) { |
239 | - $url = CONFIG_DIAGNOSTICS['eduGainResolver']['url'] . "?action=get_entity_name&type=idp&e_id=$idp&lang=$lang"; |
|
239 | + $url = CONFIG_DIAGNOSTICS['eduGainResolver']['url']."?action=get_entity_name&type=idp&e_id=$idp&lang=$lang"; |
|
240 | 240 | $ch = curl_init($url); |
241 | 241 | if ($ch === FALSE) { |
242 | 242 | $loggerInstance->debug(2, "Unable ask eduGAIN about IdP - CURL init failed!"); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | } |
253 | 253 | curl_close($ch); |
254 | 254 | } |
255 | - $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]] . " - IdP: " . $name; |
|
255 | + $listOfProviders[] = User::PROVIDER_STRINGS[$providerStrings[0]]." - IdP: ".$name; |
|
256 | 256 | } |
257 | 257 | break; |
258 | 258 | case $providerStrings[1]: |