From d837a605790f77f6a34464b22022ada01a9c02ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolo=CC=80=20Caruso?= <nicolo@istos.it>
Date: Fri, 18 Mar 2016 12:30:55 +0100
Subject: [PATCH] Use the new 'view calendar data events' permissions

---
 bat_api.module | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bat_api.module b/bat_api.module
index bd05105..50991be 100644
--- a/bat_api.module
+++ b/bat_api.module
@@ -658,6 +658,11 @@ function bat_api_services_events_index_calendar($unit_ids, $unit_types, $start_d
   $events_json = array();
 
   foreach ($types as $type) {
+    // Check if user has permission to view calendar data for this event type.
+    if (!user_access('view calendar data for any ' . $type . ' event')) {
+      continue;
+    }
+
     // Get the event type definition from Drupal
     $bat_event_type = bat_event_type_load($type);
 
-- 
GitLab