* 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();
*/
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']);
+ }
+
}
* collection of info about this data source
*/
public function getInfo() {
- return array('title' => ts('SQL Query'));
+ return array(
+ 'title' => ts('SQL Query'),
+ 'permissions' => array('import SQL datasource'),
+ );
}
/**