Skip to content
Snippets Groups Projects
Unverified Commit eb7549fd authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub
Browse files

Merge pull request #18437 from colemanw/api4Perms

#2008 APIv4 - Map specific action names to more generic versions
parents 6a002370 d1961207
No related branches found
No related tags found
No related merge requests found
......@@ -407,13 +407,15 @@ abstract class AbstractAction implements \ArrayAccess {
'default' => ['administer CiviCRM'],
];
$action = $this->getActionName();
if (isset($permissions[$action])) {
return $permissions[$action];
}
elseif (in_array($action, ['getActions', 'getFields'])) {
return $permissions['meta'];
}
return $permissions['default'];
// Map specific action names to more generic versions
$map = [
'getActions' => 'meta',
'getFields' => 'meta',
'replace' => 'delete',
'save' => 'create',
];
$generic = $map[$action] ?? 'default';
return $permissions[$action] ?? $permissions[$generic] ?? $permissions['default'];
}
/**
......
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