mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-44746 core_events: removed incorrect uses of snapshots
This commit is contained in:
parent
578645aadf
commit
601c998c64
4 changed files with 63 additions and 24 deletions
|
@ -60,11 +60,8 @@ class mnet_access_control_created extends base {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_description() {
|
public function get_description() {
|
||||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
|
||||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
to the mnet host \'' . $this->other['hostname'] . '\'';
|
||||||
|
|
||||||
return 'Access control created for the user with the username \'' . $mnetaccesscontrol->username . '\' belonging
|
|
||||||
to the mnet host \'' . $mnethost->name . '\'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,11 +70,29 @@ class mnet_access_control_created extends base {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_legacy_logdata() {
|
protected function get_legacy_logdata() {
|
||||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
return array(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
|
||||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
' user \'' . $this->other['username'] . '\' from ' . $this->other['hostname']);
|
||||||
|
}
|
||||||
|
|
||||||
return array(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php', 'SSO ACL: ' .
|
/**
|
||||||
$mnetaccesscontrol->accessctrl . ' user \'' . $mnetaccesscontrol->username . '\' from ' .
|
* Custom validation.
|
||||||
$mnethost->name);
|
*
|
||||||
|
* @throws \coding_exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function validate_data() {
|
||||||
|
parent::validate_data();
|
||||||
|
|
||||||
|
if (!isset($this->other['username'])) {
|
||||||
|
throw new \coding_exception('The \'username\' must be set in other.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->other['hostname'])) {
|
||||||
|
throw new \coding_exception('The \'hostname\' must be set in other.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->other['accessctrl'])) {
|
||||||
|
throw new \coding_exception('The \'accessctrl\' must be set in other.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,11 +60,8 @@ class mnet_access_control_updated extends base {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_description() {
|
public function get_description() {
|
||||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
|
||||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
to the mnet host \'' . $this->other['hostname'] . '\'';
|
||||||
|
|
||||||
return 'Access control created for the user with the username \'' . $mnetaccesscontrol->username . '\' belonging
|
|
||||||
to the mnet host \'' . $mnethost->name . '\'';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,11 +70,29 @@ class mnet_access_control_updated extends base {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_legacy_logdata() {
|
protected function get_legacy_logdata() {
|
||||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
return array(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
|
||||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
' user \'' . $this->other['username'] . '\' from ' . $this->other['hostname']);
|
||||||
|
}
|
||||||
|
|
||||||
return array(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php', 'SSO ACL: ' .
|
/**
|
||||||
$mnetaccesscontrol->accessctrl . ' user \'' . $mnetaccesscontrol->username . '\' from ' .
|
* Custom validation.
|
||||||
$mnethost->name);
|
*
|
||||||
|
* @throws \coding_exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function validate_data() {
|
||||||
|
parent::validate_data();
|
||||||
|
|
||||||
|
if (!isset($this->other['username'])) {
|
||||||
|
throw new \coding_exception('The \'username\' must be set in other.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->other['hostname'])) {
|
||||||
|
throw new \coding_exception('The \'hostname\' must be set in other.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->other['accessctrl'])) {
|
||||||
|
throw new \coding_exception('The \'accessctrl\' must be set in other.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,7 @@ class user_deleted extends base {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_description() {
|
public function get_description() {
|
||||||
$user = $this->get_record_snapshot('user', $this->data['objectid']);
|
return 'User profile deleted for userid ' . $this->objectid;
|
||||||
return 'User profile deleted for userid ' . $user->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
14
mnet/lib.php
14
mnet/lib.php
|
@ -447,7 +447,12 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $accessctrl) {
|
||||||
// Trigger access control updated event.
|
// Trigger access control updated event.
|
||||||
$params = array(
|
$params = array(
|
||||||
'objectid' => $aclrecord->id,
|
'objectid' => $aclrecord->id,
|
||||||
'context' => context_system::instance()
|
'context' => context_system::instance(),
|
||||||
|
'other' => array(
|
||||||
|
'username' => $username,
|
||||||
|
'hostname' => $mnethost->name,
|
||||||
|
'accessctrl' => $accessctrl
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$event = \core\event\mnet_access_control_updated::create($params);
|
$event = \core\event\mnet_access_control_updated::create($params);
|
||||||
$event->add_record_snapshot('mnet_host', $mnethost);
|
$event->add_record_snapshot('mnet_host', $mnethost);
|
||||||
|
@ -463,7 +468,12 @@ function mnet_update_sso_access_control($username, $mnet_host_id, $accessctrl) {
|
||||||
// Trigger access control created event.
|
// Trigger access control created event.
|
||||||
$params = array(
|
$params = array(
|
||||||
'objectid' => $aclrecord->id,
|
'objectid' => $aclrecord->id,
|
||||||
'context' => context_system::instance()
|
'context' => context_system::instance(),
|
||||||
|
'other' => array(
|
||||||
|
'username' => $username,
|
||||||
|
'hostname' => $mnethost->name,
|
||||||
|
'accessctrl' => $accessctrl
|
||||||
|
)
|
||||||
);
|
);
|
||||||
$event = \core\event\mnet_access_control_created::create($params);
|
$event = \core\event\mnet_access_control_created::create($params);
|
||||||
$event->add_record_snapshot('mnet_host', $mnethost);
|
$event->add_record_snapshot('mnet_host', $mnethost);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue