summaryrefslogtreecommitdiff
path: root/app/ServiceProvider
diff options
context:
space:
mode:
authorGerardo Zamudio <gerardozamudio@users.noreply.github.com>2016-02-24 23:48:50 -0600
committerGerardo Zamudio <gerardozamudio@users.noreply.github.com>2016-02-24 23:48:50 -0600
commite4de6b3898b64b26d29aff31f21df5fda8055686 (patch)
tree575f8a65440f291d70a070d168eafca8c82a6459 /app/ServiceProvider
parentd9ffbea174ea6524d0a22f8375ca8b3aa04a3c96 (diff)
parenta6540bc604c837d92c9368540c145606723e97f7 (diff)
Merge pull request #1 from fguillot/master
Update from upstream
Diffstat (limited to 'app/ServiceProvider')
-rw-r--r--app/ServiceProvider/ActionProvider.php82
-rw-r--r--app/ServiceProvider/AuthenticationProvider.php143
-rw-r--r--app/ServiceProvider/ClassProvider.php108
-rw-r--r--app/ServiceProvider/DatabaseProvider.php2
-rw-r--r--app/ServiceProvider/EventDispatcherProvider.php5
-rw-r--r--app/ServiceProvider/ExternalLinkProvider.php34
-rw-r--r--app/ServiceProvider/GroupProvider.php40
-rw-r--r--app/ServiceProvider/LoggingProvider.php2
-rw-r--r--app/ServiceProvider/NotificationProvider.php45
-rw-r--r--app/ServiceProvider/PluginProvider.php31
-rw-r--r--app/ServiceProvider/RouteProvider.php201
-rw-r--r--app/ServiceProvider/SessionProvider.php42
12 files changed, 693 insertions, 42 deletions
diff --git a/app/ServiceProvider/ActionProvider.php b/app/ServiceProvider/ActionProvider.php
new file mode 100644
index 00000000..3692f190
--- /dev/null
+++ b/app/ServiceProvider/ActionProvider.php
@@ -0,0 +1,82 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Action\ActionManager;
+use Kanboard\Action\CommentCreation;
+use Kanboard\Action\CommentCreationMoveTaskColumn;
+use Kanboard\Action\TaskAssignCategoryColor;
+use Kanboard\Action\TaskAssignCategoryLabel;
+use Kanboard\Action\TaskAssignCategoryLink;
+use Kanboard\Action\TaskAssignColorCategory;
+use Kanboard\Action\TaskAssignColorColumn;
+use Kanboard\Action\TaskAssignColorLink;
+use Kanboard\Action\TaskAssignColorUser;
+use Kanboard\Action\TaskAssignCurrentUser;
+use Kanboard\Action\TaskAssignCurrentUserColumn;
+use Kanboard\Action\TaskAssignSpecificUser;
+use Kanboard\Action\TaskAssignUser;
+use Kanboard\Action\TaskClose;
+use Kanboard\Action\TaskCloseColumn;
+use Kanboard\Action\TaskCreation;
+use Kanboard\Action\TaskDuplicateAnotherProject;
+use Kanboard\Action\TaskEmail;
+use Kanboard\Action\TaskEmailNoActivity;
+use Kanboard\Action\TaskMoveAnotherProject;
+use Kanboard\Action\TaskMoveColumnAssigned;
+use Kanboard\Action\TaskMoveColumnCategoryChange;
+use Kanboard\Action\TaskMoveColumnUnAssigned;
+use Kanboard\Action\TaskOpen;
+use Kanboard\Action\TaskUpdateStartDate;
+use Kanboard\Action\TaskCloseNoActivity;
+
+/**
+ * Action Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class ActionProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['actionManager'] = new ActionManager($container);
+ $container['actionManager']->register(new CommentCreation($container));
+ $container['actionManager']->register(new CommentCreationMoveTaskColumn($container));
+ $container['actionManager']->register(new TaskAssignCategoryColor($container));
+ $container['actionManager']->register(new TaskAssignCategoryLabel($container));
+ $container['actionManager']->register(new TaskAssignCategoryLink($container));
+ $container['actionManager']->register(new TaskAssignColorCategory($container));
+ $container['actionManager']->register(new TaskAssignColorColumn($container));
+ $container['actionManager']->register(new TaskAssignColorLink($container));
+ $container['actionManager']->register(new TaskAssignColorUser($container));
+ $container['actionManager']->register(new TaskAssignCurrentUser($container));
+ $container['actionManager']->register(new TaskAssignCurrentUserColumn($container));
+ $container['actionManager']->register(new TaskAssignSpecificUser($container));
+ $container['actionManager']->register(new TaskAssignUser($container));
+ $container['actionManager']->register(new TaskClose($container));
+ $container['actionManager']->register(new TaskCloseColumn($container));
+ $container['actionManager']->register(new TaskCloseNoActivity($container));
+ $container['actionManager']->register(new TaskCreation($container));
+ $container['actionManager']->register(new TaskDuplicateAnotherProject($container));
+ $container['actionManager']->register(new TaskEmail($container));
+ $container['actionManager']->register(new TaskEmailNoActivity($container));
+ $container['actionManager']->register(new TaskMoveAnotherProject($container));
+ $container['actionManager']->register(new TaskMoveColumnAssigned($container));
+ $container['actionManager']->register(new TaskMoveColumnCategoryChange($container));
+ $container['actionManager']->register(new TaskMoveColumnUnAssigned($container));
+ $container['actionManager']->register(new TaskOpen($container));
+ $container['actionManager']->register(new TaskUpdateStartDate($container));
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php
new file mode 100644
index 00000000..700fe05b
--- /dev/null
+++ b/app/ServiceProvider/AuthenticationProvider.php
@@ -0,0 +1,143 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Security\AuthenticationManager;
+use Kanboard\Core\Security\AccessMap;
+use Kanboard\Core\Security\Authorization;
+use Kanboard\Core\Security\Role;
+use Kanboard\Auth\RememberMeAuth;
+use Kanboard\Auth\DatabaseAuth;
+use Kanboard\Auth\LdapAuth;
+use Kanboard\Auth\TotpAuth;
+use Kanboard\Auth\ReverseProxyAuth;
+
+/**
+ * Authentication Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class AuthenticationProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['authenticationManager'] = new AuthenticationManager($container);
+ $container['authenticationManager']->register(new TotpAuth($container));
+ $container['authenticationManager']->register(new RememberMeAuth($container));
+ $container['authenticationManager']->register(new DatabaseAuth($container));
+
+ if (REVERSE_PROXY_AUTH) {
+ $container['authenticationManager']->register(new ReverseProxyAuth($container));
+ }
+
+ if (LDAP_AUTH) {
+ $container['authenticationManager']->register(new LdapAuth($container));
+ }
+
+ $container['projectAccessMap'] = $this->getProjectAccessMap();
+ $container['applicationAccessMap'] = $this->getApplicationAccessMap();
+
+ $container['projectAuthorization'] = new Authorization($container['projectAccessMap']);
+ $container['applicationAuthorization'] = new Authorization($container['applicationAccessMap']);
+
+ return $container;
+ }
+
+ /**
+ * Get ACL for projects
+ *
+ * @access public
+ * @return AccessMap
+ */
+ public function getProjectAccessMap()
+ {
+ $acl = new AccessMap;
+ $acl->setDefaultRole(Role::PROJECT_VIEWER);
+ $acl->setRoleHierarchy(Role::PROJECT_MANAGER, array(Role::PROJECT_MEMBER, Role::PROJECT_VIEWER));
+ $acl->setRoleHierarchy(Role::PROJECT_MEMBER, array(Role::PROJECT_VIEWER));
+
+ $acl->add('Action', '*', Role::PROJECT_MANAGER);
+ $acl->add('Analytic', '*', Role::PROJECT_MANAGER);
+ $acl->add('Board', 'save', Role::PROJECT_MEMBER);
+ $acl->add('BoardPopover', '*', Role::PROJECT_MEMBER);
+ $acl->add('Calendar', 'save', Role::PROJECT_MEMBER);
+ $acl->add('Category', '*', Role::PROJECT_MANAGER);
+ $acl->add('Column', '*', Role::PROJECT_MANAGER);
+ $acl->add('Comment', '*', Role::PROJECT_MEMBER);
+ $acl->add('Customfilter', '*', Role::PROJECT_MEMBER);
+ $acl->add('Export', '*', Role::PROJECT_MANAGER);
+ $acl->add('TaskFile', array('screenshot', 'create', 'save', 'remove', 'confirm'), Role::PROJECT_MEMBER);
+ $acl->add('Gantt', '*', Role::PROJECT_MANAGER);
+ $acl->add('Project', array('share', 'integrations', 'notifications', 'duplicate', 'disable', 'enable', 'remove'), Role::PROJECT_MANAGER);
+ $acl->add('ProjectPermission', '*', Role::PROJECT_MANAGER);
+ $acl->add('ProjectEdit', '*', Role::PROJECT_MANAGER);
+ $acl->add('ProjectFile', '*', Role::PROJECT_MEMBER);
+ $acl->add('Projectuser', '*', Role::PROJECT_MANAGER);
+ $acl->add('Subtask', '*', Role::PROJECT_MEMBER);
+ $acl->add('SubtaskRestriction', '*', Role::PROJECT_MEMBER);
+ $acl->add('SubtaskStatus', '*', Role::PROJECT_MEMBER);
+ $acl->add('Swimlane', '*', Role::PROJECT_MANAGER);
+ $acl->add('Task', 'remove', Role::PROJECT_MEMBER);
+ $acl->add('Taskcreation', '*', Role::PROJECT_MEMBER);
+ $acl->add('Taskduplication', '*', Role::PROJECT_MEMBER);
+ $acl->add('TaskRecurrence', '*', Role::PROJECT_MEMBER);
+ $acl->add('TaskImport', '*', Role::PROJECT_MANAGER);
+ $acl->add('Tasklink', '*', Role::PROJECT_MEMBER);
+ $acl->add('Tasklink', array('show'), Role::PROJECT_VIEWER);
+ $acl->add('TaskExternalLink', '*', Role::PROJECT_MEMBER);
+ $acl->add('TaskExternalLink', array('show'), Role::PROJECT_VIEWER);
+ $acl->add('Taskmodification', '*', Role::PROJECT_MEMBER);
+ $acl->add('Taskstatus', '*', Role::PROJECT_MEMBER);
+ $acl->add('UserHelper', array('mention'), Role::PROJECT_MEMBER);
+
+ return $acl;
+ }
+
+ /**
+ * Get ACL for the application
+ *
+ * @access public
+ * @return AccessMap
+ */
+ public function getApplicationAccessMap()
+ {
+ $acl = new AccessMap;
+ $acl->setDefaultRole(Role::APP_USER);
+ $acl->setRoleHierarchy(Role::APP_ADMIN, array(Role::APP_MANAGER, Role::APP_USER, Role::APP_PUBLIC));
+ $acl->setRoleHierarchy(Role::APP_MANAGER, array(Role::APP_USER, Role::APP_PUBLIC));
+ $acl->setRoleHierarchy(Role::APP_USER, array(Role::APP_PUBLIC));
+
+ $acl->add('Auth', array('login', 'check'), Role::APP_PUBLIC);
+ $acl->add('Captcha', '*', Role::APP_PUBLIC);
+ $acl->add('PasswordReset', '*', Role::APP_PUBLIC);
+ $acl->add('Webhook', '*', Role::APP_PUBLIC);
+ $acl->add('Task', 'readonly', Role::APP_PUBLIC);
+ $acl->add('Board', 'readonly', Role::APP_PUBLIC);
+ $acl->add('Ical', '*', Role::APP_PUBLIC);
+ $acl->add('Feed', '*', Role::APP_PUBLIC);
+
+ $acl->add('Config', '*', Role::APP_ADMIN);
+ $acl->add('Currency', '*', Role::APP_ADMIN);
+ $acl->add('Gantt', array('projects', 'saveProjectDate'), Role::APP_MANAGER);
+ $acl->add('Group', '*', Role::APP_ADMIN);
+ $acl->add('Link', '*', Role::APP_ADMIN);
+ $acl->add('ProjectCreation', 'create', Role::APP_MANAGER);
+ $acl->add('Projectuser', '*', Role::APP_MANAGER);
+ $acl->add('Twofactor', 'disable', Role::APP_ADMIN);
+ $acl->add('UserImport', '*', Role::APP_ADMIN);
+ $acl->add('User', array('index', 'create', 'save', 'authentication'), Role::APP_ADMIN);
+ $acl->add('UserStatus', '*', Role::APP_ADMIN);
+
+ return $acl;
+ }
+}
diff --git a/app/ServiceProvider/ClassProvider.php b/app/ServiceProvider/ClassProvider.php
index c103d639..0f2fbab5 100644
--- a/app/ServiceProvider/ClassProvider.php
+++ b/app/ServiceProvider/ClassProvider.php
@@ -4,44 +4,55 @@ namespace Kanboard\ServiceProvider;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
-use League\HTMLToMarkdown\HtmlConverter;
-use Kanboard\Core\Plugin\Loader;
use Kanboard\Core\Mail\Client as EmailClient;
use Kanboard\Core\ObjectStorage\FileStorage;
use Kanboard\Core\Paginator;
-use Kanboard\Core\OAuth2;
+use Kanboard\Core\Http\OAuth2;
use Kanboard\Core\Tool;
-use Kanboard\Model\UserNotificationType;
-use Kanboard\Model\ProjectNotificationType;
+use Kanboard\Core\Http\Client as HttpClient;
class ClassProvider implements ServiceProviderInterface
{
private $classes = array(
+ 'Analytic' => array(
+ 'TaskDistributionAnalytic',
+ 'UserDistributionAnalytic',
+ 'EstimatedTimeComparisonAnalytic',
+ 'AverageLeadCycleTimeAnalytic',
+ 'AverageTimeSpentColumnAnalytic',
+ ),
'Model' => array(
- 'Acl',
'Action',
- 'Authentication',
+ 'ActionParameter',
'Board',
'Category',
'Color',
+ 'Column',
'Comment',
'Config',
'Currency',
'CustomFilter',
- 'File',
+ 'Group',
+ 'GroupMember',
'LastLogin',
'Link',
'Notification',
'OverdueNotification',
+ 'PasswordReset',
'Project',
+ 'ProjectFile',
'ProjectActivity',
- 'ProjectAnalytic',
'ProjectDuplication',
'ProjectDailyColumnStats',
'ProjectDailyStats',
'ProjectPermission',
'ProjectNotification',
'ProjectMetadata',
+ 'ProjectGroupRole',
+ 'ProjectGroupRoleFilter',
+ 'ProjectUserRole',
+ 'ProjectUserRoleFilter',
+ 'RememberMeSession',
'Subtask',
'SubtaskExport',
'SubtaskTimeTracking',
@@ -51,22 +62,23 @@ class ClassProvider implements ServiceProviderInterface
'TaskCreation',
'TaskDuplication',
'TaskExport',
+ 'TaskExternalLink',
'TaskFinder',
+ 'TaskFile',
'TaskFilter',
'TaskLink',
'TaskModification',
'TaskPermission',
'TaskPosition',
'TaskStatus',
- 'TaskValidator',
'TaskImport',
'TaskMetadata',
'Transition',
'User',
'UserImport',
- 'UserSession',
+ 'UserLocking',
+ 'UserMention',
'UserNotification',
- 'UserNotificationType',
'UserNotificationFilter',
'UserUnreadNotification',
'UserMetadata',
@@ -77,27 +89,57 @@ class ClassProvider implements ServiceProviderInterface
'TaskFilterCalendarFormatter',
'TaskFilterICalendarFormatter',
'ProjectGanttFormatter',
+ 'UserFilterAutoCompleteFormatter',
+ 'GroupAutoCompleteFormatter',
+ ),
+ 'Validator' => array(
+ 'ActionValidator',
+ 'AuthValidator',
+ 'CategoryValidator',
+ 'ColumnValidator',
+ 'CommentValidator',
+ 'CurrencyValidator',
+ 'CustomFilterValidator',
+ 'ExternalLinkValidator',
+ 'GroupValidator',
+ 'LinkValidator',
+ 'PasswordResetValidator',
+ 'ProjectValidator',
+ 'SubtaskValidator',
+ 'SwimlaneValidator',
+ 'TaskValidator',
+ 'TaskLinkValidator',
+ 'UserValidator',
),
'Core' => array(
'DateParser',
'Helper',
- 'HttpClient',
'Lexer',
- 'Request',
- 'Router',
- 'Session',
'Template',
),
+ 'Core\Event' => array(
+ 'EventManager',
+ ),
+ 'Core\Http' => array(
+ 'Request',
+ 'Response',
+ 'RememberMeCookie',
+ ),
'Core\Cache' => array(
'MemoryCache',
),
'Core\Plugin' => array(
'Hook',
),
- 'Integration' => array(
- 'BitbucketWebhook',
- 'GithubWebhook',
- 'GitlabWebhook',
+ 'Core\Security' => array(
+ 'Token',
+ 'Role',
+ ),
+ 'Core\User' => array(
+ 'GroupSync',
+ 'UserSync',
+ 'UserSession',
+ 'UserProfile',
)
);
@@ -113,8 +155,8 @@ class ClassProvider implements ServiceProviderInterface
return new OAuth2($c);
});
- $container['htmlConverter'] = function () {
- return new HtmlConverter(array('strip_tags' => true));
+ $container['httpClient'] = function ($c) {
+ return new HttpClient($c);
};
$container['objectStorage'] = function () {
@@ -129,22 +171,12 @@ class ClassProvider implements ServiceProviderInterface
return $mailer;
};
- $container['userNotificationType'] = function ($container) {
- $type = new UserNotificationType($container);
- $type->setType('email', t('Email'), '\Kanboard\Notification\Mail');
- $type->setType('web', t('Web'), '\Kanboard\Notification\Web');
- return $type;
- };
-
- $container['projectNotificationType'] = function ($container) {
- $type = new ProjectNotificationType($container);
- $type->setType('webhook', 'Webhook', '\Kanboard\Notification\Webhook', true);
- $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStream', true);
- return $type;
- };
-
- $container['pluginLoader'] = new Loader($container);
+ $container['cspRules'] = array(
+ 'default-src' => "'self'",
+ 'style-src' => "'self' 'unsafe-inline'",
+ 'img-src' => '* data:',
+ );
- $container['cspRules'] = array('style-src' => "'self' 'unsafe-inline'", 'img-src' => '* data:');
+ return $container;
}
}
diff --git a/app/ServiceProvider/DatabaseProvider.php b/app/ServiceProvider/DatabaseProvider.php
index b2115644..8cede8af 100644
--- a/app/ServiceProvider/DatabaseProvider.php
+++ b/app/ServiceProvider/DatabaseProvider.php
@@ -15,6 +15,8 @@ class DatabaseProvider implements ServiceProviderInterface
$container['db'] = $this->getInstance();
$container['db']->stopwatch = DEBUG;
$container['db']->logQueries = DEBUG;
+
+ return $container;
}
/**
diff --git a/app/ServiceProvider/EventDispatcherProvider.php b/app/ServiceProvider/EventDispatcherProvider.php
index 1711919e..880caa41 100644
--- a/app/ServiceProvider/EventDispatcherProvider.php
+++ b/app/ServiceProvider/EventDispatcherProvider.php
@@ -11,7 +11,6 @@ use Kanboard\Subscriber\NotificationSubscriber;
use Kanboard\Subscriber\ProjectDailySummarySubscriber;
use Kanboard\Subscriber\ProjectModificationDateSubscriber;
use Kanboard\Subscriber\SubtaskTimeTrackingSubscriber;
-use Kanboard\Subscriber\TaskMovedDateSubscriber;
use Kanboard\Subscriber\TransitionSubscriber;
use Kanboard\Subscriber\RecurringTaskSubscriber;
@@ -26,11 +25,9 @@ class EventDispatcherProvider implements ServiceProviderInterface
$container['dispatcher']->addSubscriber(new ProjectModificationDateSubscriber($container));
$container['dispatcher']->addSubscriber(new NotificationSubscriber($container));
$container['dispatcher']->addSubscriber(new SubtaskTimeTrackingSubscriber($container));
- $container['dispatcher']->addSubscriber(new TaskMovedDateSubscriber($container));
$container['dispatcher']->addSubscriber(new TransitionSubscriber($container));
$container['dispatcher']->addSubscriber(new RecurringTaskSubscriber($container));
- // Automatic actions
- $container['action']->attachEvents();
+ return $container;
}
}
diff --git a/app/ServiceProvider/ExternalLinkProvider.php b/app/ServiceProvider/ExternalLinkProvider.php
new file mode 100644
index 00000000..c4bbc4cf
--- /dev/null
+++ b/app/ServiceProvider/ExternalLinkProvider.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\ExternalLink\ExternalLinkManager;
+use Kanboard\ExternalLink\WebLinkProvider;
+use Kanboard\ExternalLink\AttachmentLinkProvider;
+
+/**
+ * External Link Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class ExternalLinkProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['externalLinkManager'] = new ExternalLinkManager($container);
+ $container['externalLinkManager']->register(new WebLinkProvider($container));
+ $container['externalLinkManager']->register(new AttachmentLinkProvider($container));
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/GroupProvider.php b/app/ServiceProvider/GroupProvider.php
new file mode 100644
index 00000000..b222b218
--- /dev/null
+++ b/app/ServiceProvider/GroupProvider.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Group\GroupManager;
+use Kanboard\Group\DatabaseBackendGroupProvider;
+use Kanboard\Group\LdapBackendGroupProvider;
+
+/**
+ * Group Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class GroupProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['groupManager'] = new GroupManager;
+
+ if (DB_GROUP_PROVIDER) {
+ $container['groupManager']->register(new DatabaseBackendGroupProvider($container));
+ }
+
+ if (LDAP_AUTH && LDAP_GROUP_PROVIDER) {
+ $container['groupManager']->register(new LdapBackendGroupProvider($container));
+ }
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/LoggingProvider.php b/app/ServiceProvider/LoggingProvider.php
index 4344bccc..68c074f0 100644
--- a/app/ServiceProvider/LoggingProvider.php
+++ b/app/ServiceProvider/LoggingProvider.php
@@ -26,5 +26,7 @@ class LoggingProvider implements ServiceProviderInterface
}
$container['logger'] = $logger;
+
+ return $container;
}
}
diff --git a/app/ServiceProvider/NotificationProvider.php b/app/ServiceProvider/NotificationProvider.php
new file mode 100644
index 00000000..83daf65d
--- /dev/null
+++ b/app/ServiceProvider/NotificationProvider.php
@@ -0,0 +1,45 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Model\UserNotificationType;
+use Kanboard\Model\ProjectNotificationType;
+use Kanboard\Notification\Mail as MailNotification;
+use Kanboard\Notification\Web as WebNotification;
+
+/**
+ * Notification Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class NotificationProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['userNotificationType'] = function ($container) {
+ $type = new UserNotificationType($container);
+ $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\Mail');
+ $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\Web');
+ return $type;
+ };
+
+ $container['projectNotificationType'] = function ($container) {
+ $type = new ProjectNotificationType($container);
+ $type->setType('webhook', 'Webhook', '\Kanboard\Notification\Webhook', true);
+ $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStream', true);
+ return $type;
+ };
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/PluginProvider.php b/app/ServiceProvider/PluginProvider.php
new file mode 100644
index 00000000..d2f1666b
--- /dev/null
+++ b/app/ServiceProvider/PluginProvider.php
@@ -0,0 +1,31 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Plugin\Loader;
+
+/**
+ * Plugin Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class PluginProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['pluginLoader'] = new Loader($container);
+ $container['pluginLoader']->scan();
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/RouteProvider.php b/app/ServiceProvider/RouteProvider.php
new file mode 100644
index 00000000..d551f25d
--- /dev/null
+++ b/app/ServiceProvider/RouteProvider.php
@@ -0,0 +1,201 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Http\Route;
+use Kanboard\Core\Http\Router;
+
+/**
+ * Route Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class RouteProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['router'] = new Router($container);
+ $container['route'] = new Route($container);
+
+ if (ENABLE_URL_REWRITE) {
+ $container['route']->enable();
+
+ // Dashboard
+ $container['route']->addRoute('dashboard', 'app', 'index');
+ $container['route']->addRoute('dashboard/:user_id', 'app', 'index');
+ $container['route']->addRoute('dashboard/:user_id/projects', 'app', 'projects');
+ $container['route']->addRoute('dashboard/:user_id/tasks', 'app', 'tasks');
+ $container['route']->addRoute('dashboard/:user_id/subtasks', 'app', 'subtasks');
+ $container['route']->addRoute('dashboard/:user_id/calendar', 'app', 'calendar');
+ $container['route']->addRoute('dashboard/:user_id/activity', 'app', 'activity');
+ $container['route']->addRoute('dashboard/:user_id/notifications', 'app', 'notifications');
+
+ // Search routes
+ $container['route']->addRoute('search', 'search', 'index');
+ $container['route']->addRoute('search/:search', 'search', 'index');
+
+ // ProjectCreation routes
+ $container['route']->addRoute('project/create', 'ProjectCreation', 'create');
+ $container['route']->addRoute('project/create/private', 'ProjectCreation', 'createPrivate');
+
+ // Project routes
+ $container['route']->addRoute('projects', 'project', 'index');
+ $container['route']->addRoute('project/:project_id', 'project', 'show');
+ $container['route']->addRoute('p/:project_id', 'project', 'show');
+ $container['route']->addRoute('project/:project_id/customer-filters', 'customfilter', 'index');
+ $container['route']->addRoute('project/:project_id/share', 'project', 'share');
+ $container['route']->addRoute('project/:project_id/notifications', 'project', 'notifications');
+ $container['route']->addRoute('project/:project_id/integrations', 'project', 'integrations');
+ $container['route']->addRoute('project/:project_id/duplicate', 'project', 'duplicate');
+ $container['route']->addRoute('project/:project_id/remove', 'project', 'remove');
+ $container['route']->addRoute('project/:project_id/disable', 'project', 'disable');
+ $container['route']->addRoute('project/:project_id/enable', 'project', 'enable');
+ $container['route']->addRoute('project/:project_id/permissions', 'ProjectPermission', 'index');
+ $container['route']->addRoute('project/:project_id/import', 'taskImport', 'step1');
+
+ // Project Overview
+ $container['route']->addRoute('project/:project_id/overview', 'ProjectOverview', 'show');
+
+ // ProjectEdit routes
+ $container['route']->addRoute('project/:project_id/edit', 'ProjectEdit', 'edit');
+ $container['route']->addRoute('project/:project_id/edit/dates', 'ProjectEdit', 'dates');
+ $container['route']->addRoute('project/:project_id/edit/description', 'ProjectEdit', 'description');
+ $container['route']->addRoute('project/:project_id/edit/priority', 'ProjectEdit', 'priority');
+
+ // ProjectUser routes
+ $container['route']->addRoute('projects/managers/:user_id', 'projectuser', 'managers');
+ $container['route']->addRoute('projects/members/:user_id', 'projectuser', 'members');
+ $container['route']->addRoute('projects/tasks/:user_id/opens', 'projectuser', 'opens');
+ $container['route']->addRoute('projects/tasks/:user_id/closed', 'projectuser', 'closed');
+ $container['route']->addRoute('projects/managers', 'projectuser', 'managers');
+
+ // Action routes
+ $container['route']->addRoute('project/:project_id/actions', 'action', 'index');
+
+ // Column routes
+ $container['route']->addRoute('project/:project_id/columns', 'column', 'index');
+
+ // Swimlane routes
+ $container['route']->addRoute('project/:project_id/swimlanes', 'swimlane', 'index');
+
+ // Category routes
+ $container['route']->addRoute('project/:project_id/categories', 'category', 'index');
+
+ // Task routes
+ $container['route']->addRoute('project/:project_id/task/:task_id', 'task', 'show');
+ $container['route']->addRoute('t/:task_id', 'task', 'show');
+ $container['route']->addRoute('public/task/:task_id/:token', 'task', 'readonly');
+
+ $container['route']->addRoute('project/:project_id/task/:task_id/activity', 'activity', 'task');
+ $container['route']->addRoute('project/:project_id/task/:task_id/transitions', 'task', 'transitions');
+ $container['route']->addRoute('project/:project_id/task/:task_id/analytics', 'task', 'analytics');
+ $container['route']->addRoute('project/:project_id/task/:task_id/subtasks', 'subtask', 'show');
+ $container['route']->addRoute('project/:project_id/task/:task_id/time-tracking', 'task', 'timetracking');
+ $container['route']->addRoute('project/:project_id/task/:task_id/internal/links', 'tasklink', 'show');
+ $container['route']->addRoute('project/:project_id/task/:task_id/external/links', 'TaskExternalLink', 'show');
+
+ // Exports
+ $container['route']->addRoute('export/tasks/:project_id', 'export', 'tasks');
+ $container['route']->addRoute('export/subtasks/:project_id', 'export', 'subtasks');
+ $container['route']->addRoute('export/transitions/:project_id', 'export', 'transitions');
+ $container['route']->addRoute('export/summary/:project_id', 'export', 'summary');
+
+ // Analytics routes
+ $container['route']->addRoute('analytics/tasks/:project_id', 'analytic', 'tasks');
+ $container['route']->addRoute('analytics/users/:project_id', 'analytic', 'users');
+ $container['route']->addRoute('analytics/cfd/:project_id', 'analytic', 'cfd');
+ $container['route']->addRoute('analytics/burndown/:project_id', 'analytic', 'burndown');
+ $container['route']->addRoute('analytics/average-time-column/:project_id', 'analytic', 'averageTimeByColumn');
+ $container['route']->addRoute('analytics/lead-cycle-time/:project_id', 'analytic', 'leadAndCycleTime');
+ $container['route']->addRoute('analytics/estimated-spent-time/:project_id', 'analytic', 'compareHours');
+
+ // Board routes
+ $container['route']->addRoute('board/:project_id', 'board', 'show');
+ $container['route']->addRoute('b/:project_id', 'board', 'show');
+ $container['route']->addRoute('public/board/:token', 'board', 'readonly');
+
+ // Calendar routes
+ $container['route']->addRoute('calendar/:project_id', 'calendar', 'show');
+ $container['route']->addRoute('c/:project_id', 'calendar', 'show');
+
+ // Listing routes
+ $container['route']->addRoute('list/:project_id', 'listing', 'show');
+ $container['route']->addRoute('l/:project_id', 'listing', 'show');
+
+ // Gantt routes
+ $container['route']->addRoute('gantt/:project_id', 'gantt', 'project');
+ $container['route']->addRoute('gantt/:project_id/sort/:sorting', 'gantt', 'project');
+
+ // Feed routes
+ $container['route']->addRoute('feed/project/:token', 'feed', 'project');
+ $container['route']->addRoute('feed/user/:token', 'feed', 'user');
+
+ // Ical routes
+ $container['route']->addRoute('ical/project/:token', 'ical', 'project');
+ $container['route']->addRoute('ical/user/:token', 'ical', 'user');
+
+ // Users
+ $container['route']->addRoute('users', 'user', 'index');
+ $container['route']->addRoute('user/profile/:user_id', 'user', 'profile');
+ $container['route']->addRoute('user/show/:user_id', 'user', 'show');
+ $container['route']->addRoute('user/show/:user_id/timesheet', 'user', 'timesheet');
+ $container['route']->addRoute('user/show/:user_id/last-logins', 'user', 'last');
+ $container['route']->addRoute('user/show/:user_id/sessions', 'user', 'sessions');
+ $container['route']->addRoute('user/:user_id/edit', 'user', 'edit');
+ $container['route']->addRoute('user/:user_id/password', 'user', 'password');
+ $container['route']->addRoute('user/:user_id/share', 'user', 'share');
+ $container['route']->addRoute('user/:user_id/notifications', 'user', 'notifications');
+ $container['route']->addRoute('user/:user_id/accounts', 'user', 'external');
+ $container['route']->addRoute('user/:user_id/integrations', 'user', 'integrations');
+ $container['route']->addRoute('user/:user_id/authentication', 'user', 'authentication');
+ $container['route']->addRoute('user/:user_id/2fa', 'twofactor', 'index');
+
+ // Groups
+ $container['route']->addRoute('groups', 'group', 'index');
+ $container['route']->addRoute('groups/create', 'group', 'create');
+ $container['route']->addRoute('group/:group_id/associate', 'group', 'associate');
+ $container['route']->addRoute('group/:group_id/dissociate/:user_id', 'group', 'dissociate');
+ $container['route']->addRoute('group/:group_id/edit', 'group', 'edit');
+ $container['route']->addRoute('group/:group_id/members', 'group', 'users');
+ $container['route']->addRoute('group/:group_id/remove', 'group', 'confirm');
+
+ // Config
+ $container['route']->addRoute('settings', 'config', 'index');
+ $container['route']->addRoute('settings/plugins', 'config', 'plugins');
+ $container['route']->addRoute('settings/application', 'config', 'application');
+ $container['route']->addRoute('settings/project', 'config', 'project');
+ $container['route']->addRoute('settings/project', 'config', 'project');
+ $container['route']->addRoute('settings/board', 'config', 'board');
+ $container['route']->addRoute('settings/calendar', 'config', 'calendar');
+ $container['route']->addRoute('settings/integrations', 'config', 'integrations');
+ $container['route']->addRoute('settings/webhook', 'config', 'webhook');
+ $container['route']->addRoute('settings/api', 'config', 'api');
+ $container['route']->addRoute('settings/links', 'link', 'index');
+ $container['route']->addRoute('settings/currencies', 'currency', 'index');
+
+ // Doc
+ $container['route']->addRoute('documentation/:file', 'doc', 'show');
+ $container['route']->addRoute('documentation', 'doc', 'show');
+
+ // Auth routes
+ $container['route']->addRoute('login', 'auth', 'login');
+ $container['route']->addRoute('logout', 'auth', 'logout');
+
+ // PasswordReset
+ $container['route']->addRoute('forgot-password', 'PasswordReset', 'create');
+ $container['route']->addRoute('forgot-password/change/:token', 'PasswordReset', 'change');
+ }
+
+ return $container;
+ }
+}
diff --git a/app/ServiceProvider/SessionProvider.php b/app/ServiceProvider/SessionProvider.php
new file mode 100644
index 00000000..0999d531
--- /dev/null
+++ b/app/ServiceProvider/SessionProvider.php
@@ -0,0 +1,42 @@
+<?php
+
+namespace Kanboard\ServiceProvider;
+
+use Pimple\Container;
+use Pimple\ServiceProviderInterface;
+use Kanboard\Core\Session\SessionManager;
+use Kanboard\Core\Session\SessionStorage;
+use Kanboard\Core\Session\FlashMessage;
+
+/**
+ * Session Provider
+ *
+ * @package serviceProvider
+ * @author Frederic Guillot
+ */
+class SessionProvider implements ServiceProviderInterface
+{
+ /**
+ * Register providers
+ *
+ * @access public
+ * @param \Pimple\Container $container
+ * @return \Pimple\Container
+ */
+ public function register(Container $container)
+ {
+ $container['sessionStorage'] = function() {
+ return new SessionStorage;
+ };
+
+ $container['sessionManager'] = function($c) {
+ return new SessionManager($c);
+ };
+
+ $container['flash'] = function($c) {
+ return new FlashMessage($c);
+ };
+
+ return $container;
+ }
+}