Subversion Repositories oidplus

Rev

Rev 1189 | Rev 1201 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1189 Rev 1199
Line 87... Line 87...
87
                                if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) {
87
                                if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) {
88
                                        $plugin->beforeObjectDelete($id);
88
                                        $plugin->beforeObjectDelete($id);
89
                                }
89
                                }
90
                        }
90
                        }
91
 
91
 
92
                        OIDplus::logger()->log("[WARN]OID($id)+[?WARN/!OK]SUPOIDRA($id)?/[?INFO/!OK]A?", "Object '$id' (recursively) deleted");
92
                        OIDplus::logger()->log("[WARN]OID(%1)+[?WARN/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "Object '%1' (recursively) deleted", $id);
93
                        OIDplus::logger()->log("[CRIT]OIDRA($id)!", "Lost ownership of object '$id' because it was deleted");
93
                        OIDplus::logger()->log("[CRIT]OIDRA(%1)!", "Lost ownership of object '%1' because it was deleted", $id);
94
 
94
 
95
                        if ($parentObj = $obj->getParent()) {
95
                        if ($parentObj = $obj->getParent()) {
96
                                $parent_oid = $parentObj->nodeId();
96
                                $parent_oid = $parentObj->nodeId();
97
                                OIDplus::logger()->log("[WARN]OID($parent_oid)", "Object '$id' (recursively) deleted");
97
                                OIDplus::logger()->log("[WARN]OID(%2)", "Object '%1' (recursively) deleted", $id, $parent_oid);
98
                        }
98
                        }
99
 
99
 
100
                        // Delete object
100
                        // Delete object
101
                        OIDplus::db()->query("delete from ###objects where id = ?", array($id));
101
                        OIDplus::db()->query("delete from ###objects where id = ?", array($id));
102
                        OIDplusObject::resetObjectInformationCache();
102
                        OIDplusObject::resetObjectInformationCache();
Line 109... Line 109...
109
                                                                    "where tchild.parent <> ? and tchild.id like ? and tparent.id is null;", array($ot::root(), $ot::root().'%'));
109
                                                                    "where tchild.parent <> ? and tchild.id like ? and tparent.id is null;", array($ot::root(), $ot::root().'%'));
110
                                        if (!$res->any()) break;
110
                                        if (!$res->any()) break;
111
 
111
 
112
                                        while ($row = $res->fetch_array()) {
112
                                        while ($row = $res->fetch_array()) {
113
                                                $id_to_delete = $row['id'];
113
                                                $id_to_delete = $row['id'];
114
                                                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");
114
                                                OIDplus::logger()->log("[CRIT]OIDRA(%2)!", "Lost ownership of object '%2' because one of the superior objects ('%1') was recursively deleted", $id, $id_to_delete);
115
                                                OIDplus::db()->query("delete from ###objects where id = ?", array($id_to_delete));
115
                                                OIDplus::db()->query("delete from ###objects where id = ?", array($id_to_delete));
116
                                                OIDplusObject::resetObjectInformationCache();
116
                                                OIDplusObject::resetObjectInformationCache();
117
                                        }
117
                                        }
118
                                } while (true);
118
                                } while (true);
119
                        }
119
                        }
Line 188... Line 188...
188
                                }
188
                                }
189
 
189
 
190
                                // Change RA recursively
190
                                // Change RA recursively
191
                                $current_ra = $obj->getRaMail() ?? '';
191
                                $current_ra = $obj->getRaMail() ?? '';
192
                                if ($new_ra != $current_ra) {
192
                                if ($new_ra != $current_ra) {
193
                                        OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]SUPOIDRA($id)?/[?INFO/!OK]A?", "RA of object '$id' changed from '$current_ra' to '$new_ra'");
193
                                        OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra);
194
                                        OIDplus::logger()->log("[WARN]RA($current_ra)!",           "Lost ownership of object '$id' due to RA transfer of superior RA / admin.");
194
                                        OIDplus::logger()->log("[WARN]RA(%2)!", "Lost ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra);
195
                                        OIDplus::logger()->log("[INFO]RA($new_ra)!",               "Gained ownership of object '$id' due to RA transfer of superior RA / admin.");
195
                                        OIDplus::logger()->log("[INFO]RA(%3)!", "Gained ownership of object '%1' due to RA transfer of superior RA / admin.", $id, $current_ra, $new_ra);
196
                                        if ($parentObj = $obj->getParent()) {
196
                                        if ($parentObj = $obj->getParent()) {
197
                                                $parent_oid = $parentObj->nodeId();
197
                                                $parent_oid = $parentObj->nodeId();
198
                                                OIDplus::logger()->log("[INFO]OID($parent_oid)", "RA of object '$id' changed from '$current_ra' to '$new_ra'");
198
                                                OIDplus::logger()->log("[INFO]OID(%4)", "RA of object '%1' changed from '%2' to '%3'", $id, $current_ra, $new_ra, $parent_oid);
199
                                        }
199
                                        }
200
                                        $this->ra_change_rec($id, $current_ra, $new_ra); // Recursively change inherited RAs
200
                                        $this->ra_change_rec($id, $current_ra, $new_ra); // Recursively change inherited RAs
201
                                }
