3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * This api exposes CiviCRM the user framework user account.
15 * @package CiviCRM_APIv3
19 * Get details about the CMS User entity.
21 * @param array $params
25 function civicrm_api3_user_get($params) {
26 if (empty($params['contact_id'])) {
27 $params['contact_id'] = civicrm_api3('UFMatch', 'getvalue', [
28 'uf_id' => $params['id'],
29 'domain_id' => CRM_Core_Config
::domainID(),
30 'return' => 'contact_id',
33 $result = CRM_Core_Config
::singleton()->userSystem
->getUser($params['contact_id']);
34 $result['contact_id'] = $params['contact_id'];
35 return civicrm_api3_create_success(
36 [$result['id'] => $result],
45 * Adjust Metadata for Get action.
47 * The metadata is used for setting defaults, documentation & validation.
49 * @param array $params
50 * Array of parameters determined by getfields.
52 function _civicrm_api3_user_get_spec(&$params) {
53 // At this stage contact-id is required - we may be able to loosen this.
54 $params['contact_id'] = [
55 'title' => 'Contact ID',
56 'type' => CRM_Utils_Type
::T_INT
,
60 'title' => 'CMS User ID',
61 'type' => CRM_Utils_Type
::T_INT
,
64 'title' => 'Username',
65 'type' => CRM_Utils_Type
::T_STRING
,