if ($lastLink instanceof CustomGroupJoinable) {
$field = $lastLink->getSqlColumn($field);
}
-
+ // Check Permission on field.
+ if ($this->checkPermissions && !empty($this->apiFieldSpec[$prefix . $field]['permission']) && !\CRM_Core_Permission::check($this->apiFieldSpec[$prefix . $field]['permission'])) {
+ return;
+ }
$this->fkSelectAliases[$key] = sprintf('%s.%s', $lastLink->getAlias(), $field);
}
protected $requiredIf;
/**
- * @var array|boolean
+ * @var array|bool
*/
protected $options;
*/
protected $serialize;
+ /**
+ * @var array
+ */
+ protected $permission;
+
/**
* Aliases for the valid data types
*
return $this;
}
+ /**
+ * @param array $permission
+ * @return $this
+ */
+ public function setPermission($permission) {
+ $this->permission = $permission;
+ return $this;
+ }
+
+ /**
+ * @return array
+ */
+ public function getPermission() {
+ return $this->permission;
+ }
+
/**
* @return string
*/
$field->setDescription(ArrayHelper::value('description', $data));
self::setInputTypeAndAttrs($field, $data, $dataTypeName);
+ $field->setPermission(ArrayHelper::value('permission', $data));
$fkAPIName = ArrayHelper::value('FKApiName', $data);
$fkClassName = ArrayHelper::value('FKClassName', $data);
if ($fkAPIName || $fkClassName) {