201
                                }
202
                        }
202
                        }
203
 
203
 
204
                        // Log if confidentially flag was changed
204
                        // Log if confidentially flag was changed
205
                        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!
205
                        OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]SUPOIDRA(%1)?/[?INFO/!OK]A?", "Identifiers/Confidential flag of object '%1' updated", $id); // TODO: Check if they were ACTUALLY updated!
206
                        if ($parentObj = $obj->getParent()) {
206
                        if ($parentObj = $obj->getParent()) {
207
                                $parent_oid = $parentObj->nodeId();
207
                                $parent_oid = $parentObj->nodeId();
208
                                OIDplus::logger()->log("[INFO]OID($parent_oid)", "Identifiers/Confidential flag of object '$id' updated"); // TODO: Check if they were ACTUALLY updated!
208
                                OIDplus::logger()->log("[INFO]OID(%2)", "Identifiers/Confidential flag of object '%1' updated", $id, $parent_oid); // TODO: Check if they were ACTUALLY updated!
209
                        }
209
                        }
210
 
210
 
211
                        // Replace ASN.1 IDs und IRIs
211
                        // Replace ASN.1 IDs und IRIs
212
                        if ($obj::ns() == 'oid') {
212
                        if ($obj::ns() == 'oid') {
213
                                assert($obj instanceof OIDplusOid); //assert(get_class($obj) === "ViaThinkSoft\OIDplus\OIDplusOid");
213
                                assert($obj instanceof OIDplusOid); //assert(get_class($obj) === "ViaThinkSoft\OIDplus\OIDplusOid");
Line 289... Line 289...
289
                                if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) {
289
                                if ($plugin instanceof INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3) {
290
                                        $plugin->beforeObjectUpdateSelf($id, $params);
290
                                        $plugin->beforeObjectUpdateSelf($id, $params);
291
                                }
291
                                }
292
                        }
292
                        }
293
 
293
 
294
                        OIDplus::logger()->log("[INFO]OID($id)+[?INFO/!OK]OIDRA($id)?/[?INFO/!OK]A?", "Title/Description of object '$id' updated");
294
                        OIDplus::logger()->log("[INFO]OID(%1)+[?INFO/!OK]OIDRA(%1)?/[?INFO/!OK]A?", "Title/Description of object '%1' updated", $id);
295
 
295
 
296
                        if (isset($params['title'])) {
296
                        if (isset($params['title'])) {
297
                                $title = $params['title'];
297
                                $title = $params['title'];
298
                                OIDplus::db()->query("UPDATE ###objects SET title = ? WHERE id = ?", array($title, $id));
298
                                OIDplus::db()->query("UPDATE ###objects SET title = ? WHERE id = ?", array($title, $id));
299
                                OIDplusObject::resetObjectInformationCache();
299
                                OIDplusObject::resetObjectInformationCache();
Line 416... Line 416...
416
                        }
416
                        }
417
                        if (!empty($ra_email) && !OIDplus::mailUtils()->validMailAddress($ra_email)) {
417
                        if (!empty($ra_email) && !OIDplus::mailUtils()->validMailAddress($ra_email)) {
418
                                throw new OIDplusException(_L('Invalid RA email address'));
418
                                throw new OIDplusException(_L('Invalid RA email address'));
419
                        }
419
                        }
420
 
420
 
-
 
421
                        if (empty($ra_email)) {
421
                        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'";
422
                                        OIDplus::logger()->log("[INFO]OID(%2)+[INFO]OID(%1)+[?INFO/!OK]OIDRA(%2)?/[?INFO/!OK]A?", "Object '%1' created, without defined RA, superior object is '%2'", $id, $parent);
-
 
423
                        } else {
-
 
424
                                        OIDplus::logger()->log("[INFO]OID(%2)+[INFO]OID(%1)+[?INFO/!OK]OIDRA(%2)?/[?INFO/!OK]A?", "Object '%1' created, given to RA '%3', superior object is '%2'", $id, $parent, $ra_email);
-
 
425
                        }
422
                        if (!empty($ra_email)) {
426
                        if (!empty($ra_email)) {
423
                                OIDplus::logger()->log("[INFO]RA($ra_email)!", "Gained ownership of newly created object '$id'");
427
                                OIDplus::logger()->log("[INFO]RA(%2)!", "Gained ownership of newly created object '%1'", $id, $ra_email);
424
                        }
428
                        }
425
 
429
 
426
                        $confidential = isset($params['confidential']) && $params['confidential'] == 'true';
430
                        $confidential = isset($params['confidential']) && $params['confidential'] == 'true';
427
                        $comment = $params['comment'] ?? '';
431
                        $comment = $params['comment'] ?? '';
428
                        $title = '';
432
                        $title = '';