summaryrefslogtreecommitdiff
path: root/app/Model/UserModel.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2017-11-30 12:02:48 -0800
committerFrédéric Guillot <fred@kanboard.net>2017-11-30 12:02:48 -0800
commitcb9e6377f6dd1d16d6c5d1aa98014941eef48814 (patch)
treeb0abb935cc996f869565fcf43613023052f63933 /app/Model/UserModel.php
parentaa5199db7f0915e0115ac302fa4d3e0552b0a4b0 (diff)
Disable private projects when disabling a user
Diffstat (limited to 'app/Model/UserModel.php')
-rw-r--r--app/Model/UserModel.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/Model/UserModel.php b/app/Model/UserModel.php
index af49ce7d..c44fd3e7 100644
--- a/app/Model/UserModel.php
+++ b/app/Model/UserModel.php
@@ -286,7 +286,11 @@ class UserModel extends Base
*/
public function disable($user_id)
{
- return $this->db->table(self::TABLE)->eq('id', $user_id)->update(array('is_active' => 0));
+ $this->db->startTransaction();
+ $result1 = $this->db->table(self::TABLE)->eq('id', $user_id)->update(array('is_active' => 0));
+ $result2 = $this->db->table(ProjectModel::TABLE)->eq('is_private', 1)->eq('owner_id', $user_id)->update(array('is_active' => 0));
+ $this->db->closeTransaction();
+ return $result1 && $result2;
}
/**