Skip to content

Commit

Permalink
feat: add email field to full user data
Browse files Browse the repository at this point in the history
  • Loading branch information
RiedleroD committed Jan 5, 2025
1 parent cc7e2cb commit 44447ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lbplanner/classes/model/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Model for a course
* Model for a user
*
* @package local_lbplanner
* @subpackage helpers
Expand All @@ -36,7 +36,7 @@
use local_lbplanner\helpers\user_helper;

/**
* Model class for course
* Model class for model
*/
class user {
/**
Expand Down Expand Up @@ -337,6 +337,7 @@ public static function api_structure_short(): external_single_structure {
* @return array a full representation of this user and its data
*/
public function prepare_for_api(): array {
$mdluser = $this->get_mdluser();
return array_merge(
$this->prepare_for_api_short(),
[
Expand All @@ -346,6 +347,7 @@ public function prepare_for_api(): array {
'colorblindness' => $this->colorblindness,
'displaytaskcount' => $this->displaytaskcount,
'capabilities' => $this->get_capabilitybitmask(),
'email' => $mdluser->email,
]
);
}
Expand All @@ -370,6 +372,7 @@ public static function api_structure(): external_single_structure {
'displaytaskcount' => new external_value(PARAM_INT, 'If the user has the taskcount-enabled 1-yes 0-no'),
'capabilities' => new external_value(PARAM_INT, 'The capabilities of the user represented as a bitmask value'),
'vintage' => new external_value(PARAM_TEXT, 'The vintage of the user', VALUE_DEFAULT),
'email' => new external_value(PARAM_TEXT, 'The email address of the user')
]
);
}
Expand Down

0 comments on commit 44447ce

Please sign in to comment.