X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FImport%2FDataSource.php;h=9091e3f647a102ed124fe2b0df6a1d274f7e2488;hb=ddcf8c753b5d32d0586a1ae2e1183d47066241d7;hp=3e33ee8c7c4ad185cb2decf8d04efdbc6bb48c40;hpb=2399ff35dc5188431904b55fcd68c6e97c27c987;p=civicrm-core.git diff --git a/CRM/Import/DataSource.php b/CRM/Import/DataSource.php index 3e33ee8c7c..9091e3f647 100644 --- a/CRM/Import/DataSource.php +++ b/CRM/Import/DataSource.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2016 | + | Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 * $Id$ * */ @@ -43,7 +43,10 @@ abstract class CRM_Import_DataSource { * Provides information about the data source. * * @return array - * collection of info about this data source + * Description of this data source, including: + * - title: string, translated, required + * - permissions: array, optional + * */ abstract public function getInfo(); @@ -72,4 +75,14 @@ abstract class CRM_Import_DataSource { */ abstract public function postProcess(&$params, &$db, &$form); + /** + * Determine if the current user has access to this data source. + * + * @return bool + */ + public function checkPermission() { + $info = $this->getInfo(); + return empty($info['permissions']) || CRM_Core_Permission::check($info['permissions']); + } + }