chore: make elvis happy
This commit is contained in:
parent
78449d77d1
commit
1c8defeeda
|
@ -337,7 +337,8 @@ user_seeds() ->
|
||||||
<<"query">> =>
|
<<"query">> =>
|
||||||
<<
|
<<
|
||||||
"SELECT password_hash, salt, is_superuser_int as is_superuser\n"
|
"SELECT password_hash, salt, is_superuser_int as is_superuser\n"
|
||||||
" FROM users where cert_subject = ${cert_subject} AND cert_common_name = ${cert_common_name} LIMIT 1"
|
" FROM users where cert_subject = ${cert_subject} AND \n"
|
||||||
|
" cert_common_name = ${cert_common_name} LIMIT 1"
|
||||||
>>,
|
>>,
|
||||||
<<"password_hash_algorithm">> => #{
|
<<"password_hash_algorithm">> => #{
|
||||||
<<"name">> => <<"sha256">>,
|
<<"name">> => <<"sha256">>,
|
||||||
|
@ -468,10 +469,18 @@ init_seeds() ->
|
||||||
" is_superuser_int TINYINT)"
|
" is_superuser_int TINYINT)"
|
||||||
),
|
),
|
||||||
|
|
||||||
Fields = [username, password_hash, salt, is_superuser_str, is_superuser_int],
|
Fields = [
|
||||||
|
username,
|
||||||
|
password_hash,
|
||||||
|
salt,
|
||||||
|
cert_subject,
|
||||||
|
cert_common_name,
|
||||||
|
is_superuser_str,
|
||||||
|
is_superuser_int
|
||||||
|
],
|
||||||
InsertQuery =
|
InsertQuery =
|
||||||
"INSERT INTO users(username, password_hash, salt, "
|
"INSERT INTO users(username, password_hash, salt, cert_subject, cert_common_name,"
|
||||||
" is_superuser_str, is_superuser_int) VALUES(?, ?, ?, ?, ?)",
|
" is_superuser_str, is_superuser_int) VALUES(?, ?, ?, ?, ?, ?, ?)",
|
||||||
|
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(#{data := Values}) ->
|
fun(#{data := Values}) ->
|
||||||
|
|
|
@ -399,7 +399,8 @@ user_seeds() ->
|
||||||
<<"query">> =>
|
<<"query">> =>
|
||||||
<<
|
<<
|
||||||
"SELECT password_hash, salt, is_superuser_int as is_superuser\n"
|
"SELECT password_hash, salt, is_superuser_int as is_superuser\n"
|
||||||
" FROM users where cert_subject = ${cert_subject} AND cert_common_name = ${cert_common_name} LIMIT 1"
|
" FROM users where cert_subject = ${cert_subject} AND \n"
|
||||||
|
" cert_common_name = ${cert_common_name} LIMIT 1"
|
||||||
>>,
|
>>,
|
||||||
<<"password_hash_algorithm">> => #{
|
<<"password_hash_algorithm">> => #{
|
||||||
<<"name">> => <<"sha256">>,
|
<<"name">> => <<"sha256">>,
|
||||||
|
@ -518,12 +519,21 @@ init_seeds() ->
|
||||||
).
|
).
|
||||||
|
|
||||||
create_user(Values) ->
|
create_user(Values) ->
|
||||||
Fields = [username, password_hash, salt, is_superuser_str, is_superuser_int, is_superuser_bool],
|
Fields = [
|
||||||
|
username,
|
||||||
|
password_hash,
|
||||||
|
salt,
|
||||||
|
cert_subject,
|
||||||
|
cert_common_name,
|
||||||
|
is_superuser_str,
|
||||||
|
is_superuser_int,
|
||||||
|
is_superuser_bool
|
||||||
|
],
|
||||||
|
|
||||||
InsertQuery =
|
InsertQuery =
|
||||||
"INSERT INTO users(username, password_hash, salt,"
|
"INSERT INTO users(username, password_hash, salt, cert_subject, cert_common_name, "
|
||||||
"is_superuser_str, is_superuser_int, is_superuser_bool) "
|
"is_superuser_str, is_superuser_int, is_superuser_bool) "
|
||||||
"VALUES($1, $2, $3, $4, $5, $6)",
|
"VALUES($1, $2, $3, $4, $5, $6, $7, $8)",
|
||||||
|
|
||||||
Params = [maps:get(F, Values, null) || F <- Fields],
|
Params = [maps:get(F, Values, null) || F <- Fields],
|
||||||
{ok, 1} = q(InsertQuery, Params),
|
{ok, 1} = q(InsertQuery, Params),
|
||||||
|
|
Loading…
Reference in New Issue