mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-22 17:36:29 +02:00
add capacity to modify user
This commit is contained in:
parent
f9e0312c89
commit
4a39865903
12 changed files with 687 additions and 143 deletions
|
@ -13,6 +13,18 @@ namespace models;
|
|||
|
||||
class Quota extends StandardModel
|
||||
{
|
||||
/**
|
||||
* Return the quota for a user if it exists.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
*
|
||||
* @return array : quota if found, else empty array
|
||||
*/
|
||||
public function get_user_quota(int $id_user)
|
||||
{
|
||||
return $this->_select_one($this->get_table_name(), ['id_user' => $id_user]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get remaining credit for a date
|
||||
* if no quota for this user return max int
|
||||
|
@ -168,7 +180,6 @@ namespace models;
|
|||
{
|
||||
$at = $at->format('Y-m-d H:i:s');
|
||||
$where = [
|
||||
'!=expiration_date' => null,
|
||||
'<=expiration_date' => $at,
|
||||
'auto_renew' => true,
|
||||
];
|
||||
|
|
|
@ -31,6 +31,32 @@ namespace models;
|
|||
return $this->_select_one('user', ['id' => $id]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find user by ids
|
||||
* @param array $ids : users ids
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function gets_in_by_id($ids)
|
||||
{
|
||||
if (!$ids)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$query = '
|
||||
SELECT * FROM `user`
|
||||
WHERE id ';
|
||||
|
||||
$params = [];
|
||||
|
||||
$generated_in = $this->_generate_in_from_array($ids);
|
||||
$query .= $generated_in['QUERY'];
|
||||
$params = $generated_in['PARAMS'];
|
||||
|
||||
return $this->_run_query($query, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find a user using his email.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue