63,19 → 63,22 |
* @throws OIDplusException |
*/ |
public function gui(string $id, array &$out, bool &$handled) { |
$tmp = explode('$',$id); |
$classname = $tmp[1] ?? ''; |
$parts = explode('$',$id,2); |
$subpage = $parts[1] ?? ''; |
|
$parts = explode('.',$tmp[0],2); |
if ($parts[0] != 'oidplus:rest_api_information_admin') return; |
if ($parts[0] == 'oidplus:rest_api_information_admin') { |
$handled = true; |
|
if (str_starts_with($classname, 'endpoints:')) { |
$plugin = OIDplus::getPluginByOid(explode(':',$classname)[1]); |
if (str_starts_with($subpage, 'endpoints:')) { |
// Note: This page can be accessed WITHOUT login! |
$plugin = OIDplus::getPluginByOid(explode(':',$subpage)[1]); |
if (!$plugin || !($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_9)) throw new OIDplusException(_L("No endpoints for this plugin found"), null, 404); |
$out['title'] = _L('REST API').' - '.$plugin->getManifest()->getName() . ' ' . _L('Endpoints'); |
$out['icon'] = file_exists(__DIR__.'/img/endpoints_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/endpoints_icon.png' : ''; |
$out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:rest_api_information_admin').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
$out['text'] = ''; |
if (OIDplus::authUtils()->isAdminLoggedIn()) { |
$out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:rest_api_information_admin').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
} |
$out['text'] .= $plugin->restApiInfo('html'); |
} else { |
$out['title'] = _L('REST API'); |
135,6 → 138,7 |
$out['text'] .= '<button type="button" name="btn_blacklist_jwt" id="btn_blacklist_jwt" class="btn btn-danger btn-xs" onclick="OIDplusPageAdminRestApi.blacklistJWT()">'._L('Blacklist all previously generated tokens').'</button>'; |
} |
} |
} |
|
/** |
* @param array $json |