summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/Base.php17
-rw-r--r--app/Core/ExternalTask/ExternalTaskManager.php10
-rw-r--r--app/Core/ExternalTask/ExternalTaskProviderInterface.php16
-rw-r--r--app/Core/Filter/QueryBuilder.php12
-rw-r--r--app/Core/Group/GroupBackendProviderInterface.php2
-rw-r--r--app/Core/Group/GroupManager.php10
-rw-r--r--app/Core/Group/GroupProviderInterface.php2
-rw-r--r--app/Core/Helper.php2
-rw-r--r--app/Core/Ldap/Query.php7
-rw-r--r--app/Core/Plugin/Installer.php2
-rw-r--r--app/Core/User/UserBackendProviderInterface.php21
-rw-r--r--app/Core/User/UserManager.php71
12 files changed, 153 insertions, 19 deletions
diff --git a/app/Core/Base.php b/app/Core/Base.php
index 28bbd534..a36828c4 100644
--- a/app/Core/Base.php
+++ b/app/Core/Base.php
@@ -7,7 +7,7 @@ use Pimple\Container;
/**
* Base Class
*
- * @package core
+ * @package Kanboard\Core
* @author Frederic Guillot
*
* @property \Kanboard\Analytic\TaskDistributionAnalytic $taskDistributionAnalytic
@@ -22,6 +22,7 @@ use Pimple\Container;
* @property \Kanboard\Core\Cache\BaseCache $cacheDriver
* @property \Kanboard\Core\Event\EventManager $eventManager
* @property \Kanboard\Core\Group\GroupManager $groupManager
+ * @property \Kanboard\Core\User\UserManager $userManager
* @property \Kanboard\Core\Http\Client $httpClient
* @property \Kanboard\Core\Http\OAuth2 $oauth
* @property \Kanboard\Core\Http\RememberMeCookie $rememberMeCookie
@@ -68,15 +69,17 @@ use Pimple\Container;
* @property \Kanboard\Formatter\BoardTaskFormatter $boardTaskFormatter
* @property \Kanboard\Formatter\GroupAutoCompleteFormatter $groupAutoCompleteFormatter
* @property \Kanboard\Formatter\ProjectActivityEventFormatter $projectActivityEventFormatter
- * @property \Kanboard\Formatter\ProjectGanttFormatter $projectGanttFormatter
+ * @property \Kanboard\Formatter\ProjectApiFormatter $projectApiFormatter
+ * @property \Kanboard\Formatter\ProjectsApiFormatter $projectsApiFormatter
* @property \Kanboard\Formatter\SubtaskListFormatter $subtaskListFormatter
* @property \Kanboard\Formatter\SubtaskTimeTrackingCalendarFormatter $subtaskTimeTrackingCalendarFormatter
+ * @property \Kanboard\Formatter\TaskApiFormatter $taskApiFormatter
+ * @property \Kanboard\Formatter\TasksApiFormatter $tasksApiFormatter
* @property \Kanboard\Formatter\TaskAutoCompleteFormatter $taskAutoCompleteFormatter
- * @property \Kanboard\Formatter\TaskCalendarFormatter $taskCalendarFormatter
- * @property \Kanboard\Formatter\TaskGanttFormatter $taskGanttFormatter
* @property \Kanboard\Formatter\TaskICalFormatter $taskICalFormatter
* @property \Kanboard\Formatter\TaskListFormatter $taskListFormatter
* @property \Kanboard\Formatter\TaskListSubtaskFormatter $taskListSubtaskFormatter
+ * @property \Kanboard\Formatter\TaskListSubtaskAssigneeFormatter $taskListSubtaskAssigneeFormatter
* @property \Kanboard\Formatter\TaskSuggestMenuFormatter $taskSuggestMenuFormatter
* @property \Kanboard\Formatter\UserAutoCompleteFormatter $userAutoCompleteFormatter
* @property \Kanboard\Formatter\UserMentionFormatter $userMentionFormatter
@@ -103,6 +106,7 @@ use Pimple\Container;
* @property \Kanboard\Model\LinkModel $linkModel
* @property \Kanboard\Model\NotificationModel $notificationModel
* @property \Kanboard\Model\PasswordResetModel $passwordResetModel
+ * @property \Kanboard\Model\PredefinedTaskDescriptionModel $predefinedTaskDescriptionModel
* @property \Kanboard\Model\ProjectModel $projectModel
* @property \Kanboard\Model\ProjectActivityModel $projectActivityModel
* @property \Kanboard\Model\ProjectDuplicationModel $projectDuplicationModel
@@ -151,9 +155,10 @@ use Pimple\Container;
* @property \Kanboard\Model\UserNotificationFilterModel $userNotificationFilterModel
* @property \Kanboard\Model\UserUnreadNotificationModel $userUnreadNotificationModel
* @property \Kanboard\Model\UserMetadataModel $userMetadataModel
+ * @property \Kanboard\Pagination\DashboardPagination $dashboardPagination
+ * @property \Kanboard\Pagination\ProjectPagination $projectPagination
* @property \Kanboard\Pagination\TaskPagination $taskPagination
* @property \Kanboard\Pagination\SubtaskPagination $subtaskPagination
- * @property \Kanboard\Pagination\ProjectPagination $projectPagination
* @property \Kanboard\Pagination\UserPagination $userPagination
* @property \Kanboard\Validator\ActionValidator $actionValidator
* @property \Kanboard\Validator\AuthValidator $authValidator
@@ -176,7 +181,7 @@ use Pimple\Container;
* @property \Kanboard\Validator\TaskLinkValidator $taskLinkValidator
* @property \Kanboard\Validator\TaskValidator $taskValidator
* @property \Kanboard\Validator\UserValidator $userValidator
- * @property \Kanboard\Import\TaskImport $taskImport
+ * @property \Kanboard\Validator\PredefinedTaskDescriptionValidator $predefinedTaskDescriptionValidator
* @property \Kanboard\Import\UserImport $userImport
* @property \Kanboard\Export\SubtaskExport $subtaskExport
* @property \Kanboard\Export\TaskExport $taskExport
diff --git a/app/Core/ExternalTask/ExternalTaskManager.php b/app/Core/ExternalTask/ExternalTaskManager.php
index 102ec459..87a46b71 100644
--- a/app/Core/ExternalTask/ExternalTaskManager.php
+++ b/app/Core/ExternalTask/ExternalTaskManager.php
@@ -55,4 +55,14 @@ class ExternalTaskManager
return array();
}
+
+ /**
+ * Get all providers
+ *
+ * @return ExternalTaskProviderInterface[]
+ */
+ public function getProviders()
+ {
+ return $this->providers;
+ }
}
diff --git a/app/Core/ExternalTask/ExternalTaskProviderInterface.php b/app/Core/ExternalTask/ExternalTaskProviderInterface.php
index f67f7552..5678efb8 100644
--- a/app/Core/ExternalTask/ExternalTaskProviderInterface.php
+++ b/app/Core/ExternalTask/ExternalTaskProviderInterface.php
@@ -19,6 +19,22 @@ interface ExternalTaskProviderInterface
public function getName();
/**
+ * Get provider icon
+ *
+ * @access public
+ * @return string
+ */
+ public function getIcon();
+
+ /**
+ * Get label for adding a new task
+ *
+ * @access public
+ * @return string
+ */
+ public function getMenuAddLabel();
+
+ /**
* Retrieve task from external system or cache
*
* @access public
diff --git a/app/Core/Filter/QueryBuilder.php b/app/Core/Filter/QueryBuilder.php
index 3de82b63..bdd6b940 100644
--- a/app/Core/Filter/QueryBuilder.php
+++ b/app/Core/Filter/QueryBuilder.php
@@ -21,6 +21,18 @@ class QueryBuilder
protected $query;
/**
+ * Create a new class instance
+ *
+ * @static
+ * @access public
+ * @return static
+ */
+ public static function create()
+ {
+ return new static();
+ }
+
+ /**
* Set the query
*
* @access public
diff --git a/app/Core/Group/GroupBackendProviderInterface.php b/app/Core/Group/GroupBackendProviderInterface.php
index 74c5cb03..0b6e2985 100644
--- a/app/Core/Group/GroupBackendProviderInterface.php
+++ b/app/Core/Group/GroupBackendProviderInterface.php
@@ -5,7 +5,7 @@ namespace Kanboard\Core\Group;
/**
* Group Backend Provider Interface
*
- * @package group
+ * @package Kanboard\Core\Group
* @author Frederic Guillot
*/
interface GroupBackendProviderInterface
diff --git a/app/Core/Group/GroupManager.php b/app/Core/Group/GroupManager.php
index 48b6c4f8..a0559139 100644
--- a/app/Core/Group/GroupManager.php
+++ b/app/Core/Group/GroupManager.php
@@ -5,7 +5,7 @@ namespace Kanboard\Core\Group;
/**
* Group Manager
*
- * @package group
+ * @package Kanboard\Core\Group
* @author Frederic Guillot
*/
class GroupManager
@@ -13,10 +13,10 @@ class GroupManager
/**
* List of backend providers
*
- * @access private
+ * @access protected
* @var array
*/
- private $providers = array();
+ protected $providers = array();
/**
* Register a new group backend provider
@@ -52,11 +52,11 @@ class GroupManager
/**
* Remove duplicated groups
*
- * @access private
+ * @access protected
* @param array $groups
* @return GroupProviderInterface[]
*/
- private function removeDuplicates(array $groups)
+ protected function removeDuplicates(array $groups)
{
$result = array();
diff --git a/app/Core/Group/GroupProviderInterface.php b/app/Core/Group/GroupProviderInterface.php
index 4c7c16ec..f312f89b 100644
--- a/app/Core/Group/GroupProviderInterface.php
+++ b/app/Core/Group/GroupProviderInterface.php
@@ -5,7 +5,7 @@ namespace Kanboard\Core\Group;
/**
* Group Provider Interface
*
- * @package group
+ * @package Kanboard\Core\Group
* @author Frederic Guillot
*/
interface GroupProviderInterface
diff --git a/app/Core/Helper.php b/app/Core/Helper.php
index 1b53ae2b..5f4772d5 100644
--- a/app/Core/Helper.php
+++ b/app/Core/Helper.php
@@ -14,13 +14,11 @@ use Pimple\Container;
* @property \Kanboard\Helper\AssetHelper $asset
* @property \Kanboard\Helper\AvatarHelper $avatar
* @property \Kanboard\Helper\BoardHelper $board
- * @property \Kanboard\Helper\CalendarHelper $calendar
* @property \Kanboard\Helper\CommentHelper $comment
* @property \Kanboard\Helper\DateHelper $dt
* @property \Kanboard\Helper\FileHelper $file
* @property \Kanboard\Helper\FormHelper $form
* @property \Kanboard\Helper\HookHelper $hook
- * @property \Kanboard\Helper\ICalHelper $ical
* @property \Kanboard\Helper\ModalHelper $modal
* @property \Kanboard\Helper\ModelHelper $model
* @property \Kanboard\Helper\SubtaskHelper $subtask
diff --git a/app/Core/Ldap/Query.php b/app/Core/Ldap/Query.php
index 0f9abb5c..0fe7f2d3 100644
--- a/app/Core/Ldap/Query.php
+++ b/app/Core/Ldap/Query.php
@@ -44,9 +44,10 @@ class Query
* @param string $baseDn
* @param string $filter
* @param array $attributes
- * @return Query
+ * @param integer $limit
+ * @return $this
*/
- public function execute($baseDn, $filter, array $attributes)
+ public function execute($baseDn, $filter, array $attributes, $limit = 0)
{
if (DEBUG && $this->client->hasLogger()) {
$this->client->getLogger()->debug('BaseDN='.$baseDn);
@@ -54,7 +55,7 @@ class Query
$this->client->getLogger()->debug('Attributes='.implode(', ', $attributes));
}
- $sr = ldap_search($this->client->getConnection(), $baseDn, $filter, $attributes);
+ $sr = @ldap_search($this->client->getConnection(), $baseDn, $filter, $attributes, null, $limit);
if ($sr === false) {
return $this;
}
diff --git a/app/Core/Plugin/Installer.php b/app/Core/Plugin/Installer.php
index b3618aeb..057ded94 100644
--- a/app/Core/Plugin/Installer.php
+++ b/app/Core/Plugin/Installer.php
@@ -100,7 +100,7 @@ class Installer extends \Kanboard\Core\Base
{
$zip = new ZipArchive();
$archiveData = $this->httpClient->get($archiveUrl);
- $archiveFile = tempnam(sys_get_temp_dir(), 'kb_plugin');
+ $archiveFile = tempnam(ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir(), 'kb_plugin');
if (empty($archiveData)) {
unlink($archiveFile);
diff --git a/app/Core/User/UserBackendProviderInterface.php b/app/Core/User/UserBackendProviderInterface.php
new file mode 100644
index 00000000..5f8cab47
--- /dev/null
+++ b/app/Core/User/UserBackendProviderInterface.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace Kanboard\Core\User;
+
+/**
+ * User Backend Provider Interface
+ *
+ * @package Kanboard\Core\User
+ * @author Frederic Guillot
+ */
+interface UserBackendProviderInterface
+{
+ /**
+ * Find a user from a search query
+ *
+ * @access public
+ * @param string $input
+ * @return UserProviderInterface[]
+ */
+ public function find($input);
+}
diff --git a/app/Core/User/UserManager.php b/app/Core/User/UserManager.php
new file mode 100644
index 00000000..e1692480
--- /dev/null
+++ b/app/Core/User/UserManager.php
@@ -0,0 +1,71 @@
+<?php
+
+namespace Kanboard\Core\User;
+
+/**
+ * User Manager
+ *
+ * @package Kanboard\Core\User
+ * @author Frederic Guillot
+ */
+class UserManager
+{
+ /**
+ * List of backend providers
+ *
+ * @access protected
+ * @var array
+ */
+ protected $providers = array();
+
+ /**
+ * Register a new group backend provider
+ *
+ * @access public
+ * @param UserBackendProviderInterface $provider
+ * @return $this
+ */
+ public function register(UserBackendProviderInterface $provider)
+ {
+ $this->providers[] = $provider;
+ return $this;
+ }
+
+ /**
+ * Find a group from a search query
+ *
+ * @access public
+ * @param string $input
+ * @return UserProviderInterface[]
+ */
+ public function find($input)
+ {
+ $groups = array();
+
+ foreach ($this->providers as $provider) {
+ $groups = array_merge($groups, $provider->find($input));
+ }
+
+ return $this->removeDuplicates($groups);
+ }
+
+ /**
+ * Remove duplicated users
+ *
+ * @access protected
+ * @param array $users
+ * @return UserProviderInterface[]
+ */
+ protected function removeDuplicates(array $users)
+ {
+ $result = array();
+
+ foreach ($users as $user) {
+ if (! isset($result[$user->getUsername()])) {
+ $result[$user->getUsername()] = $user;
+ }
+ }
+
+ return array_values($result);
+ }
+}