diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-01 03:33:18 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-06-01 03:33:18 +0300 |
| commit | 864fbb806621c8167c49f7449486fbc3bdaca1a6 (patch) | |
| tree | 1b5b5933dbb184b130c248d3281e709bd6286c5d /public/app/models/Access_model.php | |
| parent | 950798a91c0bed3f2d6e53182b0cff49f07eff0c (diff) | |
| download | gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.gz gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.tar.bz2 gyraf1gov-864fbb806621c8167c49f7449486fbc3bdaca1a6.zip | |
user update; user petitions copy; fixed docker performance issues
Diffstat (limited to 'public/app/models/Access_model.php')
| -rw-r--r-- | public/app/models/Access_model.php | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/public/app/models/Access_model.php b/public/app/models/Access_model.php index 844ff6b..5c9f991 100644 --- a/public/app/models/Access_model.php +++ b/public/app/models/Access_model.php @@ -41,7 +41,7 @@ class Access_model { return Registry::use('database')->query( "SELECT * FROM user WHERE invitation = :invitation", - ['invitation' => $invitation] + [ 'invitation' => $invitation ] )->getFirst(); } @@ -166,6 +166,58 @@ class Access_model + /** update_user + * + * activate user and set password + * + * @param array $post; + * @param int $id: user id + */ + public static function update_user($post, $id) + { + // Update and set activate = true + $rowCount = Registry::use('database')->query( + "UPDATE user + SET first_name = :first_name, + last_name = :last_name, + email = :email, + father_name = :father_name, + registration_number = :registration_number, + sector = :sector, + belonging_school = :belonging_school, + position = :position, + phone = :phone, + invitation = NULL, + active = :active + WHERE id = :id", + [ + ':first_name' => $post['first_name'], + ':last_name' => $post['last_name'], + ':email' => $post['email'], + ':father_name' => $post['father_name'], + ':registration_number' => $post['registration_number'], + ':sector' => $post['sector'], + ':belonging_school' => $post['belonging_school'], + ':position' => $post['position'], + ':phone' => $post['phone'], + ':active' => 1, + ':id' => $id + ] + )->rowCount(); + + // update history + if ($rowCount != 0) { + History_model::trackUserAccess( + $id, TRACK_ACCOUNT, 'User properties changed' + ); + } + + return $rowCount; + + } + + + ## Set permission methods ## ------------------------------------------------------------------------- |
