Skip to content

Commit

Permalink
(wip) Provide CRUD permissions for ECK entities
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Jun 9, 2022
1 parent 6169f89 commit d447774
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Civi/Api4/EckEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ public static function checkAccess(string $entity_type) {
* @return array
*/
public static function permissions() {
return []; // FIXME: Add per-entity-type permissions
// TODO: OR-combined permissions for either any ECK entity type or type-specific.
return [
'meta' => ['access CiviCRM'],
'default' => ['administer CiviCRM'],
'create' => ['create any ECK entity'],
'get' => ['retrieve any ECK entity'],
'update' => ['edit any ECK entity'],
'delete' => ['delete any ECK entity'],
];
}

}
18 changes: 18 additions & 0 deletions eck.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,22 @@ function eck_civicrm_permission(&$permissions) {
E::ts('Delete ECK Entity Types'),
E::ts('Allows deleting Entity Construction Kit Entity Types.'),
];

// Permissions for ECK entities.
$permissions['create any ECK entity'] = [
E::ts('Create any ECK Entity'),
E::ts('Allows creating new Entity Construction Kit Entities of any type.'),
];
$permissions['retrieve any ECK entity'] = [
E::ts('Retrieve any ECK Entity'),
E::ts('Allows retrieving Entity Construction Kit Entities of any type.'),
];
$permissions['edit any ECK entity'] = [
E::ts('Edit any ECK Entity'),
E::ts('Allows editing Entity Construction Kit Entities of any type.'),
];
$permissions['delete any ECK entity'] = [
E::ts('Delete any ECK Entity'),
E::ts('Allows deleting Entity Construction Kit Entities of any type.'),
];
}

0 comments on commit d447774

Please sign in to comment.