Skip to content
Snippets Groups Projects
Commit dabadd18 authored by Sean Madsen's avatar Sean Madsen Committed by GitHub
Browse files

Merge pull request #137 from artfulrobot/master

Correct default permission for custom API entities; clarify example. Fix #136
parents 0fe491cb 81124c99
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ unconditionally).
!!! Note
If a given entity/action permissions are unset, the default
"access CiviCRM" permission is enforced.
"administer CiviCRM" permission is enforced.
## Definition
......@@ -39,6 +39,10 @@ hook_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions)
## Example
The `alterAPIPermissions` function is prefixed with the full extension name, all lowercase,
followed by `_civicrm_alterAPIPermissions`. For an extension "CiviTest" the hook
would be placed in the `civitest.php` file and might look like:
```php
function civitest_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions)
{
......@@ -61,9 +65,9 @@ function civitest_civicrm_alterAPIPermissions($entity, $action, &$params, &$perm
}
```
When developing an extension with custom API, this code is placed
directly in the API php file that you have created. In this case the
extension would be named CiviTest. The API function for the GET would be
`function civicrm_api3_civi_test_get();`. The `alterAPIPermissions`
function is prefixed with the full extension name, all lowercase,
followed by `_civicrm_alterAPIPermissions`.
The API function for the "get" action for the new custom API entity called "Foo" would be
`function civicrm_api3_foo_get();`.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment