-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APIv4 - Add "Permission.get" for listing available permissions #19115
Conversation
(Standard links)
|
d47c864
to
6d1db5c
Compare
@jaapjansma You might find this to be a useful alternative to |
This looks good overall. We'll need docs for the new hook. |
53ba089
to
37bbe86
Compare
This looks ready to merge @totten. |
@totten @colemanw my quick take is I'm not sure the commits need squashing - the idea is that if a change makes sense on it own (even incrementally) it's OK f(& possibly better) for it to be a separate commit. @totten if after reading the comments about squashing you feel that the commits don't need squashing please merge |
@totten it looks to me like the 2nd, 3rd, 5th and 6th commit are all basically the same area and could be squashed together. |
37bbe86
to
c4e6b41
Compare
@colemanw Squashed the commits which implement "Permission.get". Left the other the bits (CRM_Core_Permission, E2E test, afform) as they're more distinct. |
Overview
This adds a new API method "Permission.get". This is a better building-block for administrative tools that allow one to choose/assign a permission.
Before
CRM_Core_Permission::basicPermissions()
which lists concrete permissions defined by CiviCRM (built-in as well ashook_civicrm_permission
).*always allow*
,*always deny*
)Drupal:post comment
,WordPress:list_users
)cms:view user account
)@afform:<form-name>
)After
The APIv4 method
Permission.get
provides a full accounting of all available permissions. It also supports sorting, filtering, etc.This captures permissions from all the sources referenced above, eg
hook_civicrm_permission
)*always allow*
,*always deny*
)Drupal:post comment
,WordPress:list_users
)cms:view user account
)@afform:<form-name>
)For the last case (synthetic permissions defined via extension), one must implement
hook_civicrm_permissionList
. There's an example inafform.php
:Comments