Skip to content

Commit

Permalink
[#192] Define permissions with label and description
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Mar 13, 2024
1 parent 6bbc845 commit bb0eddb
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions donrec.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,23 @@ function donrec_civicrm_alterAPIPermissions($entity, $action, &$params, &$permis
}

/**
* Custom permissions
* Implements hook_civicrm_permission().
*/
function donrec_civicrm_permission(&$permissions) {
function donrec_civicrm_permission(&$permissions) {
$prefix = E::ts('DonationReceipts') . ': ';

$permissions['view and copy receipts'] = $prefix . E::ts('view and create copies of receipts');
$permissions['create and withdraw receipts'] = $prefix . E::ts('create and withdraw receipts');
$permissions['delete receipts'] = $prefix . E::ts('delete receipts');
}
$permissions['view and copy receipts'] = [
'label' => $prefix . E::ts('view and create copies of receipts'),
'description' => E::ts('Allows viewing and creating copies of donation receipts.'),
];
$permissions['create and withdraw receipts'] = [
'label' => $prefix . E::ts('create and withdraw receipts'),
'description' => E::ts('Allows creating and withdrawing donation receipts.'),
];
$permissions['delete receipts'] = [
'label' => $prefix . E::ts('delete receipts'),
'description' => E::ts('Allows deleting donation receipts.'),
];
}

/**
* Add headers to sent donation receipts
Expand Down

0 comments on commit bb0eddb

Please sign in to comment.