summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAurélien <cadiou.aurelien@gmail.com>2018-04-02 23:07:04 +0200
committerFrédéric Guillot <fred@kanboard.net>2018-04-02 14:07:04 -0700
commit5f7a3442d61b99e2fbad732bd0eaf9ad64398274 (patch)
tree78d2b159be9d2df92e28c90164430fdac2a4cac7 /app
parentbc4457c4cb096a448d88ca882d30bae15aff56c3 (diff)
Add default filter per user
Diffstat (limited to 'app')
-rw-r--r--app/Controller/UserModificationController.php1
-rw-r--r--app/Core/User/UserSession.php2
-rw-r--r--app/Schema/Mysql.php7
-rw-r--r--app/Schema/Postgres.php7
-rw-r--r--app/Schema/Sql/mysql.sql1
-rw-r--r--app/Schema/Sql/postgres.sql3
-rw-r--r--app/Schema/Sqlite.php7
-rw-r--r--app/Template/user_creation/show.php3
-rw-r--r--app/Template/user_modification/show.php3
-rw-r--r--app/Template/user_view/show.php1
10 files changed, 30 insertions, 5 deletions
diff --git a/app/Controller/UserModificationController.php b/app/Controller/UserModificationController.php
index f4916f6f..645a2620 100644
--- a/app/Controller/UserModificationController.php
+++ b/app/Controller/UserModificationController.php
@@ -54,6 +54,7 @@ class UserModificationController extends BaseController
'email' => isset($values['email']) ? $values['email'] : '',
'timezone' => isset($values['timezone']) ? $values['timezone'] : '',
'language' => isset($values['language']) ? $values['language'] : '',
+ 'filter' => isset($values['filter']) ? $values['filter'] : '',
);
}
diff --git a/app/Core/User/UserSession.php b/app/Core/User/UserSession.php
index 0206be80..d52e6c73 100644
--- a/app/Core/User/UserSession.php
+++ b/app/Core/User/UserSession.php
@@ -223,7 +223,7 @@ class UserSession extends Base
public function getFilters($projectID)
{
if (! session_exists('filters:'.$projectID)) {
- return 'status:open';
+ return session_get('user')['filter'];
}
return session_get('filters:'.$projectID);
diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php
index 32171d17..b73ce8c0 100644
--- a/app/Schema/Mysql.php
+++ b/app/Schema/Mysql.php
@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 127;
+const VERSION = 128;
+
+function version_128(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE `users` ADD COLUMN `filter` VARCHAR(255) DEFAULT NULL');
+}
function version_127(PDO $pdo)
{
diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php
index 8d5a68e5..50ea4850 100644
--- a/app/Schema/Postgres.php
+++ b/app/Schema/Postgres.php
@@ -8,7 +8,12 @@ use PDO;
use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
-const VERSION = 106;
+const VERSION = 107;
+
+function version_107(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE "users" ADD COLUMN filter VARCHAR(255) DEFAULT NULL');
+}
function version_106(PDO $pdo)
{
diff --git a/app/Schema/Sql/mysql.sql b/app/Schema/Sql/mysql.sql
index 37da98cc..199fd797 100644
--- a/app/Schema/Sql/mysql.sql
+++ b/app/Schema/Sql/mysql.sql
@@ -752,6 +752,7 @@ CREATE TABLE `users` (
`is_active` tinyint(1) DEFAULT '1',
`avatar_path` varchar(255) DEFAULT NULL,
`api_access_token` varchar(255) DEFAULT NULL,
+ `filter` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `users_username_idx` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/app/Schema/Sql/postgres.sql b/app/Schema/Sql/postgres.sql
index 1d45870a..e43248c3 100644
--- a/app/Schema/Sql/postgres.sql
+++ b/app/Schema/Sql/postgres.sql
@@ -1299,7 +1299,8 @@ CREATE TABLE "users" (
"role" character varying(25) DEFAULT 'app-user'::character varying NOT NULL,
"is_active" boolean DEFAULT true,
"avatar_path" character varying(255),
- "api_access_token" character varying(255) DEFAULT NULL::character varying
+ "api_access_token" character varying(255) DEFAULT NULL::character varying,
+ "filter" character varying(255) DEFAULT NULL::character varying
);
diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php
index e40b2aeb..aced61e0 100644
--- a/app/Schema/Sqlite.php
+++ b/app/Schema/Sqlite.php
@@ -8,7 +8,12 @@ use Kanboard\Core\Security\Token;
use Kanboard\Core\Security\Role;
use PDO;
-const VERSION = 117;
+const VERSION = 118;
+
+function version_118(PDO $pdo)
+{
+ $pdo->exec('ALTER TABLE users ADD COLUMN filter VARCHAR(255) DEFAULT NULL');
+}
function version_117(PDO $pdo)
{
diff --git a/app/Template/user_creation/show.php b/app/Template/user_creation/show.php
index 597dce55..007dd701 100644
--- a/app/Template/user_creation/show.php
+++ b/app/Template/user_creation/show.php
@@ -50,6 +50,9 @@
<?= $this->form->label(t('Language'), 'language') ?>
<?= $this->form->select('language', $languages, $values, $errors) ?>
+
+ <?= $this->form->label(t('Filter'), 'filter') ?>
+ <?= $this->form->text('filter', $values, $errors) ?>
<?= $this->form->checkbox('notifications_enabled', t('Enable email notifications'), 1, isset($values['notifications_enabled']) && $values['notifications_enabled'] == 1 ? true : false) ?>
</fieldset>
diff --git a/app/Template/user_modification/show.php b/app/Template/user_modification/show.php
index b296371f..6244e255 100644
--- a/app/Template/user_modification/show.php
+++ b/app/Template/user_modification/show.php
@@ -24,6 +24,9 @@
<?= $this->form->label(t('Language'), 'language') ?>
<?= $this->form->select('language', $languages, $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_language') ? '' : 'disabled')) ?>
+
+ <?= $this->form->label(t('Filter'), 'filter') ?>
+ <?= $this->form->text('filter', $values, $errors, array($this->user->hasAccess('UserModificationController', 'show/edit_filter') ? '' : 'readonly')) ?>
</fieldset>
<?php if ($this->user->isAdmin()): ?>
diff --git a/app/Template/user_view/show.php b/app/Template/user_view/show.php
index 7f847f65..39d10ab5 100644
--- a/app/Template/user_view/show.php
+++ b/app/Template/user_view/show.php
@@ -33,6 +33,7 @@
<ul class="panel">
<li><?= t('Timezone:') ?> <strong><?= $this->text->in($user['timezone'], $timezones) ?></strong></li>
<li><?= t('Language:') ?> <strong><?= $this->text->in($user['language'], $languages) ?></strong></li>
+ <li><?= t('Filter:') ?> <strong><?= $this->text->e($user['filter']) ?></strong></li>
<li><?= t('Notifications:') ?> <strong><?= $user['notifications_enabled'] == 1 ? t('Enabled') : t('Disabled') ?></strong></li>
</ul>