*/
class AdhocProvider implements EventSubscriberInterface, ProviderInterface {
+ /**
+ * @return array
+ */
public static function getSubscribedEvents() {
return array(
Events::RESOLVE => array(
return $this;
}
+ /**
+ * @param \Civi\API\Event\ResolveEvent $event
+ */
public function onApiResolve(\Civi\API\Event\ResolveEvent $event) {
$apiRequest = $event->getApiRequest();
if ($this->matchesRequest($apiRequest)) {
}
}
+ /**
+ * @param \Civi\API\Event\AuthorizeEvent $event
+ */
public function onApiAuthorize(\Civi\API\Event\AuthorizeEvent $event) {
$apiRequest = $event->getApiRequest();
if ($this->matchesRequest($apiRequest) && \CRM_Core_Permission::check($this->actions[strtolower($apiRequest['action'])]['perm'])) {
}
}
+ /**
+ * @param $apiRequest
+ *
+ * @return bool
+ */
public function matchesRequest($apiRequest) {
return $apiRequest['entity'] == $this->entity && $apiRequest['version'] == $this->version && isset($this->actions[strtolower($apiRequest['action'])]);
}
-}
\ No newline at end of file
+}