mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
Merge branch 'MDL-44746_master' of git://github.com/markn86/moodle
This commit is contained in:
commit
75823325d3
@ -60,11 +60,8 @@ class mnet_access_control_created extends base {
|
||||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
||||
|
||||
return 'Access control created for the user with the username \'' . $mnetaccesscontrol->username . '\' belonging
|
||||
to the mnet host \'' . $mnethost->name . '\'';
|
||||
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
|
||||
to the mnet host \'' . $this->other['hostname'] . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,11 +70,29 @@ class mnet_access_control_created extends base {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_legacy_logdata() {
|
||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
||||
return array(SITEID, 'admin/mnet', 'add', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
|
||||
' 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 ' .
|
||||
$mnethost->name);
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function get_description() {
|
||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
||||
|
||||
return 'Access control created for the user with the username \'' . $mnetaccesscontrol->username . '\' belonging
|
||||
to the mnet host \'' . $mnethost->name . '\'';
|
||||
return 'Access control created for the user with the username \'' . $this->other['username'] . '\' belonging
|
||||
to the mnet host \'' . $this->other['hostname'] . '\'';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,11 +70,29 @@ class mnet_access_control_updated extends base {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_legacy_logdata() {
|
||||
$mnetaccesscontrol = $this->get_record_snapshot('mnet_sso_access_control', $this->objectid);
|
||||
$mnethost = $this->get_record_snapshot('mnet_host', $mnetaccesscontrol->mnet_host_id);
|
||||
return array(SITEID, 'admin/mnet', 'update', 'admin/mnet/access_control.php', 'SSO ACL: ' . $this->other['accessctrl'] .
|
||||
' 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 ' .
|
||||
$mnethost->name);
|
||||
/**
|
||||
* Custom validation.
|
||||
*
|
||||
* @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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @property-read array $other {
|
||||
* Extra information about event.
|
||||
*
|
||||
* @type string username name of user.
|
||||
* @type string email user email.
|
||||
* @type string idnumber user idnumber.
|
||||
* @type string picture user picture.
|
||||
* @type int mnethostid mnet host id.
|
||||
* - string username: name of user.
|
||||
* - string email: user email.
|
||||
* - string idnumber: user idnumber.
|
||||
* - string picture: user picture.
|
||||
* - int mnethostid: mnet host id.
|
||||
* }
|
||||
*
|
||||
* @package core
|
||||
@ -68,8 +68,7 @@ class user_deleted extends base {
|
||||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
$user = $this->get_record_snapshot('user', $this->data['objectid']);
|
||||
return 'User profile deleted for userid ' . $user->id;
|
||||
return 'User profile deleted for the user with the id ' . $this->objectid;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,12 +86,13 @@ class user_deleted extends base {
|
||||
* @return \stdClass user data.
|
||||
*/
|
||||
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->username = $this->data['other']['username'];
|
||||
$user->email = $this->data['other']['email'];
|
||||
$user->idnumber = $this->data['other']['idnumber'];
|
||||
$user->picture = $this->data['other']['picture'];
|
||||
$user->username = $this->other['username'];
|
||||
$user->email = $this->other['email'];
|
||||
$user->idnumber = $this->other['idnumber'];
|
||||
$user->picture = $this->other['picture'];
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
@ -102,8 +102,8 @@ class user_deleted extends base {
|
||||
* @return array
|
||||
*/
|
||||
protected function get_legacy_logdata() {
|
||||
$user = $this->get_record_snapshot('user', $this->data['objectid']);
|
||||
return array(SITEID, 'user', 'delete', "view.php?id=".$user->id, $user->firstname.' '.$user->lastname);
|
||||
$user = $this->get_record_snapshot('user', $this->objectid);
|
||||
return array(SITEID, 'user', 'delete', 'view.php?id=' . $user->id, $user->firstname . ' ' . $user->lastname);
|
||||
}
|
||||
|
||||
/**
|
||||
|
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.
|
||||
$params = array(
|
||||
'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->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.
|
||||
$params = array(
|
||||
'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->add_record_snapshot('mnet_host', $mnethost);
|
||||
|
Loading…
x
Reference in New Issue
Block a user