Merge branch 'MDL-44746_master' of git://github.com/markn86/moodle

This commit is contained in:
Marina Glancy 2014-04-01 13:51:09 +08:00
commit 75823325d3
4 changed files with 76 additions and 36 deletions

View file

@ -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.');
}
} }
} }

View file

@ -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.');
}
} }
} }

View file

@ -31,11 +31,11 @@ defined('MOODLE_INTERNAL') || die();
* @property-read array $other { * @property-read array $other {
* Extra information about event. * Extra information about event.
* *
* @type string username name of user. * - string username: name of user.
* @type string email user email. * - string email: user email.
* @type string idnumber user idnumber. * - string idnumber: user idnumber.
* @type string picture user picture. * - string picture: user picture.
* @type int mnethostid mnet host id. * - int mnethostid: mnet host id.
* } * }
* *
* @package core * @package core
@ -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 the user with the id ' . $this->objectid;
return 'User profile deleted for userid ' . $user->id;
} }
/** /**
@ -87,12 +86,13 @@ class user_deleted extends base {
* @return \stdClass user data. * @return \stdClass user data.
*/ */
protected function get_legacy_eventdata() { protected function get_legacy_eventdata() {
$user = $this->get_record_snapshot('user', $this->data['objectid']); $user = $this->get_record_snapshot('user', $this->objectid);
$user->deleted = 0; $user->deleted = 0;
$user->username = $this->data['other']['username']; $user->username = $this->other['username'];
$user->email = $this->data['other']['email']; $user->email = $this->other['email'];
$user->idnumber = $this->data['other']['idnumber']; $user->idnumber = $this->other['idnumber'];
$user->picture = $this->data['other']['picture']; $user->picture = $this->other['picture'];
return $user; return $user;
} }
@ -102,8 +102,8 @@ class user_deleted extends base {
* @return array * @return array
*/ */
protected function get_legacy_logdata() { protected function get_legacy_logdata() {
$user = $this->get_record_snapshot('user', $this->data['objectid']); $user = $this->get_record_snapshot('user', $this->objectid);
return array(SITEID, 'user', 'delete', "view.php?id=".$user->id, $user->firstname.' '.$user->lastname); return array(SITEID, 'user', 'delete', 'view.php?id=' . $user->id, $user->firstname . ' ' . $user->lastname);
} }
/** /**

View file

@ -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);