Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchParapheur
Commits
e780b75c
Verified
Commit
e780b75c
authored
May 28, 2021
by
Damien
Browse files
FEAT #16982 TIME 1 User phone
parent
12a0b6be
Changes
3
Hide whitespace changes
Inline
Side-by-side
sql/structure.sql
View file @
e780b75c
...
...
@@ -217,6 +217,7 @@ CREATE TABLE users
"password"
character
varying
(
255
)
NOT
NULL
,
firstname
character
varying
(
128
)
NOT
NULL
,
lastname
character
varying
(
128
)
NOT
NULL
,
phone
character
varying
(
128
),
picture
text
,
"isRest"
boolean
DEFAULT
FALSE
NOT
NULL
,
preferences
jsonb
NOT
NULL
DEFAULT
'{"lang" : "fr", "writingMode" : "direct", "writingSize" : 1, "writingColor" : "#000000", "notifications" : true}'
,
...
...
src/app/user/controllers/UserController.php
View file @
e780b75c
...
...
@@ -46,7 +46,7 @@ class UserController
{
$queryParams
=
$request
->
getQueryParams
();
$select
=
[
'id'
,
'firstname'
,
'lastname'
,
'substitute'
,
'x509_fingerprint'
];
$select
=
[
'id'
,
'firstname'
,
'lastname'
,
'email'
,
'phone'
,
'substitute'
,
'x509_fingerprint'
];
$where
=
[];
$queryData
=
[];
if
(
empty
(
$queryParams
[
'mode'
]))
{
...
...
@@ -55,7 +55,6 @@ class UserController
}
if
(
PrivilegeController
::
hasPrivilege
([
'userId'
=>
$GLOBALS
[
'id'
],
'privilege'
=>
'manage_users'
]))
{
$select
[]
=
'login'
;
$select
[]
=
'email'
;
}
$users
=
UserModel
::
get
([
...
...
@@ -140,7 +139,7 @@ class UserController
if
(
!
empty
(
$existingUser
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Login already exists'
,
'lang'
=>
'userLoginAlreadyExists'
]);
}
$body
[
'x509_fingerprint'
]
=
$body
[
'x509Fingerprint'
];
if
(
!
empty
(
$body
[
'isRest'
]))
{
...
...
@@ -214,6 +213,7 @@ class UserController
'firstname'
=>
$body
[
'firstname'
],
'lastname'
=>
$body
[
'lastname'
],
'email'
=>
$body
[
'email'
],
'phone'
=>
$body
[
'phone'
],
'signature_modes'
=>
[]
];
...
...
@@ -366,14 +366,14 @@ class UserController
'where'
=>
[
'main_document_id in (?)'
,
"process_date IS NULL"
,
"status IS NULL"
],
'data'
=>
[
$mainDocumentId
]
]);
$workflowsId
=
array_column
(
$workflows
,
'id'
);
WorkflowModel
::
update
([
'set'
=>
[
'status'
=>
'STOP'
,
'process_date'
=>
'CURRENT_TIMESTAMP'
],
'where'
=>
[
'id in (?)'
,
"process_date IS NULL AND status IS NULL"
],
'data'
=>
[
$workflowsId
]
]);
$previousDocumentId
=
null
;
foreach
(
$workflows
as
$step
)
{
$document
=
DocumentModel
::
getById
([
'select'
=>
[
'typist'
,
'id'
],
'id'
=>
$step
[
'main_document_id'
]]);
...
...
@@ -748,7 +748,7 @@ class UserController
ValidatorModel
::
notEmpty
(
$args
,
[
'id'
]);
ValidatorModel
::
intVal
(
$args
,
[
'id'
]);
$user
=
UserModel
::
getById
([
'select'
=>
[
'id'
,
'login'
,
'email'
,
'firstname'
,
'lastname'
,
'picture'
,
'preferences'
,
'substitute'
,
'"isRest"'
,
'signature_modes'
,
'x509_fingerprint'
],
'id'
=>
$args
[
'id'
]]);
$user
=
UserModel
::
getById
([
'select'
=>
[
'id'
,
'login'
,
'email'
,
'firstname'
,
'lastname'
,
'phone'
,
'picture'
,
'preferences'
,
'substitute'
,
'"isRest"'
,
'signature_modes'
,
'x509_fingerprint'
],
'id'
=>
$args
[
'id'
]]);
if
(
empty
(
$user
))
{
return
[];
}
...
...
src/app/user/models/UserModel.php
View file @
e780b75c
...
...
@@ -80,7 +80,7 @@ class UserModel
public
static
function
create
(
array
$args
)
{
ValidatorModel
::
notEmpty
(
$args
,
[
'login'
,
'email'
,
'firstname'
,
'lastname'
,
'picture'
]);
ValidatorModel
::
stringType
(
$args
,
[
'login'
,
'email'
,
'firstname'
,
'lastname'
,
'picture'
,
'mode'
,
'signatureModes'
,
'x509_fingerprint'
]);
ValidatorModel
::
stringType
(
$args
,
[
'login'
,
'email'
,
'firstname'
,
'lastname'
,
'phone'
,
'picture'
,
'mode'
,
'signatureModes'
,
'x509_fingerprint'
]);
if
(
empty
(
$args
[
'password'
]))
{
$args
[
'password'
]
=
AuthenticationModel
::
generatePassword
();
...
...
@@ -96,6 +96,7 @@ class UserModel
'password'
=>
$args
[
'password'
],
'firstname'
=>
$args
[
'firstname'
],
'lastname'
=>
$args
[
'lastname'
],
'phone'
=>
$args
[
'phone'
],
'"isRest"'
=>
empty
(
$args
[
'isRest'
])
?
'false'
:
'true'
,
'picture'
=>
$args
[
'picture'
],
'password_modification_date'
=>
'CURRENT_TIMESTAMP'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment