Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1444 → Rev 1445

/trunk/TODO
9,6 → 9,21
- Idea: If we enter "oid:2.999.123" in the goto box, and only "oid:2.999" exists, should we recommend the user to look at 2.999?
- <font color="red"> replace with CSS class
 
Important things:
- OIDplus must be able to handle large amount of OIDs, e.g. 100.000 OIDs in a branch. It don't need to be perfect, but it must not crash the system
Currently there are the following "hacks" to make the system not crash if there are too many OIDs
plugins/viathinksoft/raPages/099_object_log/OIDplusPageRaObjectLog.class.php (show max 100 object log entries)
plugins/frdl/publicPages/altids/OIDplusPagePublicAltIds.class.php (hardcoded to ignore children of 1.3.6.1.4.1.37476.1.2.3.1)
plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php (do not show ANY children if there are more than 1000)
includes/classes/OIDplusMenuUtils.class.php (do not show ANY children if there are more than 1000)
 
Logging pages: ra_log and admin_log pages (RA / Admin) as wells as OIDplusPageRaObjectLog (Objects):
- correctly implement ra_log (not show the system's pages, but the user's pages). Note that this is a hard task (see TODO entry)
- deluxe: scroll down and automatically get new log entries via ajax
- make it faster!!!
- filter by severity? (this is also a hard task)
- export CSV
 
Future:
- Check if we can also support these databases listed at the PHP documentation:
CUBRID
181,7 → 196,6
- Let the JavaScript value "oidplus_menu_width" being modified by a design plugin and/or the database config.
A plugin can already do this by using htmlHeaderUpdate() and creating an inline JavaScript to modify the global variable "oidplus_menu_width"
- At a lot of forms, if you press "enter", the "form" will not be submitted (e.g. "create ra" plugin), cannot reproduce?
- system log plugin: Only show 100 events and let the user switch pages. To avoid that you load a page with 10000+ log entries!
- Alpine Linux SVN update: I get the error "svn: warning: W000013: Can't open file '/root/.subversion/servers': Permission denied", although "whoami" is "apache"! (Maybe because the initial checkout was done by root?!)
- AutoUpdate via cron?
- Login page etc.: If user clicks on a tab, then the gotoedit and static link should change to e.g. "oidplus:login$admin" or "oidplus:login$ra", respectively.
287,7 → 301,6
 
