Merge pull request #16258 from samuelsov/i18ncountriesorder
[civicrm-core.git] / Civi / Api4 / Action / Contact / GetFields.php
1 <?php
2
3 /*
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
6 | |
7 | This work is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
11 */
12
13 /**
14 *
15 * @package CRM
16 * @copyright CiviCRM LLC https://civicrm.org/licensing
17 * $Id$
18 *
19 */
20
21 namespace Civi\Api4\Action\Contact;
22
23 use Civi\Api4\Generic\DAOGetFieldsAction;
24
25 class GetFields extends DAOGetFieldsAction {
26
27 protected function getRecords() {
28 $fields = parent::getRecords();
29
30 $apiKeyPerms = ['edit api keys', 'administer CiviCRM'];
31 if ($this->checkPermissions && !\CRM_Core_Permission::check([$apiKeyPerms])) {
32 unset($fields['api_key']);
33 }
34
35 return $fields;
36 }
37
38 }