3 if [ "$act" = "sel" -o "$act" = "qsel" -o "$act" = "selcode" -o "$act" = "sma" -o "$act" = "selblo" -o "$act" = "selapp" ]; then
5 usr="$(echo "$1" | sed "s/'/''/g")"
6 # echo "select * FROM bsk_users WHERE login = '$usr'"
7 echo "SELECT gua.login AS guar_login, gua.email AS guar_email , usr.code, usr.login, usr.pass, usr.email, to_hex(usr.type) as type, usr.lintm, usr.mtime, usr.last_dona, usr.supp_comp, usr.tos_vers, usr.disa_reas, usr.guar_code FROM bsk_users AS usr JOIN bsk_users AS gua ON usr.guar_code = gua.code WHERE " | tr -d '\n'
8 if [ "$act" = "sel" ]; then
9 echo " usr.login = '$usr';"
10 elif [ "$act" = "qsel" ]; then
11 echo " usr.login LIKE '%${usr}%';"
12 elif [ "$act" = "selcode" ]; then
13 echo " usr.code = $usr;"
14 elif [ "$act" = "sma" ]; then
15 echo " usr.email = '$usr';"
16 elif [ "$act" = "selblo" ]; then
17 echo " char_length(usr.pass) != 32 ORDER BY usr.pass;"
18 elif [ "$act" = "selapp" ]; then
20 echo " usr.pass != 'THE_PASS' AND (usr.type & CAST(X'80000' as integer)) = CAST(X'80000' as integer);"
22 echo " usr.login = 'mop';"
24 elif [ "$act" = "who_guar" ]; then
26 usr="$(echo "$1" | sed "s/'/''/g")"
27 echo "select * from bsk_users where guar_code = (select code from bsk_users where login = '$usr');"
28 elif [ "$act" = "guar" ]; then
30 usr="$(echo "$1" | sed "s/'/''/g")"
31 guar="$(echo "$2" | sed "s/'/''/g")"
32 echo "UPDATE bsk_users SET (type, guar_code) = ( (type & ~(CAST (X'90000' as integer))) | (CAST (X'10000' as integer)), (SELECT code FROM bsk_users WHERE login = '${guar}')) WHERE login = '${usr}';"
34 # echo "UPDATE bsk_users SET (type, guar_code) = ( (type & ~(CAST (X'90000' as integer))) | (CAST (X'80000' as integer)), 3) WHERE login = '${usr}';"
35 elif [ "$act" = "dis" ]; then
37 usr="$(echo "$1" | sed "s/'/''/g")"
40 echo "UPDATE bsk_users SET (type, disa_reas) = ( (type & ~(CAST (X'800000' as integer))) | (CAST (X'00800000' as integer)), $reas ) WHERE login = '$usr'; "
41 elif [ "$act" = "ena" ]; then
43 usr="$(echo "$1" | sed "s/'/''/g")"
44 echo "UPDATE bsk_users SET (type, disa_reas) = ( (type & ~(CAST (X'800000' as integer))) & ~(CAST (X'00800000' as integer)), 0 ) WHERE login = '$usr'; "
45 elif [ "$act" = "cert" ]; then
47 usr="$(echo "$1" | sed "s/'/''/g")"
48 echo "UPDATE bsk_users SET (type) = ( type | (CAST (X'00040000' as integer)) ) WHERE login = '$usr'; "
49 elif [ "$act" = "uncert" ]; then
51 usr="$(echo "$1" | sed "s/'/''/g")"
52 echo "UPDATE bsk_users SET (type) = ( type & ~(CAST (X'00040000' as integer)) ) WHERE login = '$usr'; "
53 elif [ "$act" = "super" ]; then
55 usr="$(echo "$1" | sed "s/'/''/g")"
56 echo "UPDATE bsk_users SET (type) = ( (type & ~(CAST (X'00010000' as integer))) | (CAST (X'00020000' as integer)) ) WHERE login = '$usr'; "
57 elif [ "$act" = "desuper" ]; then
59 usr="$(echo "$1" | sed "s/'/''/g")"
60 echo "UPDATE bsk_users SET (type) = ( (type & ~(CAST (X'00020000' as integer))) | (CAST (X'00010000' as integer)) ) WHERE login = '$usr'; "
61 elif [ "$act" = "pass" ]; then
63 usr="$(echo "$1" | sed "s/'/''/g")"
65 echo "UPDATE bsk_users SET (pass) = ( '$pass' ) WHERE login = '$usr';"
66 elif [ "$act" = "email" ]; then
68 usr="$(echo "$1" | sed "s/'/''/g")"
70 echo "UPDATE bsk_users SET (email) = ( '$email' ) WHERE login = '$usr';"
71 elif [ "$act" = "depass" ]; then
73 usr="$(echo "$1" | sed "s/'/''/g")"
75 echo "UPDATE bsk_users SET (pass) = ( '$pfx' || pass ) WHERE login = '$usr';"
76 elif [ "$act" = "repass" ]; then
78 usr="$(echo "$1" | sed "s/'/''/g")"
79 echo "UPDATE bsk_users SET (pass) = ( substring( pass, (char_length(pass) - 31), 32 ) ) WHERE login = '$usr';"
80 elif [ "$act" = "unet" ]; then
81 echo "select ow.login, tg.login, un.* from bsk_usersnet as un, bsk_users as ow, bsk_users as tg WHERE ow.code = un.owner AND tg.code = un.target order by un.owner;"
83 # egrep "^define\('USER_(FLAG_TY|DIS_REA)" ~/webspace/brisk/Obj/user.phh
84 egrep "^define\('USER_DIS_REA" ~/webspace/brisk/Obj/user.phh
86 echo "$0 qsel <user> (with like)"
87 echo "$0 sma <user> select by email"
88 echo "$0 selcode <user> select by code"
89 echo "$0 selblo <user> select users with password len not standard"
90 echo "$0 selapp return all apprentices"
91 echo "$0 who_guar <user> - list of users guaranted by <user>"
92 echo "$0 guar <user> <guar> - move apprentice to guaranted status"
94 echo "$0 uncert <user>"
95 echo "$0 dis <user> <reas_id>"
97 echo "$0 super <user>"
98 echo "$0 pass <user> <newpass>"
99 echo "$0 email <user> <newemail>"
100 echo "$0 depass <user> <prefix>"
101 echo "$0 repass <user>"