Subversion Repositories oidplus

Rev

Rev 374 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
270 daniel-mar 1
#!/usr/bin/php
117 daniel-mar 2
<?php
3
 
511 daniel-mar 4
/*
5
 * OIDplus 2.0
6
 * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
 
117 daniel-mar 21
require_once __DIR__ . '/../includes/oidplus.inc.php';
22
 
270 daniel-mar 23
OIDplus::init(false);
117 daniel-mar 24
 
25
// This file tests all log events (to verify that the logmasks are working)
288 daniel-mar 26
// PLEASE DO NOT RUN THIS FILE ON A PRODUCTION DATABASE, BECAUSE IT WILL FILL YOUR LOG FILE WITH CRAP!
117 daniel-mar 27
 
28
$id = 'oid:2.999';
29
$email = 'oidra@viathinksoft.de';
30
$old_email = 'oidra@viathinksoft.de';
31
$new_email = 'oidra@viathinksoft.de';
32
$current_ra = 'oidra@viathinksoft.de';
33
$new_ra = 'oidra@viathinksoft.de';
34
$ra_email = 'oidra@viathinksoft.de';
35
$name = 'CFD';
36
$value = 'VAL';
37
$ra_name = 'Daniel';
38
$root_oid = '2.123';
39
$parent = 'oid:2';
40
$new_oid = 'oid:2.999.1';
288 daniel-mar 41
$system_id = '12345';
42
$parent_oid = 'oid:2.998';
43
$id_to_delete = 'oid:2.999';
117 daniel-mar 44
 
288 daniel-mar 45
// These are all lines of code that contain 'OIDplus::logger()->log'
270 daniel-mar 46
 
288 daniel-mar 47
OIDplus::logger()->log("[INFO]A!", "Generating new SystemID using a new key pair");
48
OIDplus::logger()->log("[INFO]A!", "Your SystemID is now $system_id");
49
OIDplus::logger()->log("[OK]A?", "Changed system config setting '$name' to '$value'");
50
OIDplus::logger()->log("[WARN]A!", "Removing SystemID and key pair because there is a hash conflict with another OIDplus system!");
51
 
52
OIDplus::logger()->log("[INFO]RA($email)!/A?", "RA '$email' was created by the admin, without email address verification or invitation");
53
 
54
 
55
 
56
OIDplus::logger()->log("[OK]A?", "Changed system color theme");
57
OIDplus::logger()->log("[WARN]OID($id)+[?WARN/!OK]SUPOIDRA($id)?/[?INFO/!OK]A?", "Object '$id' (recursively) deleted");
58
OIDplus::logger()->log("[CRIT]OIDRA($id)!", "Lost ownership of object '$id' because it was deleted");
59
OIDplus::logger()->log("[WARN]OID($parent_oid)", "Object '$id' (recursively) deleted");
60
OIDplus::logger()->log("[CRIT]OIDRA($id_to_delete)!", "Lost ownership of object '$id_to_delete' because one of the superior objects ('$id') was recursively deleted");
61
OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]SUPOIDRA($id)?/[?INFO/!OK]A?", "RA of object '$id' changed from '$current_ra' to '$new_ra'");
62
OIDplus::logger()->log("[WARN]RA($current_ra)!",           "Lost ownership of object '$id' due to RA transfer of superior RA / admin.");
63
OIDplus::logger()->log("[INFO]RA($new_ra)!",               "Gained ownership of object '$id' due to RA transfer of superior RA / admin.");
64
OIDplus::logger()->log("[INFO]OID($parent_oid)", "RA of object '$id' changed from '$current_ra' to '$new_ra'");
65
OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]SUPOIDRA($id)?/[?INFO/!OK]A?", "Identifiers/Confidential flag of object '$id' updated"); // TODO: Check if they were ACTUALLY updated!
66
OIDplus::logger()->log("[INFO]OID($parent_oid)", "Identifiers/Confidential flag of object '$id' updated"); // TODO: Check if they were ACTUALLY updated!
67
OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Title/Description of object '$id' updated");
68
OIDplus::logger()->log("[INFO]OID($parent)+[INFO]OID($id)+[?INFO/!OK]OIDRA($parent)?/[?INFO/!OK]A?", "Object '$id' created, ".(empty($ra_email) ? "without defined RA" : "given to RA '$ra_email'")).", superior object is '$parent'";
69
OIDplus::logger()->log("[INFO]RA($ra_email)!", "Gained ownership of newly created object '$id'");
70
OIDplus::logger()->log("[?WARN/!OK]RA($email)!/[?INFO/!OK]A?", "RA '$email' deleted");
71
OIDplus::logger()->log("[OK]RA($email)!", "RA '$email' logged in");
72
OIDplus::logger()->log("[OK]RA($email)!", "RA '$email' logged out");
73
OIDplus::logger()->log("[OK]A!", "Admin logged in");
74
OIDplus::logger()->log("[OK]A!", "Admin logged out");
75
OIDplus::logger()->log("[WARN]RA($email)!", "A new password for '$email' was requested (forgot password)");
76
OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has reset his password (forgot passwort)");
77
OIDplus::logger()->log("[INFO]OID(oid:$root_oid)+RA($email)!", "Requested a free OID for email '$email' to be placed into root '$root_oid'");
78
OIDplus::logger()->log("[INFO]OID(oid:$root_oid)+OIDRA(oid:$root_oid)!", "Child OID '$new_oid' added automatically by '$email' (RA Name: '$ra_name')");
79
OIDplus::logger()->log("[INFO]OID(oid:$new_oid)+[OK]RA($email)!",            "Free OID '$new_oid' activated (RA Name: '$ra_name')");
80
OIDplus::logger()->log("[INFO]RA($email)!", "RA '$email' has been invited");
81
OIDplus::logger()->log("[OK]RA($email)!", "RA '$email' has been registered due to invitation");
82
OIDplus::logger()->log("[?WARN/!OK]RA($email)?/[?INFO/!OK]A?", "Changed RA '$email' contact data/details");
83
OIDplus::logger()->log("[?WARN/!OK]RA($email)?/[?INFO/!OK]A?", "Password of RA '$email' changed");
84
OIDplus::logger()->log("[WARN]RA($old_email)!+[INFO]RA($new_email)!+[OK]A!", "Admin changed email address '$old_email' to '$new_email'");
85
OIDplus::logger()->log("[INFO]RA($old_email)!+RA($new_email)!", "Requested email address change from '$old_email' to '$new_email'");
86
OIDplus::logger()->log("[OK]RA($new_email)!+RA($old_email)!", "RA '$old_email' has changed their email address to '$new_email'");
87
 
310 daniel-mar 88
$msg = "test";
89
$uploadfile = "test";
90
OIDplus::logger()->log("[ERR]OID($id)+[ERR]A!", $msg);
91
OIDplus::logger()->log("[OK]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Deleted attachment '".basename($uploadfile)."' from object '$id'");
92
OIDplus::logger()->log("[ERR]OID($id)+[ERR]A!", $msg);
93
OIDplus::logger()->log("[OK]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Uploaded attachment '".basename($uploadfile)."' to object '$id'");
94
 
270 daniel-mar 95
echo "Done";