From 979a5e70bf105a4894c07f0b89de0c3227ee0b1c Mon Sep 17 00:00:00 2001
From: De Coninck Laurent <laurent@adlogix.eu>
Date: Thu, 16 Feb 2017 07:51:46 +0100
Subject: [PATCH] allow the drag and drop of an event only for allowed users

The drag and drop of the event didn't take into account the user rights.
---
 htdocs/comm/action/index.php | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php
index f63bbd7ab79..f8b50fb588a 100644
--- a/htdocs/comm/action/index.php
+++ b/htdocs/comm/action/index.php
@@ -1328,7 +1328,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
                             $cssclass.= " unmovable";
                         }
                     }
-                    else $cssclass.= " movable";
+                    else{
+                        if ($user->rights->agenda->allactions->create ||
+                            (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create))
+                        {
+                            $cssclass.= " movable";
+                        }else{
+                            $cssclass.= " unmovable";
+                        }
+
+                    }
 
                     $h=''; $nowrapontd=1;
                     if ($action == 'show_day')  { $h='height: 100%; '; $nowrapontd=0; }
-- 
GitLab