Disable private projects when disabling a user

This commit is contained in:
Frédéric Guillot
2017-11-30 12:02:48 -08:00
parent aa5199db7f
commit cb9e6377f6
2 changed files with 18 additions and 1 deletions

View File

@@ -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;
}
/**