LOGS
- prune logs entries? automatically prune things like "logged in" but not prune OID changes, etc?
- admin logs: don't show all logs. load more log entries as soon as the page is scrolled down
- when user changed email from "A" => "B", then all previous log events for "A" are not visible for "B" anymore!
=> should we also change the log entry email address references when the user changes their email address?
- At "oidplus:system_log", user log section and object log section, the users and/or objects should be clickable
/trunk/changelog.json.php
3,6 → 3,19
"dummy": "<?php die('For security reasons, this file can only be accessed locally (without PHP).'.base64_decode('IgogICAgfQpdCg==')); /* @phpstan-ignore-line */ ?>"
},
{
"version": "2.0.1.11",
"date": "2023-12-26 16:55:00 +0100",
"author": "Daniel Marschall (ViaThinkSoft)",
"changes": [
"RA and System log plugin: Split into pages.",
"Object Log view: only the last 100 items are shown due to overload protection (currently, no scrolling possible).",
"Overload protection: For now, an OID with more than 1000 children cannot show its children.",
"REST API: \"oid:\" prefix is now optional. \"weid:\" is also possible to refer to an OID.",
"REST API: GET request now also returns the fields \"created\" and \"updated\".",
"Admin area: Viewing RA accounts: Added link to RA log entries."
]
},
{
"version": "2.0.1.10",
"date": "2023-12-25 23:20:00 +0100",
"author": "Daniel Marschall (ViaThinkSoft)",
/trunk/includes/classes/OIDplusMenuUtils.class.php
126,7 → 126,10
 
$res = OIDplus::db()->query("select * from ###objects where parent = ?", array($parent));
$res->naturalSortByField('id');
$max_ent = 0;
while ($row = $res->fetch_array()) {
$max_ent++;
if ($max_ent > 1000) break; // TODO: we need a solution for this!!!
$obj = OIDplusObject::parse($row['id']);
if (!$obj) continue; // e.g. object-type plugin disabled
 
/trunk/plugins/frdl/publicPages/altids/OIDplusPagePublicAltIds.class.php
108,7 → 108,8
$alt_ids = array();
$rev_lookup = array();
 
$res = OIDplus::db()->query("select id from ###objects");
$res = OIDplus::db()->query("select id from ###objects ".
"where parent <> 'oid:1.3.6.1.4.1.37476.1.2.3.1'"); // TODO FIXME! readAll() is TOOOOO slow if a system has more than 50.000 OIDs!!! DEADLOCK!!!
while ($row = $res->fetch_array()) {
$obj = OIDplusObject::parse($row['id']);
if (!$obj) continue; // e.g. if plugin is disabled
239,6 → 240,7
 
$tmp = $this->getAlternativesForQuery($id);
sort($tmp); // DM 26.03.2023 : Added sorting (intended to sort "alternate-identifier")
 
foreach($tmp as $alt) {
if (strpos($alt,':') === false) continue;
 
/trunk/plugins/frdl/publicPages/altids/manifest.xml
10,7 → 10,7
<name>AltIds Tracking and Reverse Lookup</name>
<author>Frdlweb</author>
<license>MIT</license>
<version>1.0.3+viathinksoft20230326</version>
<version>1.0.3+viathinksoft20231226</version>
<descriptionHTML>
<![CDATA[
<a href="https://github.com/frdl/oidplus-plugin-alternate-id-tracking" target="_blank">AltIds Tracking and Reverse Lookup</a><br/>
/trunk/plugins/viathinksoft/adminPages/600_log/OIDplusPageAdminLogEvents.class.php
40,7 → 40,8
* @throws OIDplusException
*/
public function gui(string $id, array &$out, bool &$handled) {
if ($id == 'oidplus:system_log') {
$parts = explode('$', $id);
if ($parts[0] == 'oidplus:system_log') {
$handled = true;
$out['title'] = _L('All log messages');
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
49,10 → 50,27
throw new OIDplusHtmlException(_L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login$admin')), $out['title'], 401);
}
 
$res = OIDplus::db()->query("select lo.id, lo.unix_ts, lo.addr, lo.event from ###log lo ".
"order by lo.unix_ts desc");
$page = $parts[1] ?? null;
if ($page == null) {
$res = OIDplus::db()->query("select max(id) as cnt from ###log");
$page = floor($res->fetch_array()['cnt'] / 50) + 1;
}
$min = ($page-1) * 50 + 1;
$max = ($page ) * 50;
 
$res = OIDplus::db()->query("select id, unix_ts, addr, event from ###log ".
"where id >= ? and id <= ? ".
"order by unix_ts desc", [$min, $max]);
 
$out['text'] = '<h2>'._L('Page %1 (Log ID %2 till %3)', $page, $min, $max).'</h2>';
 
$out['text'] .= '<p>';
if (!is_null($parts[1] ?? null)) $out['text'] .= '<a '.OIDplus::gui()->link($parts[0].'$'.($page+1)).'>Newer log entries</a> -- ';
$out['text'] .= '<a '.OIDplus::gui()->link($parts[0].'$'.($page-1)).'>Older log entries</a>';
$out['text'] .= '<p>';
 
if ($res->any()) {
$out['text'] = '<pre>';
$out['text'] .= '<pre>';
while ($row = $res->fetch_array()) {
$severity = 0;
$contains_messages_for_me = false;
85,11 → 103,10
}
$out['text'] .= '</pre>';
} else {
$out['text'] .= '<p>'._L('Currently there are no log entries').'</p>';
$out['text'] .= '<p>'._L('There are no log entries on this page').'</p>';
}
 
// TODO: List logs in a table instead of a <pre> text
// TODO: Load only X events and then re-load new events via AJAX when the user scrolls down
}
}
 
/trunk/plugins/viathinksoft/adminPages/902_systemfile_check/checksums.json
Cannot display: file marked as a binary type.
svn:mime-type = application/json
/trunk/plugins/viathinksoft/language/dede/messages.xml
5478,6 → 5478,14
</message>
<message>
<source><![CDATA[
Page %1 (Log ID %2 till %3)
]]></source>
<target><![CDATA[
Seite %1 (Log-Eintrag %2 von %3)
]]></target>
</message>
<message>
<source><![CDATA[
Page plugins
]]></source>
<target><![CDATA[
7078,6 → 7086,14
</message>
<message>
<source><![CDATA[
Show log entries
]]></source>
<target><![CDATA[
Logbuch-Einträge zeigen
]]></target>
</message>
<message>
<source><![CDATA[
Signature failed
]]></source>
<target><![CDATA[
7966,6 → 7982,14
</message>
<message>
<source><![CDATA[
There are no log entries on this page
]]></source>
<target><![CDATA[
Es gibt keine Logbuch-Einträge auf dieser Seite
]]></target>
</message>
<message>
<source><![CDATA[
There are three possibilities how to keep OIDplus up-to-date
]]></source>
<target><![CDATA[
7974,6 → 7998,14
</message>
<message>
<source><![CDATA[
There are too many child items to display
]]></source>
<target><![CDATA[
Auflistung nicht möglich, da es zu viele Unterobjekte gibt
]]></target>
</message>
<message>
<source><![CDATA[
Therefore, you <b>cannot</b> register your OIDplus instance now.
]]></source>
<target><![CDATA[
/trunk/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php
99,6 → 99,10
*/
private function restApiCall_GET(string $endpoint, array $json_in): array {
$id = substr($endpoint, strlen('objects/'));
 
$id_original = $id;
$id = OIDplus::prefilterQuery($id, false);
 
$obj = OIDplusObject::findFitting($id);
if (!$obj) throw new OIDplusException(_L('The object %1 was not found in this database.', $id), null, 404);
 
128,6 → 132,9
}
}
 
$output['created'] = date('Y-m-d H:i:s', strtotime($obj->getCreatedTime()));
$output['updated'] = date('Y-m-d H:i:s', strtotime($obj->getUpdatedTime()));
 
$output['children'] = array();
$children = $obj->getChildren();
foreach ($children as $child) {
146,10 → 153,15
*/
private function restApiCall_PUT(string $endpoint, array $json_in): array {
$id = substr($endpoint, strlen('objects/'));
 
$id_original = $id;
$id = OIDplus::prefilterQuery($id, false);
 
$obj = OIDplusObject::parse($id);
if (!$obj) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!', 'PUT', $id), null, 400);
 
// ATTENTION: Do *not* use $params=$json_in. We intentionally set $params to empty strings if the values do not exist in $json_in,
// ATTENTION: Do *not* use $params=$json_in. Unlike in POST and PATCH, here at PUT we
// intentionally set $params to empty strings if the values do not exist in $json_in,
// because PUT is for re-creating the whole object!
$params = array();
$params['id'] = $id;
160,6 → 172,7
$params['description'] = $json_in['description'] ?? '';
$params['asn1ids'] = $json_in['asn1ids'] ?? array();
$params['iris'] = $json_in['iris'] ?? array();
// TODO: also allow params "created" and "updated"
 
if (OIDplusObject::exists($id)) {
// TODO: Problem: The superior RA cannot set title/description, so they cannot perform the PUT command!
188,6 → 201,10
*/
private function restApiCall_POST(string $endpoint, array $json_in): array {
$id = substr($endpoint, strlen('objects/'));
 
$id_original = $id;
$id = OIDplus::prefilterQuery($id, false);
 
$obj = OIDplusObject::parse($id);
if (!$obj) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!', 'GET', $id), null, 400);
$params = $json_in;
194,6 → 211,7
$params['parent'] = $obj->getParent()->nodeId(true);
$params['id_fully_qualified'] = true;
$params['id'] = $id;
// TODO: also allow params "created" and "updated"
$output = self::action_Insert($params);
 
$output['status_bits'] = [];
214,8 → 232,13
*/
private function restApiCall_PATCH(string $endpoint, array $json_in): array {
$id = substr($endpoint, strlen('objects/'));
 
$id_original = $id;
$id = OIDplus::prefilterQuery($id, false);
 
$params = $json_in;
$params['id'] = $id;
// TODO: also allow params "created" and "updated"
$output = self::action_Update($params);
 
$output['status_bits'] = [];
236,6 → 259,10
*/
private function restApiCall_DELETE(string $endpoint, array $json_in): array {
$id = substr($endpoint, strlen('objects/'));
 
$id_original = $id;
$id = OIDplus::prefilterQuery($id, false);
 
$params = $json_in;
$params['id'] = $id;
$output = self::action_Delete($params);
302,7 → 329,9
'confidential',
'title',
'description',
'children'
'children',
'created',
'updated'
]
],
_L('Re-Create') => [
1216,7 → 1245,15
$stufe = 0;
$menu_entries = array();
$stufen = array();
$max_ent = 0;
while ($row = $res->fetch_object()) {
$max_ent++;
if ($max_ent > 1000) { // TODO: we need to find a solution for this!!!
$menu_entry = array('id' => 'oidplus:system', 'icon' => '', 'text' => _L('There are too many child items to display'), 'indent' => 0);
$menu_entries[] = $menu_entry;
break;
}
 
$obj = OIDplusObject::parse($row->id);
if (!$obj) continue; // might happen if the objectType is not available/loaded
if (!$obj->userHasReadRights()) continue;
1388,7 → 1425,10
$result->naturalSortByField('id');
 
$rows = array();
$max_ent = 0;
while ($row = $result->fetch_object()) {
$max_ent++;
if ($max_ent > 1000) return _L('There are too many child items to display'); // TODO: we need to find a solution for this!!!
$obj = OIDplusObject::parse($row->id);
if ($obj) $rows[] = array($obj,$row);
}
/trunk/plugins/viathinksoft/publicPages/093_rainfo/OIDplusPagePublicRaInfo.class.php
95,7 → 95,12
if (!is_null($editContactDataPlugin)) {
$out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:edit_ra$'.$ra_email).'>'._L('Edit contact data').'</a></p>';
}
 
$editContactDataPlugin = OIDplus::getPluginByOid('1.3.6.1.4.1.37476.2.5.2.4.2.200'); // OIDplusPageRaLogEvents
if (!is_null($editContactDataPlugin)) {
$out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:ra_log$'.$ra_email).'>'._L('Show log entries').'</a></p>';
}
}
 
if (OIDplus::authUtils()->isAdminLoggedIn()) {
$raBasePlugin = OIDplus::getPluginByOid('1.3.6.1.4.1.37476.2.5.2.4.1.1'); // OIDplusPagePublicRaBaseUtils
/trunk/plugins/viathinksoft/raPages/099_object_log/OIDplusPageRaObjectLog.class.php
71,14 → 71,19
if (!$obj) return;
if (!$obj->userHasWriteRights()) return;
 
// TODO: !!! correctly implement page scrolling!!! Problem: We cannot use "limit" because this is MySQL. We cannot use "top" because it is SQL server
// We cannot use id>? and id<? like in admin_log, because users don't have all IDs, just a few, so we cannot filter by ID
$res = OIDplus::db()->query("select lo.id, lo.unix_ts, lo.addr, lo.event, lu.severity from ###log lo ".
"left join ###log_object lu on lu.log_id = lo.id ".
"where lu.object = ? " .
"order by lo.unix_ts desc", array($id));
$text .= '<h2>'._L('Log messages for object %1',htmlentities($id)).'</h2>';
$max_ent = 0;
if ($res->any()) {
$text .= '<pre>';
while ($row = $res->fetch_array()) {
$max_ent++;
if ($max_ent > 100) break; // TODO: also allow to watch older entries
$users = array();
$res2 = OIDplus::db()->query("select username, severity from ###log_user ".
"where log_id = ?", array((int)$row['id']));
94,7 → 99,6
$text .= '</pre>';
 
// TODO: List logs in a table instead of a <pre> text
// TODO: Load only X events and then re-load new events via AJAX when the user scrolls down
} else {
$text .= '<p>'._L('Currently there are no log entries').'</p>';
}
/trunk/plugins/viathinksoft/raPages/200_log/OIDplusPageRaLogEvents.class.php
40,11 → 40,13
* @throws OIDplusException
*/
public function gui(string $id, array &$out, bool &$handled) {
if (explode('$',$id)[0] == 'oidplus:ra_log') {
$parts = explode('$', $id);
if ($parts[0] == 'oidplus:ra_log') {
$ra_email = $parts[1] ?? null;
if ($ra_email == null) return;
 
$handled = true;
 
$ra_email = explode('$',$id)[1];
 
$out['title'] = _L('Log messages for RA %1',$ra_email);
$out['icon'] = file_exists(__DIR__.'/img/main_icon.png') ? OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/main_icon.png' : '';
 
57,12 → 59,35
throw new OIDplusHtmlException(_L('RA "%1" does not exist','<b>'.htmlentities($ra_email).'</b>'), $out['title']);
}
 
 
// TODO: !!! correctly implement page scrolling!!! Problem: We cannot use "limit" because this is MySQL. We cannot use "top" because it is SQL server
// We cannot use id>? and id<? like in admin_log, because users don't have all IDs, just a few, so we cannot filter by ID
$page = $parts[2] ?? null;
if ($page == null) {
$res = OIDplus::db()->query("select max(lo.id) as cnt from ###log lo ".
"left join ###log_user lu on lu.log_id = lo.id ".
"where lu.username = ? " .
"order by lo.unix_ts desc", array($ra_email));
$page = floor($res->fetch_array()['cnt'] / 50) + 1;
}
$min = ($page-1) * 50 + 1;
$max = ($page ) * 50;
 
$res = OIDplus::db()->query("select lo.unix_ts, lo.addr, lo.event, lu.severity from ###log lo ".
"left join ###log_user lu on lu.log_id = lo.id ".
"where lu.username = ? " .
"order by lo.unix_ts desc", array($ra_email));
"and lo.id >= ? and lo.id <= ? ".
"order by lo.unix_ts desc", array($ra_email, $min, $max));
 
$out['text'] = '<h2>'._L('Page %1 (Log ID %2 till %3)', $page, $min, $max).'</h2>';
 
$out['text'] .= '<p>';
if (!is_null($parts[2] ?? null)) $out['text'] .= '<a '.OIDplus::gui()->link($parts[0].'$'.$parts[1].'$'.($page+1)).'>Newer log entries</a> -- ';
$out['text'] .= '<a '.OIDplus::gui()->link($parts[0].'$'.$parts[1].'$'.($page-1)).'>Older log entries</a>';
$out['text'] .= '<p>';
 
if ($res->any()) {
$out['text'] = '<pre>';
$out['text'] .= '<pre>';
while ($row = $res->fetch_array()) {
$addr = empty($row['addr']) ? _L('no address') : $row['addr'];
 
70,11 → 95,10
}
$out['text'] .= '</pre>';
} else {
$out['text'] .= '<p>'._L('Currently there are no log entries').'</p>';
$out['text'] .= '<p>'._L('There are no log entries on this page').'</p>';
}
 
// TODO: List logs in a table instead of a <pre> text
// TODO: Load only X events and then re-load new events via AJAX when the user scrolls down
}
}