@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | ?> |
22 | 22 | <?php |
23 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
23 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
24 | 24 | |
25 | 25 | $auth = new \web\lib\admin\Authentication(); |
26 | 26 | $auth->authenticate(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | // if we have a pushed close button, submit attributes and send user back to the overview page |
37 | 37 | // if external DB sync is disabled globally, the user never gets to this page. If he came here *anyway* -> send him back immediately. |
38 | -if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_CLOSE ) || CONFIG['DB']['enforce-external-sync'] == FALSE) { |
|
38 | +if ((isset($_POST['submitbutton']) && $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_CLOSE) || CONFIG['DB']['enforce-external-sync'] == FALSE) { |
|
39 | 39 | header("Location: ../overview_federation.php"); |
40 | 40 | exit; |
41 | 41 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | $cat = new \core\CAT(); |
93 | 93 | switch ($my_inst->getExternalDBSyncState()) { |
94 | 94 | case \core\IdP::EXTERNAL_DB_SYNCSTATE_SYNCED: |
95 | - printf(_("This %s is linked to the %s database."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</p>"; |
|
96 | - echo "<p>" . sprintf(_("The following information about the IdP is stored in the %s DB and %s DB:"), CONFIG['APPEARANCE']['productname'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</p>"; |
|
97 | - echo "<table><tr><td>" . sprintf(_("Information in <strong>%s Database</strong>"), CONFIG['APPEARANCE']['productname']) . "</td><td>" . sprintf(_("Information in <strong>%s Database</strong>"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</td></tr>"; |
|
95 | + printf(_("This %s is linked to the %s database."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</p>"; |
|
96 | + echo "<p>".sprintf(_("The following information about the IdP is stored in the %s DB and %s DB:"), CONFIG['APPEARANCE']['productname'], CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</p>"; |
|
97 | + echo "<table><tr><td>".sprintf(_("Information in <strong>%s Database</strong>"), CONFIG['APPEARANCE']['productname'])."</td><td>".sprintf(_("Information in <strong>%s Database</strong>"), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</td></tr>"; |
|
98 | 98 | echo "<tr><td>"; |
99 | 99 | // left-hand side: CAT DB |
100 | 100 | echo "<table>"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } else { |
107 | 107 | $language = CONFIG['LANGUAGES'][$name['lang']]['display'] ?? "(unsupported language)"; |
108 | 108 | } |
109 | - echo "<tr><td>" . sprintf(_("%s Name (%s)"), $uiElements->nomenclatureInst, $language) . "</td><td>" . $name['value'] . "</td></tr>"; |
|
109 | + echo "<tr><td>".sprintf(_("%s Name (%s)"), $uiElements->nomenclatureInst, $language)."</td><td>".$name['value']."</td></tr>"; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $admins = $my_inst->listOwners(); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | if (count($username) == 0) { |
118 | 118 | $username[0]['value'] = _("Unnamed User"); |
119 | 119 | } |
120 | - echo "<tr><td>" . _("Administrator [invited as]") . "</td><td>" . $username[0]['value'] . " [" . $admin['MAIL'] . "]</td></tr>"; |
|
120 | + echo "<tr><td>"._("Administrator [invited as]")."</td><td>".$username[0]['value']." [".$admin['MAIL']."]</td></tr>"; |
|
121 | 121 | } |
122 | 122 | echo "</table>"; |
123 | 123 | // end of left-hand side |
@@ -125,38 +125,38 @@ discard block |
||
125 | 125 | // right-hand side: external DB |
126 | 126 | $externalid = $my_inst->getExternalDBId(); |
127 | 127 | if (is_bool($externalid)) { // we are in SYNCED state so this cannot happen |
128 | - throw new Exception("We are in SYNCSTATE_SYNCED but still there is no external DB Id available for the " . CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution'] . "!"); |
|
128 | + throw new Exception("We are in SYNCSTATE_SYNCED but still there is no external DB Id available for the ".CONFIG_CONFASSISTANT['CONSORTIUM']['nomenclature_institution']."!"); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $extinfo = $cat->getExternalDBEntityDetails($externalid); |
132 | 132 | |
133 | 133 | echo "<table>"; |
134 | 134 | foreach ($extinfo['names'] as $lang => $name) { |
135 | - echo "<tr><td>" . sprintf(_("%s Name (%s)"), $uiElements->nomenclatureInst, $lang) . "</td><td>$name</td>"; |
|
135 | + echo "<tr><td>".sprintf(_("%s Name (%s)"), $uiElements->nomenclatureInst, $lang)."</td><td>$name</td>"; |
|
136 | 136 | } |
137 | 137 | foreach ($extinfo['admins'] as $number => $admin_details) { |
138 | - echo "<tr><td>" . _("Administrator email") . "</td><td>" . $admin_details['email'] . "</td></tr>"; |
|
138 | + echo "<tr><td>"._("Administrator email")."</td><td>".$admin_details['email']."</td></tr>"; |
|
139 | 139 | } |
140 | 140 | echo "</table>"; |
141 | 141 | // end of right-hand side |
142 | 142 | echo "</td></tr></table>"; |
143 | - echo "<p>" . _("If this mapping is not correct any more, you can remove the link:") . " "; |
|
143 | + echo "<p>"._("If this mapping is not correct any more, you can remove the link:")." "; |
|
144 | 144 | echo "<form name='form-unlink-inst' action='inc/manageDBLink.inc.php?inst_id=$my_inst->identifier' method='post' accept-charset='UTF-8'>"; |
145 | - echo "<button type='submit' class='delete' name='submitbutton' id='submit' value='" . web\lib\common\FormElements::BUTTON_DELETE . "'>" . _("Unlink") . "</button></form>"; |
|
145 | + echo "<button type='submit' class='delete' name='submitbutton' id='submit' value='".web\lib\common\FormElements::BUTTON_DELETE."'>"._("Unlink")."</button></form>"; |
|
146 | 146 | break; |
147 | 147 | case \core\IdP::EXTERNAL_DB_SYNCSTATE_NOT_SYNCED: |
148 | 148 | $temparray = []; |
149 | - printf(_("This %s is not yet linked to the %s database."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . " "; |
|
150 | - echo "<strong>" . _("This means that its profiles are not made available on the user download page.") . "</strong> "; |
|
149 | + printf(_("This %s is not yet linked to the %s database."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])." "; |
|
150 | + echo "<strong>"._("This means that its profiles are not made available on the user download page.")."</strong> "; |
|
151 | 151 | printf(_("You can link it to the %s database below."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
152 | 152 | $candidates = $my_inst->getExternalDBSyncCandidates(); |
153 | 153 | echo "<br/><form name='form-link-inst' action='inc/manageDBLink.inc.php?inst_id=$my_inst->identifier' method='post' accept-charset='UTF-8'>"; |
154 | - printf(_("Please select an entity from the %s DB which corresponds to this CAT %s."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclatureInst) . " "; |
|
154 | + printf(_("Please select an entity from the %s DB which corresponds to this CAT %s."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclatureInst)." "; |
|
155 | 155 | if ($candidates !== FALSE && count($candidates) > 0) { |
156 | 156 | printf(_("Particularly promising entries (names in CAT and %s DB are a 100%% match) are on top of the list."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']); |
157 | 157 | } |
158 | 158 | echo "<table>"; |
159 | - echo "<tr><th>" . _("Link to this entity?") . "</th><th>" . sprintf(_("%s Name"), $uiElements->nomenclatureInst) . "</th><th>" . _("Administrators") . "</th></tr>"; |
|
159 | + echo "<tr><th>"._("Link to this entity?")."</th><th>".sprintf(_("%s Name"), $uiElements->nomenclatureInst)."</th><th>"._("Administrators")."</th></tr>"; |
|
160 | 160 | if ($candidates !== FALSE && count($candidates) > 0) { |
161 | 161 | foreach ($candidates as $candidate) { |
162 | 162 | $info = $cat->getExternalDBEntityDetails($candidate); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | echo "</td><td>"; |
168 | 168 | foreach ($info['admins'] as $number => $admin_details) { |
169 | - echo "[E-Mail] " . $admin_details['email'] . "<br/>"; |
|
169 | + echo "[E-Mail] ".$admin_details['email']."<br/>"; |
|
170 | 170 | } |
171 | 171 | echo "</td></tr>"; |
172 | 172 | $temparray[] = $candidate; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $buffer = ""; |
180 | 180 | |
181 | 181 | foreach ($unmappedentities as $v) { |
182 | - $buffer .= "<option value='" . $v['ID'] . "'>[ID " . $v['ID'] . "] " . $v['name'] . "</option>"; |
|
182 | + $buffer .= "<option value='".$v['ID']."'>[ID ".$v['ID']."] ".$v['name']."</option>"; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | if ($buffer != "") { |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | } |
191 | 191 | // issue a big red warning if there are no link candidates at all in the federation |
192 | 192 | if (empty($buffer) && empty($candidates)) { |
193 | - echo "<tr><td style='color:#ff0000' colspan='2'>" . sprintf(_('There is no single unmapped %s in the external database for this %s!'), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed) . "</td></tr>"; |
|
193 | + echo "<tr><td style='color:#ff0000' colspan='2'>".sprintf(_('There is no single unmapped %s in the external database for this %s!'), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed)."</td></tr>"; |
|
194 | 194 | } |
195 | - echo "</table><button type='submit' name='submitbutton' id='submit' value='" . web\lib\common\FormElements::BUTTON_SAVE . "' disabled >" . _("Create Link") . "</button></form>"; |
|
195 | + echo "</table><button type='submit' name='submitbutton' id='submit' value='".web\lib\common\FormElements::BUTTON_SAVE."' disabled >"._("Create Link")."</button></form>"; |
|
196 | 196 | break; |
197 | 197 | default: |
198 | 198 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * <base_url>/copyright.php after deploying the software |
20 | 20 | */ |
21 | 21 | |
22 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
22 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
23 | 23 | ?> |
24 | 24 | |
25 | 25 | <!-- JQuery --> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | */ |
21 | 21 | ?> |
22 | 22 | <?php |
23 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
24 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/core/phpqrcode.php"; |
|
23 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
24 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/core/phpqrcode.php"; |
|
25 | 25 | |
26 | 26 | $auth = new \web\lib\admin\Authentication(); |
27 | 27 | $languageInstance = new \core\common\Language(); |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $invitationObject = new core\SilverbulletInvitation($validator->token(filter_input(INPUT_POST, 'token'))); |
40 | 40 | header("Content-Type:text/html;charset=utf-8"); |
41 | 41 | ?> |
42 | -<h1 style='text-align:center;'><?php echo _("Invitation Token QR Code");?></h1> |
|
42 | +<h1 style='text-align:center;'><?php echo _("Invitation Token QR Code"); ?></h1> |
|
43 | 43 | <img style='float:none' src='data:image/png;base64,<?php |
44 | 44 | // this cannot be NULL since $filename is FALSE; but make Scrutinizer happy. |
45 | 45 | $rawQr = \QRcode::png($invitationObject->link(), FALSE, QR_ECLEVEL_Q, 11); |
46 | 46 | if ($rawQr === NULL) { |
47 | 47 | throw new Exception("Something went seriously wrong during QR code generation!"); |
48 | 48 | } |
49 | -echo base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, 11));?>'/> |
|
50 | -<p>(<a href='<?php echo $invitationObject->link();?>'><?php echo $invitationObject->link();?>)</a></p> |
|
49 | +echo base64_encode($uiElements->pngInjectConsortiumLogo($rawQr, 11)); ?>'/> |
|
50 | +<p>(<a href='<?php echo $invitationObject->link(); ?>'><?php echo $invitationObject->link(); ?>)</a></p> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | ?> |
22 | 22 | <?php |
23 | -require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
23 | +require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
24 | 24 | |
25 | 25 | $auth = new \web\lib\admin\Authentication(); |
26 | 26 | $uiElements = new \web\lib\admin\UIElements(); |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | <?php |
58 | 58 | echo sprintf(_("On this page, you can add a new %s to your %s. Please fill out the form below to send out an email invitation to the new %s administrator."), $uiElements->nomenclatureInst, $uiElements->nomenclatureFed, $uiElements->nomenclatureInst); |
59 | 59 | if (CONFIG['DB']['enforce-external-sync']) { |
60 | - echo "<p>" . sprintf(_("You can either register a known %s (as defined in the %s database) or create a totally new %s."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclatureInst) . "</p>"; |
|
61 | - echo "<p>" . sprintf(_("The latter one is typically for an %s which is yet in a testing phase and therefore doesn't appear in the %s database yet."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name']) . "</p>"; |
|
60 | + echo "<p>".sprintf(_("You can either register a known %s (as defined in the %s database) or create a totally new %s."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclatureInst)."</p>"; |
|
61 | + echo "<p>".sprintf(_("The latter one is typically for an %s which is yet in a testing phase and therefore doesn't appear in the %s database yet."), $uiElements->nomenclatureInst, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'])."</p>"; |
|
62 | 62 | } |
63 | 63 | ?> |
64 | 64 | <hr/> |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | <?php |
69 | 69 | if (CONFIG['DB']['enforce-external-sync']) { |
70 | 70 | echo "<tr><td> |
71 | - <input type='radio' name='creation' value='existing'>" . _("Existing IdP:") . "</input> |
|
71 | + <input type='radio' name='creation' value='existing'>" . _("Existing IdP:")."</input> |
|
72 | 72 | </td>"; |
73 | 73 | |
74 | 74 | echo "<td colspan='2'> |
75 | 75 | <select id='externals' name='externals' onchange='document.sendinvite.creation[0].checked=true; document.sendinvite.mailaddr.value=this.options[this.selectedIndex].id;'> |
76 | - <option value='FREETEXT'>" . _("--- select IdP here ---") . "</option>"; |
|
76 | + <option value='FREETEXT'>" . _("--- select IdP here ---")."</option>"; |
|
77 | 77 | |
78 | 78 | foreach ($feds as $fed_value) { |
79 | 79 | $thefed = new \core\Federation(strtoupper($fed_value['value'])); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $entities = $thefed->listExternalEntities(TRUE); |
83 | 83 | |
84 | 84 | foreach ($entities as $v) { |
85 | - echo "<option id='" . $v['contactlist'] . "' value='" . $v['ID'] . "'>[" . $fed_value['value'] . "] " . $v['name'] . "</option>"; |
|
85 | + echo "<option id='".$v['contactlist']."' value='".$v['ID']."'>[".$fed_value['value']."] ".$v['name']."</option>"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 |
@@ -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(__DIR__)) . "/config/_config.php"; |
|
22 | +require_once dirname(dirname(__DIR__))."/config/_config.php"; |
|
23 | 23 | |
24 | 24 | $deco = new \web\lib\admin\PageDecoration(); |
25 | 25 | $validator = new \web\lib\common\InputValidation(); |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | foreach ($preflist as $method) { |
55 | 55 | $escapedMethod = $method->getIntegerRep(); |
56 | - echo "<th style='min-width:200px'>" . $method->getPrintableRep() . "<br/> |
|
56 | + echo "<th style='min-width:200px'>".$method->getPrintableRep()."<br/> |
|
57 | 57 | <form method='post' action='inc/toggleRedirect.inc.php?inst_id=$my_inst->identifier&profile_id=$my_profile->identifier' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'> |
58 | 58 | <input type='hidden' name='eaptype' value='$escapedMethod'> |
59 | - <button class='redirect' type='submit'>" . _("EAP-Type-specific options...") . "</button> |
|
59 | + <button class='redirect' type='submit'>"._("EAP-Type-specific options...")."</button> |
|
60 | 60 | </form></th>"; |
61 | 61 | } |
62 | 62 | ?> |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | foreach (\devices\Devices::listDevices() as $index => $description) { |
73 | 73 | |
74 | 74 | echo "<tr>"; |
75 | - echo "<td align='center'><img src='../resources/images/vendorlogo/" . $description['group'] . ".png' alt='logo'></td><td>" . $description['display'] . "<br/> |
|
75 | + echo "<td align='center'><img src='../resources/images/vendorlogo/".$description['group'].".png' alt='logo'></td><td>".$description['display']."<br/> |
|
76 | 76 | <form method='post' action='inc/toggleRedirect.inc.php?inst_id=$my_inst->identifier&profile_id=$my_profile->identifier' onsubmit='popupRedirectWindow(this); return false;' accept-charset='UTF-8'> |
77 | 77 | <input type='hidden' name='device' value='$index'> |
78 | - <button class='redirect' type='submit'>" . _("Device-specific options...") . "</button> |
|
78 | + <button class='redirect' type='submit'>"._("Device-specific options...")."</button> |
|
79 | 79 | </form> |
80 | 80 | </td>"; |
81 | 81 | $factory = new \core\DeviceFactory($index); |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | $footnotesForDevEapCombo = []; |
85 | 85 | $display_footnote = FALSE; |
86 | 86 | $langObject = new \core\common\Language(); |
87 | - $downloadform = "<form action='" . rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/') . "/user/API.php?action=downloadInstaller&profile=$my_profile->identifier&lang=" . $langObject->getLang() . "' method='post' accept-charset='UTF-8'> |
|
87 | + $downloadform = "<form action='".rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/')."/user/API.php?action=downloadInstaller&profile=$my_profile->identifier&lang=".$langObject->getLang()."' method='post' accept-charset='UTF-8'> |
|
88 | 88 | <input type='hidden' name='device' value='$index'/> |
89 | 89 | <input type='hidden' name='generatedfor' value='admin'/> |
90 | - <button class='download'>" . _("Download") . "</button> |
|
90 | + <button class='download'>"._("Download")."</button> |
|
91 | 91 | "; |
92 | 92 | // first of all: if redirected, indicate by color |
93 | 93 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | </table> |
159 | 159 | <?php |
160 | 160 | if (count($distinctFootnotes)) { |
161 | - echo "<p><strong>" . _("Footnotes:") . "</strong></p><table>"; |
|
161 | + echo "<p><strong>"._("Footnotes:")."</strong></p><table>"; |
|
162 | 162 | foreach ($distinctFootnotes as $number => $text) { |
163 | 163 | echo "<tr><td>($number) - </td><td>$text</td></tr>"; |
164 | 164 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | ?> |
28 | 28 | <?php |
29 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
29 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
30 | 30 | |
31 | 31 | $auth = new \web\lib\admin\Authentication(); |
32 | 32 | $deco = new \web\lib\admin\PageDecoration(); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | ?> |
62 | 62 | </h1> |
63 | 63 | <div class='infobox'> |
64 | - <h2><?php echo sprintf(_("%s Properties"),$uiElements->nomenclatureFed); ?></h2> |
|
64 | + <h2><?php echo sprintf(_("%s Properties"), $uiElements->nomenclatureFed); ?></h2> |
|
65 | 65 | <table> |
66 | 66 | <tr> |
67 | 67 | <td><?php echo _("Country:"); ?></td> |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | </table> |
73 | 73 | </div> |
74 | 74 | <?php |
75 | - echo "<form enctype='multipart/form-data' action='edit_federation_result.php?fed_id=$my_fed->tld" . "' method='post' accept-charset='UTF-8'> |
|
76 | - <input type='hidden' name='MAX_FILE_SIZE' value='" . CONFIG['MAX_UPLOAD_SIZE'] . "'>"; |
|
75 | + echo "<form enctype='multipart/form-data' action='edit_federation_result.php?fed_id=$my_fed->tld"."' method='post' accept-charset='UTF-8'> |
|
76 | + <input type='hidden' name='MAX_FILE_SIZE' value='" . CONFIG['MAX_UPLOAD_SIZE']."'>"; |
|
77 | 77 | ?> |
78 | 78 | <fieldset class="option_container"> |
79 | - <legend><strong><?php echo sprintf(_("%s Properties"),$uiElements->nomenclatureFed); ?></strong></legend> |
|
79 | + <legend><strong><?php echo sprintf(_("%s Properties"), $uiElements->nomenclatureFed); ?></strong></legend> |
|
80 | 80 | <?php |
81 | 81 | $optionDisplay = new \web\lib\admin\OptionDisplay($fed_options, "FED"); |
82 | 82 | echo $optionDisplay->prefilledOptionTable("fed"); |
@@ -84,5 +84,5 @@ discard block |
||
84 | 84 | <button type='button' class='newoption' onclick='getXML("fed")'><?php echo _("Add new option"); ?></button> |
85 | 85 | </fieldset> |
86 | 86 | <?php |
87 | - echo "<div><button type='submit' name='submitbutton' value='" . web\lib\common\FormElements::BUTTON_SAVE . "'>" . _("Save data") . "</button> <button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_federation.php\"'>" . _("Discard changes") . "</button></div></form>"; |
|
87 | + echo "<div><button type='submit' name='submitbutton' value='".web\lib\common\FormElements::BUTTON_SAVE."'>"._("Save data")."</button> <button type='button' class='delete' name='abortbutton' value='abort' onclick='javascript:window.location = \"overview_federation.php\"'>"._("Discard changes")."</button></div></form>"; |
|
88 | 88 | echo $deco->footer(); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @author Stefan Winter <[email protected]> |
26 | 26 | */ |
27 | 27 | |
28 | -require_once dirname(dirname(dirname(__FILE__))) . "/config/_config.php"; |
|
28 | +require_once dirname(dirname(dirname(__FILE__)))."/config/_config.php"; |
|
29 | 29 | |
30 | 30 | $auth = new \web\lib\admin\Authentication(); |
31 | 31 | $deco = new \web\lib\admin\PageDecoration(); |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | $my_fed = $validator->Federation($_GET['fed_id'], $_SESSION['user']); |
41 | 41 | if (isset($_POST['submitbutton']) && $_POST['submitbutton'] == web\lib\common\FormElements::BUTTON_SAVE) { // here we go |
42 | 42 | $fed_name = $my_fed->name; |
43 | - echo "<h1>" . sprintf(_("Submitted attributes for %s '%s'"), $uiElements->nomenclatureFed, $fed_name) . "</h1>"; |
|
43 | + echo "<h1>".sprintf(_("Submitted attributes for %s '%s'"), $uiElements->nomenclatureFed, $fed_name)."</h1>"; |
|
44 | 44 | echo "<table>"; |
45 | 45 | echo $optionParser->processSubmittedFields($my_fed, $_POST, $_FILES); |
46 | 46 | echo "</table>"; |
47 | 47 | |
48 | 48 | $loggerInstance = new \core\common\Logging(); |
49 | - $loggerInstance->writeAudit($_SESSION['user'], "MOD", "FED " . $my_fed->name . " - attributes changed"); |
|
49 | + $loggerInstance->writeAudit($_SESSION['user'], "MOD", "FED ".$my_fed->name." - attributes changed"); |
|
50 | 50 | |
51 | 51 | // re-instantiate ourselves... profiles need fresh data |
52 | 52 | |
53 | 53 | $my_fed = $validator->Federation($_GET['fed_id'], $_SESSION['user']); |
54 | 54 | |
55 | - echo "<br/><form method='post' action='overview_federation.php' accept-charset='UTF-8'><button type='submit'>" . _("Continue to dashboard") . "</button></form>"; |
|
55 | + echo "<br/><form method='post' action='overview_federation.php' accept-charset='UTF-8'><button type='submit'>"._("Continue to dashboard")."</button></form>"; |
|
56 | 56 | } |
57 | 57 | echo $deco->footer(); |
@@ -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 | $auth = new \web\lib\admin\Authentication(); |
25 | 25 | $deco = new \web\lib\admin\PageDecoration(); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $profile = $my_profile; |
116 | 116 | } else { |
117 | 117 | $profile = $my_inst->newProfile(core\AbstractProfile::PROFILETYPE_RADIUS); |
118 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $my_inst->identifier . " - Profile created"); |
|
118 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP ".$my_inst->identifier." - Profile created"); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $uiElements = new web\lib\admin\UIElements(); |
131 | 131 | // set realm info, if submitted |
132 | 132 | if ($realm !== FALSE) { |
133 | - $profile->setRealm($anonLocal . "@" . $realm); |
|
133 | + $profile->setRealm($anonLocal."@".$realm); |
|
134 | 134 | echo $uiElements->boxOkay(sprintf(_("Realm: <strong>%s</strong>"), $realm)); |
135 | 135 | } else { |
136 | 136 | $profile->setRealm(""); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | echo $uiElements->boxError(_("Realm check username cannot be configured: realm is missing!")); |
154 | 154 | } else { |
155 | 155 | $profile->setRealmcheckUser(true, $checkuser_name); |
156 | - echo $uiElements->boxOkay(sprintf(_("Special username for realm check is <strong>%s</strong>, the value is <strong>%s</strong>"), _("ON"), $checkuser_name . "@" . $realm)); |
|
156 | + echo $uiElements->boxOkay(sprintf(_("Special username for realm check is <strong>%s</strong>, the value is <strong>%s</strong>"), _("ON"), $checkuser_name."@".$realm)); |
|
157 | 157 | } |
158 | 158 | } else { |
159 | 159 | $profile->setRealmCheckUser(false); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } else { |
167 | 167 | $profile->setInputVerificationPreference($verify, $hint); |
168 | 168 | if ($hint !== FALSE) { |
169 | - $extratext = " " . sprintf(_("and the input field will be prefilled with '<strong>@%s</strong>'."), $realm); |
|
169 | + $extratext = " ".sprintf(_("and the input field will be prefilled with '<strong>@%s</strong>'."), $realm); |
|
170 | 170 | } else { |
171 | 171 | $extratext = "."; |
172 | 172 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | echo $uiElements->boxOkay(_("Redirection is <strong>OFF</strong>")); |
204 | 204 | } |
205 | 205 | |
206 | - $loggerInstance->writeAudit($_SESSION['user'], "MOD", "Profile " . $profile->identifier . " - attributes changed"); |
|
206 | + $loggerInstance->writeAudit($_SESSION['user'], "MOD", "Profile ".$profile->identifier." - attributes changed"); |
|
207 | 207 | |
208 | 208 | // re-instantiate $profile, we need to do completion checks and need fresh data for isEapTypeDefinitionComplete() |
209 | 209 | |
@@ -216,23 +216,23 @@ discard block |
||
216 | 216 | if ($a->getIntegerRep() == \core\common\EAP::INTEGER_SILVERBULLET) { // do not allow adding silverbullet via the backdoor |
217 | 217 | continue; |
218 | 218 | } |
219 | - if (isset($_POST[$a->getPrintableRep()]) && isset($_POST[$a->getPrintableRep() . "-priority"]) && is_numeric($_POST[$a->getPrintableRep() . "-priority"])) { |
|
220 | - $priority = (int) $_POST[$a->getPrintableRep() . "-priority"]; |
|
219 | + if (isset($_POST[$a->getPrintableRep()]) && isset($_POST[$a->getPrintableRep()."-priority"]) && is_numeric($_POST[$a->getPrintableRep()."-priority"])) { |
|
220 | + $priority = (int) $_POST[$a->getPrintableRep()."-priority"]; |
|
221 | 221 | // add EAP type to profile as requested, but ... |
222 | 222 | $profile->addSupportedEapMethod($a, $priority); |
223 | - $loggerInstance->writeAudit($_SESSION['user'], "MOD", "Profile " . $profile->identifier . " - supported EAP types changed"); |
|
223 | + $loggerInstance->writeAudit($_SESSION['user'], "MOD", "Profile ".$profile->identifier." - supported EAP types changed"); |
|
224 | 224 | // see if we can enable the EAP type, or if info is missing |
225 | 225 | $eapcompleteness = $profile->isEapTypeDefinitionComplete($a); |
226 | 226 | if ($eapcompleteness === true) { |
227 | - echo $uiElements->boxOkay(_("Supported EAP Type: ") . "<strong>" . $a->getPrintableRep() . "</strong>"); |
|
227 | + echo $uiElements->boxOkay(_("Supported EAP Type: ")."<strong>".$a->getPrintableRep()."</strong>"); |
|
228 | 228 | } else { |
229 | 229 | $warntext = ""; |
230 | 230 | if (is_array($eapcompleteness)) { |
231 | 231 | foreach ($eapcompleteness as $item) { |
232 | - $warntext .= "<strong>" . $uiElements->displayName($item) . "</strong> "; |
|
232 | + $warntext .= "<strong>".$uiElements->displayName($item)."</strong> "; |
|
233 | 233 | } |
234 | 234 | } |
235 | - echo $uiElements->boxWarning(sprintf(_("Supported EAP Type: <strong>%s</strong> is missing required information %s !"), $a->getPrintableRep(), $warntext) . "<br/>" . _("The EAP type was added to the profile, but you need to complete the missing information before we can produce installers for you.")); |
|
235 | + echo $uiElements->boxWarning(sprintf(_("Supported EAP Type: <strong>%s</strong> is missing required information %s !"), $a->getPrintableRep(), $warntext)."<br/>"._("The EAP type was added to the profile, but you need to complete the missing information before we can produce installers for you.")); |
|
236 | 236 | } |
237 | 237 | } |
238 | 238 | } |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | <?php |
249 | 249 | if (count($reloadedProfile->getEapMethodsinOrderOfPreference(1)) > 0) { |
250 | 250 | echo "<form method='post' action='overview_installers.php?inst_id=$my_inst->identifier&profile_id=$reloadedProfile->identifier' accept-charset='UTF-8'> |
251 | - <button type='submit'>" . _("Continue to Installer Fine-Tuning and Download") . "</button> |
|
251 | + <button type='submit'>"._("Continue to Installer Fine-Tuning and Download")."</button> |
|
252 | 252 | </form>"; |
253 | 253 | } |
254 | 254 | echo $deco->footer(); |
@@ -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); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | // extract relevant subset of information from cert objects |
430 | 430 | $certDetails = []; |
431 | 431 | foreach ($certs as $cert) { |
432 | - $certDetails[$cert->ca_type . ":" . $cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username]; |
|
432 | + $certDetails[$cert->ca_type.":".$cert->serial] = ["ISSUED" => $cert->issued, "EXPIRY" => $cert->expiry, "STATUS" => $cert->status, "DEVICE" => $cert->device, "CN" => $cert->username]; |
|
433 | 433 | } |
434 | 434 | $adminApi->returnSuccess($certDetails); |
435 | 435 | break; |
@@ -115,212 +115,212 @@ 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"]; |
|
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); |
|
170 | 132 | } |
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']); |
|
193 | - } |
|
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_NEWPROF_RADIUS: |
|
204 | - // fall-through intended: both get mostly identical treatment |
|
205 | - case web\lib\admin\API::ACTION_NEWPROF_SB: |
|
206 | - try { |
|
207 | - $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
208 | - } catch (Exception $e) { |
|
209 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
210 | - exit(1); |
|
211 | - } |
|
212 | - if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) { |
|
213 | - $type = "RADIUS"; |
|
214 | - } else { |
|
215 | - $type = "SILVERBULLET"; |
|
216 | - } |
|
217 | - $profile = $idp->newProfile($type); |
|
218 | - if ($profile === NULL) { |
|
219 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support."); |
|
220 | - exit(1); |
|
221 | - } |
|
222 | - $inputs = $adminApi->uglify($scrubbedParameters); |
|
223 | - $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]); |
|
224 | - if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) { |
|
225 | - // auto-accept ToU? |
|
226 | - if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) { |
|
227 | - $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1); |
|
228 | - } |
|
229 | - // we're done at this point |
|
230 | - $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]); |
|
231 | - continue; |
|
232 | - } |
|
233 | - if (!$profile instanceof core\ProfileRADIUS) { |
|
234 | - throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS."); |
|
235 | - } |
|
236 | - /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM'; |
|
237 | - const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */ |
|
238 | - $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM); |
|
239 | - $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE); |
|
240 | - if ($realm !== FALSE) { |
|
241 | - if ($outer === FALSE) { |
|
242 | - $outer = ""; |
|
243 | - $profile->setAnonymousIDSupport(FALSE); |
|
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']); |
|
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_NEWPROF_RADIUS: |
|
204 | + // fall-through intended: both get mostly identical treatment |
|
205 | + case web\lib\admin\API::ACTION_NEWPROF_SB: |
|
206 | + try { |
|
207 | + $idp = $validator->IdP($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_INST_ID)); |
|
208 | + } catch (Exception $e) { |
|
209 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "IdP identifier does not exist!"); |
|
210 | + exit(1); |
|
211 | + } |
|
212 | + if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_RADIUS) { |
|
213 | + $type = "RADIUS"; |
|
244 | 214 | } else { |
245 | - $outer = $outer . "@"; |
|
246 | - $profile->setAnonymousIDSupport(TRUE); |
|
215 | + $type = "SILVERBULLET"; |
|
247 | 216 | } |
248 | - $profile->setRealm($outer . $realm); |
|
249 | - } |
|
250 | - /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */ |
|
251 | - $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER); |
|
252 | - if ($testuser !== FALSE) { |
|
253 | - $profile->setRealmCheckUser(TRUE, $testuser); |
|
254 | - } |
|
255 | - /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM'; |
|
217 | + $profile = $idp->newProfile($type); |
|
218 | + if ($profile === NULL) { |
|
219 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INTERNAL_ERROR, "Unable to create a new Profile, for no apparent reason. Please contact support."); |
|
220 | + exit(1); |
|
221 | + } |
|
222 | + $inputs = $adminApi->uglify($scrubbedParameters); |
|
223 | + $optionParser->processSubmittedFields($profile, $inputs["POST"], $inputs["FILES"]); |
|
224 | + if ($inputDecoded['ACTION'] == web\lib\admin\API::ACTION_NEWPROF_SB) { |
|
225 | + // auto-accept ToU? |
|
226 | + if ($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_TOU) !== FALSE) { |
|
227 | + $profile->addAttribute("hiddenprofile:tou_accepted", NULL, 1); |
|
228 | + } |
|
229 | + // we're done at this point |
|
230 | + $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profile->identifier]); |
|
231 | + continue; |
|
232 | + } |
|
233 | + if (!$profile instanceof core\ProfileRADIUS) { |
|
234 | + throw new Exception("Can't be. This is only here to convince Scrutinizer that we're really talking RADIUS."); |
|
235 | + } |
|
236 | + /* const AUXATTRIB_PROFILE_REALM = 'ATTRIB-PROFILE-REALM'; |
|
237 | + const AUXATTRIB_PROFILE_OUTERVALUE = 'ATTRIB-PROFILE-OUTERVALUE'; */ |
|
238 | + $realm = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_REALM); |
|
239 | + $outer = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_OUTERVALUE); |
|
240 | + if ($realm !== FALSE) { |
|
241 | + if ($outer === FALSE) { |
|
242 | + $outer = ""; |
|
243 | + $profile->setAnonymousIDSupport(FALSE); |
|
244 | + } else { |
|
245 | + $outer = $outer . "@"; |
|
246 | + $profile->setAnonymousIDSupport(TRUE); |
|
247 | + } |
|
248 | + $profile->setRealm($outer . $realm); |
|
249 | + } |
|
250 | + /* const AUXATTRIB_PROFILE_TESTUSER = 'ATTRIB-PROFILE-TESTUSER'; */ |
|
251 | + $testuser = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_TESTUSER); |
|
252 | + if ($testuser !== FALSE) { |
|
253 | + $profile->setRealmCheckUser(TRUE, $testuser); |
|
254 | + } |
|
255 | + /* const AUXATTRIB_PROFILE_INPUT_HINT = 'ATTRIB-PROFILE-HINTREALM'; |
|
256 | 256 | const AUXATTRIB_PROFILE_INPUT_VERIFY = 'ATTRIB-PROFILE-VERIFYREALM'; */ |
257 | - $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT); |
|
258 | - $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY); |
|
259 | - if ($enforce !== FALSE) { |
|
260 | - $profile->setInputVerificationPreference($enforce, $hint); |
|
261 | - } |
|
262 | - /* const AUXATTRIB_PROFILE_EAPTYPE */ |
|
263 | - $iterator = 1; |
|
264 | - foreach ($scrubbedParameters as $oneParam) { |
|
265 | - if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) { |
|
266 | - $type = new \core\common\EAP($oneParam["VALUE"]); |
|
267 | - $profile->addSupportedEapMethod($type, $iterator); |
|
268 | - $iterator = $iterator + 1; |
|
257 | + $hint = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_HINT); |
|
258 | + $enforce = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_PROFILE_INPUT_VERIFY); |
|
259 | + if ($enforce !== FALSE) { |
|
260 | + $profile->setInputVerificationPreference($enforce, $hint); |
|
269 | 261 | } |
270 | - } |
|
271 | - // reinstantiate $profile freshly from DB - it was updated in the process |
|
272 | - $profileFresh = new core\ProfileRADIUS($profile->identifier); |
|
273 | - $profileFresh->prepShowtime(); |
|
274 | - $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]); |
|
275 | - break; |
|
276 | - case web\lib\admin\API::ACTION_ENDUSER_NEW: |
|
277 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
278 | - if ($prof_id === FALSE) { |
|
279 | - exit(1); |
|
280 | - } |
|
281 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
282 | - if ($evaluation === FALSE) { |
|
283 | - exit(1); |
|
284 | - } |
|
285 | - list($idp, $profile) = $evaluation; |
|
286 | - $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME)); |
|
287 | - $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY); |
|
288 | - if ($expiryRaw === FALSE) { |
|
289 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request."); |
|
290 | - exit(1); |
|
291 | - } |
|
292 | - $expiry = new DateTime($expiryRaw); |
|
293 | - try { |
|
294 | - $retval = $profile->addUser($user, $expiry); |
|
295 | - } catch (Exception $e) { |
|
296 | - $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?"); |
|
297 | - exit(1); |
|
298 | - } |
|
299 | - if ($retval == 0) {// that didn't work, it seems |
|
300 | - $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators."); |
|
301 | - exit(1); |
|
302 | - } |
|
303 | - $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]); |
|
304 | - break; |
|
305 | - case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
|
306 | - // fall-through intended: both actions are very similar |
|
307 | - case \web\lib\admin\API::ACTION_TOKEN_NEW: |
|
308 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
309 | - if ($profile_id === FALSE) { |
|
310 | - exit(1); |
|
311 | - } |
|
312 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
313 | - if ($evaluation === FALSE) { |
|
314 | - exit(1); |
|
315 | - } |
|
316 | - list($idp, $profile) = $evaluation; |
|
317 | - $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID)); |
|
318 | - if ($userId === FALSE) { |
|
319 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer."); |
|
320 | - exit(1); |
|
321 | - } |
|
322 | - $additionalInfo = []; |
|
323 | - switch ($inputDecoded['ACTION']) { // this is where the two differ |
|
262 | + /* const AUXATTRIB_PROFILE_EAPTYPE */ |
|
263 | + $iterator = 1; |
|
264 | + foreach ($scrubbedParameters as $oneParam) { |
|
265 | + if ($oneParam['NAME'] == web\lib\admin\API::AUXATTRIB_PROFILE_EAPTYPE && is_int($oneParam["VALUE"])) { |
|
266 | + $type = new \core\common\EAP($oneParam["VALUE"]); |
|
267 | + $profile->addSupportedEapMethod($type, $iterator); |
|
268 | + $iterator = $iterator + 1; |
|
269 | + } |
|
270 | + } |
|
271 | + // reinstantiate $profile freshly from DB - it was updated in the process |
|
272 | + $profileFresh = new core\ProfileRADIUS($profile->identifier); |
|
273 | + $profileFresh->prepShowtime(); |
|
274 | + $adminApi->returnSuccess([\web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID => $profileFresh->identifier]); |
|
275 | + break; |
|
276 | + case web\lib\admin\API::ACTION_ENDUSER_NEW: |
|
277 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
278 | + if ($prof_id === FALSE) { |
|
279 | + exit(1); |
|
280 | + } |
|
281 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
282 | + if ($evaluation === FALSE) { |
|
283 | + exit(1); |
|
284 | + } |
|
285 | + list($idp, $profile) = $evaluation; |
|
286 | + $user = $validator->string($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME)); |
|
287 | + $expiryRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_EXPIRY); |
|
288 | + if ($expiryRaw === FALSE) { |
|
289 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "The expiry date wasn't found in the request."); |
|
290 | + exit(1); |
|
291 | + } |
|
292 | + $expiry = new DateTime($expiryRaw); |
|
293 | + try { |
|
294 | + $retval = $profile->addUser($user, $expiry); |
|
295 | + } catch (Exception $e) { |
|
296 | + $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed. Maybe a duplicate username, or malformed expiry date?"); |
|
297 | + exit(1); |
|
298 | + } |
|
299 | + if ($retval == 0) {// that didn't work, it seems |
|
300 | + $adminApi->returnError(web\lib\admin\API::ERROR_INTERNAL_ERROR, "The operation failed subtly. Contact the administrators."); |
|
301 | + exit(1); |
|
302 | + } |
|
303 | + $adminApi->returnSuccess([web\lib\admin\API::AUXATTRIB_SB_USERNAME => $user, \web\lib\admin\API::AUXATTRIB_SB_USERID => $retval]); |
|
304 | + break; |
|
305 | + case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
|
306 | + // fall-through intended: both actions are very similar |
|
307 | + case \web\lib\admin\API::ACTION_TOKEN_NEW: |
|
308 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
309 | + if ($profile_id === FALSE) { |
|
310 | + exit(1); |
|
311 | + } |
|
312 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
313 | + if ($evaluation === FALSE) { |
|
314 | + exit(1); |
|
315 | + } |
|
316 | + list($idp, $profile) = $evaluation; |
|
317 | + $userId = $validator->integer($adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID)); |
|
318 | + if ($userId === FALSE) { |
|
319 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "User ID is not an integer."); |
|
320 | + exit(1); |
|
321 | + } |
|
322 | + $additionalInfo = []; |
|
323 | + switch ($inputDecoded['ACTION']) { // this is where the two differ |
|
324 | 324 | case \web\lib\admin\API::ACTION_ENDUSER_DEACTIVATE: |
325 | 325 | $result = $profile->deactivateUser($userId); |
326 | 326 | break; |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | } |
354 | 354 | } |
355 | 355 | break; |
356 | - } |
|
356 | + } |
|
357 | 357 | |
358 | 358 | if ($result !== TRUE) { |
359 | 359 | $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "These parameters did not lead to an existing, active user."); |
@@ -361,65 +361,65 @@ discard block |
||
361 | 361 | } |
362 | 362 | $adminApi->returnSuccess($additionalInfo); |
363 | 363 | break; |
364 | - case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY: |
|
365 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
366 | - if ($profile_id === FALSE) { |
|
367 | - exit(1); |
|
368 | - } |
|
369 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
370 | - if ($evaluation === FALSE) { |
|
371 | - exit(1); |
|
372 | - } |
|
373 | - list($idp, $profile) = $evaluation; |
|
374 | - $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
375 | - $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME); |
|
376 | - $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
377 | - if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) { |
|
378 | - // we need at least one of those |
|
379 | - $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required."); |
|
380 | - } |
|
381 | - $userlist = $profile->listAllUsers(); |
|
382 | - if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID |
|
383 | - if (!isset($userlist[$userId])) { |
|
384 | - return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile."); |
|
364 | + case \web\lib\admin\API::ACTION_ENDUSER_IDENTIFY: |
|
365 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
366 | + if ($profile_id === FALSE) { |
|
367 | + exit(1); |
|
385 | 368 | } |
386 | - $adminApi->returnSuccess([$userId => $userlist[$userId]]); |
|
387 | - } |
|
388 | - if ($userId === FALSE && $certSerial === FALSE) { // we got a username |
|
389 | - $key = array_search($userName, $userlist); |
|
390 | - if ($key === FALSE) { |
|
391 | - return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile."); |
|
369 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
370 | + if ($evaluation === FALSE) { |
|
371 | + exit(1); |
|
392 | 372 | } |
393 | - $adminApi->returnSuccess([$key => $userlist[$key]]); |
|
394 | - } |
|
395 | - if ($userId === FALSE && $userName === FALSE) { // we got a cert serial |
|
396 | - $serial = explode(":", $certSerial); |
|
397 | - $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
398 | - if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
399 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
373 | + list($idp, $profile) = $evaluation; |
|
374 | + $userId = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
375 | + $userName = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERNAME); |
|
376 | + $certSerial = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
377 | + if ($userId === FALSE && $userName === FALSE && $certSerial === FALSE) { |
|
378 | + // we need at least one of those |
|
379 | + $adminApi->returnError(\web\lib\admin\API::ERROR_MISSING_PARAMETER, "At least one of User ID, Username, or certificate serial is required."); |
|
400 | 380 | } |
401 | - if ($cert->profileId != $profile->identifier) { |
|
402 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
381 | + $userlist = $profile->listAllUsers(); |
|
382 | + if ($userName === FALSE && $certSerial === FALSE) { // we got a user ID |
|
383 | + if (!isset($userlist[$userId])) { |
|
384 | + return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This user ID does not exist in this profile."); |
|
385 | + } |
|
386 | + $adminApi->returnSuccess([$userId => $userlist[$userId]]); |
|
403 | 387 | } |
404 | - $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]); |
|
405 | - } |
|
406 | - $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified."); |
|
407 | - break; |
|
408 | - case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
|
409 | - // fall-through: those two are similar |
|
410 | - case \web\lib\admin\API::ACTION_TOKEN_LIST: |
|
411 | - $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
412 | - if ($profile_id === FALSE) { |
|
413 | - exit(1); |
|
414 | - } |
|
415 | - $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
416 | - if ($evaluation === FALSE) { |
|
417 | - exit(1); |
|
418 | - } |
|
419 | - list($idp, $profile) = $evaluation; |
|
420 | - $allUsers = $profile->listAllUsers(); |
|
421 | - // this is where they differ |
|
422 | - switch ($inputDecoded['ACTION']) { |
|
388 | + if ($userId === FALSE && $certSerial === FALSE) { // we got a username |
|
389 | + $key = array_search($userName, $userlist); |
|
390 | + if ($key === FALSE) { |
|
391 | + return $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "This username does not exist in this profile."); |
|
392 | + } |
|
393 | + $adminApi->returnSuccess([$key => $userlist[$key]]); |
|
394 | + } |
|
395 | + if ($userId === FALSE && $userName === FALSE) { // we got a cert serial |
|
396 | + $serial = explode(":", $certSerial); |
|
397 | + $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
398 | + if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
399 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
400 | + } |
|
401 | + if ($cert->profileId != $profile->identifier) { |
|
402 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
403 | + } |
|
404 | + $adminApi->returnSuccess([$cert->userId => $userlist[$cert->userId]]); |
|
405 | + } |
|
406 | + $adminApi->returnError(\web\lib\admin\API::ERROR_INVALID_PARAMETER, "Only exactly one of User ID, username or cert serial can be specified."); |
|
407 | + break; |
|
408 | + case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
|
409 | + // fall-through: those two are similar |
|
410 | + case \web\lib\admin\API::ACTION_TOKEN_LIST: |
|
411 | + $profile_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
412 | + if ($profile_id === FALSE) { |
|
413 | + exit(1); |
|
414 | + } |
|
415 | + $evaluation = commonSbProfileChecks($fed, $profile_id); |
|
416 | + if ($evaluation === FALSE) { |
|
417 | + exit(1); |
|
418 | + } |
|
419 | + list($idp, $profile) = $evaluation; |
|
420 | + $allUsers = $profile->listAllUsers(); |
|
421 | + // this is where they differ |
|
422 | + switch ($inputDecoded['ACTION']) { |
|
423 | 423 | case \web\lib\admin\API::ACTION_ENDUSER_LIST: |
424 | 424 | $adminApi->returnSuccess($allUsers); |
425 | 425 | break; |
@@ -438,71 +438,71 @@ discard block |
||
438 | 438 | $infoSet[$oneTokenObject->userId] = [\web\lib\admin\API::AUXATTRIB_TOKEN => $oneTokenObject->invitationTokenString, "STATUS" => $oneTokenObject->invitationTokenStatus]; |
439 | 439 | } |
440 | 440 | $adminApi->returnSuccess($infoSet); |
441 | - } |
|
442 | - break; |
|
443 | - case \web\lib\admin\API::ACTION_TOKEN_REVOKE: |
|
444 | - $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN); |
|
445 | - if ($tokenRaw === FALSE) { |
|
446 | - exit(1); |
|
447 | - } |
|
448 | - $token = new core\SilverbulletInvitation($tokenRaw); |
|
449 | - if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
|
450 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token."); |
|
451 | - exit(1); |
|
452 | - } |
|
453 | - $token->revokeInvitation(); |
|
454 | - $adminApi->returnSuccess([]); |
|
455 | - break; |
|
456 | - case \web\lib\admin\API::ACTION_CERT_LIST: |
|
457 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
458 | - $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
459 | - if ($prof_id === FALSE || !is_int($user_id)) { |
|
460 | - exit(1); |
|
461 | - } |
|
462 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
463 | - if ($evaluation === FALSE) { |
|
464 | - exit(1); |
|
465 | - } |
|
466 | - list($idp, $profile) = $evaluation; |
|
467 | - $invitations = $profile->userStatus($user_id); |
|
468 | - // now pull out cert information from the object |
|
469 | - $certs = []; |
|
470 | - foreach ($invitations as $oneInvitation) { |
|
471 | - $certs = array_merge($certs, $oneInvitation->associatedCertificates); |
|
472 | - } |
|
473 | - // extract relevant subset of information from cert objects |
|
474 | - $certDetails = []; |
|
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]; |
|
477 | - } |
|
478 | - $adminApi->returnSuccess($certDetails); |
|
479 | - break; |
|
480 | - case \web\lib\admin\API::ACTION_CERT_REVOKE: |
|
481 | - $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
482 | - if ($prof_id === FALSE) { |
|
483 | - exit(1); |
|
484 | - } |
|
485 | - $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
486 | - if ($evaluation === FALSE) { |
|
487 | - exit(1); |
|
488 | - } |
|
489 | - list($idp, $profile) = $evaluation; |
|
490 | - // tear apart the serial |
|
491 | - $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
492 | - if ($serialRaw === FALSE) { |
|
493 | - exit(1); |
|
494 | - } |
|
495 | - $serial = explode(":", $serialRaw); |
|
496 | - $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
497 | - if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
498 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
499 | - } |
|
500 | - if ($cert->profileId != $profile->identifier) { |
|
501 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
502 | - } |
|
503 | - $cert->revokeCertificate(); |
|
504 | - $adminApi->returnSuccess([]); |
|
441 | + } |
|
505 | 442 | break; |
506 | - default: |
|
507 | - $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet."); |
|
443 | + case \web\lib\admin\API::ACTION_TOKEN_REVOKE: |
|
444 | + $tokenRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_TOKEN); |
|
445 | + if ($tokenRaw === FALSE) { |
|
446 | + exit(1); |
|
447 | + } |
|
448 | + $token = new core\SilverbulletInvitation($tokenRaw); |
|
449 | + if ($token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_VALID && $token->invitationTokenStatus !== core\SilverbulletInvitation::SB_TOKENSTATUS_PARTIALLY_REDEEMED) { |
|
450 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "This is not a currently valid token."); |
|
451 | + exit(1); |
|
452 | + } |
|
453 | + $token->revokeInvitation(); |
|
454 | + $adminApi->returnSuccess([]); |
|
455 | + break; |
|
456 | + case \web\lib\admin\API::ACTION_CERT_LIST: |
|
457 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
458 | + $user_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_USERID); |
|
459 | + if ($prof_id === FALSE || !is_int($user_id)) { |
|
460 | + exit(1); |
|
461 | + } |
|
462 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
463 | + if ($evaluation === FALSE) { |
|
464 | + exit(1); |
|
465 | + } |
|
466 | + list($idp, $profile) = $evaluation; |
|
467 | + $invitations = $profile->userStatus($user_id); |
|
468 | + // now pull out cert information from the object |
|
469 | + $certs = []; |
|
470 | + foreach ($invitations as $oneInvitation) { |
|
471 | + $certs = array_merge($certs, $oneInvitation->associatedCertificates); |
|
472 | + } |
|
473 | + // extract relevant subset of information from cert objects |
|
474 | + $certDetails = []; |
|
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]; |
|
477 | + } |
|
478 | + $adminApi->returnSuccess($certDetails); |
|
479 | + break; |
|
480 | + case \web\lib\admin\API::ACTION_CERT_REVOKE: |
|
481 | + $prof_id = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_CAT_PROFILE_ID); |
|
482 | + if ($prof_id === FALSE) { |
|
483 | + exit(1); |
|
484 | + } |
|
485 | + $evaluation = commonSbProfileChecks($fed, $prof_id); |
|
486 | + if ($evaluation === FALSE) { |
|
487 | + exit(1); |
|
488 | + } |
|
489 | + list($idp, $profile) = $evaluation; |
|
490 | + // tear apart the serial |
|
491 | + $serialRaw = $adminApi->firstParameterInstance($scrubbedParameters, web\lib\admin\API::AUXATTRIB_SB_CERTSERIAL); |
|
492 | + if ($serialRaw === FALSE) { |
|
493 | + exit(1); |
|
494 | + } |
|
495 | + $serial = explode(":", $serialRaw); |
|
496 | + $cert = new \core\SilverbulletCertificate($serial[1], $serial[0]); |
|
497 | + if ($cert->status == \core\SilverbulletCertificate::CERTSTATUS_INVALID) { |
|
498 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial not found."); |
|
499 | + } |
|
500 | + if ($cert->profileId != $profile->identifier) { |
|
501 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_PARAMETER, "Serial does not belong to this profile."); |
|
502 | + } |
|
503 | + $cert->revokeCertificate(); |
|
504 | + $adminApi->returnSuccess([]); |
|
505 | + break; |
|
506 | + default: |
|
507 | + $adminApi->returnError(web\lib\admin\API::ERROR_INVALID_ACTION, "Not implemented yet."); |
|
508 | 508 | } |
509 | 509 | \ No newline at end of file |