summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/TaskPermission.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/Model/TaskPermission.php b/app/Model/TaskPermission.php
new file mode 100644
index 00000000..2ab154f4
--- /dev/null
+++ b/app/Model/TaskPermission.php
@@ -0,0 +1,32 @@
+<?php
+
+namespace Model;
+
+/**
+ * Task permission model
+ *
+ * @package model
+ * @author Frederic Guillot
+ */
+class TaskPermission extends Base
+{
+ /**
+ * Return true if the user can remove a task
+ *
+ * Regular users can't remove tasks from other people
+ *
+ * @public
+ * @return boolean
+ */
+ public function canRemoveTask(array $task)
+ {
+ if ($this->acl->isAdminUser()) {
+ return true;
+ }
+ else if (isset($task['creator_id']) && $task['creator_id'] == $this->acl->getUserId()) {
+ return true;
+ }
+
+ return false;
+ }
+}