mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
Add default settings generation on new user creation
This commit is contained in:
parent
2671c464a4
commit
d8839a57d0
2 changed files with 30 additions and 3 deletions
|
@ -75,4 +75,22 @@ namespace controllers\internals;
|
|||
|
||||
return (bool) $this->get_model()->insert($setting);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate and insert default settings for a user
|
||||
* @param int $id_user : user id
|
||||
* @return bool
|
||||
*/
|
||||
public function create_defaults_for_user(int $id_user)
|
||||
{
|
||||
$all_success = true;
|
||||
foreach (USER_DEFAULT_SETTINGS as $name => $value)
|
||||
{
|
||||
$success = $this->create($id_user, $name, $value);
|
||||
$all_success = ($all_success && $success);
|
||||
}
|
||||
|
||||
return $all_success;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue