Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c84c32de

Přidáno uživatelem Ondřej Fibich před více než 7 roky(ů)

Fixes #1069: user with watcher can be deleted

Zobrazit rozdíly:

application/controllers/users.php
status::warning('User cannot be deleted, he has some dependent items in database.');
url::redirect($linkback);
}
$user_model->delete_watchers($user_id);
if ($user_model->delete())
{
status::success('User has been successfully deleted.');
......
$user_data->type = User_Model::USER;
$user_data->member_id = $member_id;
$user_data->application_password = security::generate_password();
$user_data->settings = '';
$saved = $user_data->save();
// insert users access rights
application/models/user.php
* @param integer $user_id
*/
public function delete_depends_items($user_id)
{
{
$this->delete_watchers($user_id);
$this->db->query("
DELETE FROM devices
WHERE user_id = ?
......
", $user_id);
}
/**
* Function searches for user watchers and delete them.
*
* @param integer $user_id
*/
public function delete_watchers($user_id)
{
$this->db->query("
DELETE FROM watchers
WHERE user_id = ?
", $user_id);
}
/**
* Selects all users emails
*

Také k dispozici: Unified diff