1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
<?php
/**
* Configuration for mybb. Password checking is done in SQL
*
* mybb stores additional group ids in a commaseparated list of mybb_users.addtionalgroups This
* is currently not supported in the setup below. If someone can come up with a clever config for
* that PRs would be welcome.
*/
/** @noinspection SqlResolve */
$data = array(
'passcrypt' => 'sha1',
'conf' => array(
'select-user' => '
SELECT uid,
username AS user,
username AS name,
email AS mail
FROM mybb_users
WHERE username = :user
',
'check-pass' => '
SELECT uid
FROM mybb_users
WHERE username = :user
AND password = MD5(CONCAT(MD5(salt), MD5(:clear)))
',
'select-user-groups' => '
SELECT UG.title AS `group`,
UG.gid
FROM mybb_usergroups UG,
mybb_users U
WHERE U.usergroup = UG.gid
AND U.uid = :uid
',
'select-groups' => '
SELECT gid, title AS `group`
FROM mybb_usergroups
',
'insert-user' => '
SET @salt = LEFT(UUID(), 10);
INSERT INTO mybb_users
(username, email, salt, password, regdate)
VALUES (:user, :mail, @salt, MD5(CONCAT(MD5(@salt), MD5(:clear))), UNIX_TIMESTAMP() )
',
'delete-user' => '
DELETE FROM mybb_users
WHERE uid = :uid
',
'list-users' => '
SELECT U.username AS user
FROM mybb_usergroups UG,
mybb_users U
WHERE U.usergroup = UG.gid
AND UG.title LIKE :group
AND U.username LIKE :user
AND U.username LIKE :name
AND U.email LIKE :mail
ORDER BY U.username
LIMIT :limit
OFFSET :start
',
'count-users' => '
SELECT COUNT(U.username) AS `count`
FROM mybb_usergroups UG,
mybb_users U
WHERE U.usergroup = UG.gid
AND UG.title LIKE :group
AND U.username LIKE :user
AND U.username LIKE :name
AND U.email LIKE :mail
',
'update-user-info' => '
UPDATE mybb_users
SET email = :mail
WHERE uid = :uid
', // we do not support changing the full name as that is the same as the login
'update-user-login' => '
UPDATE mybb_users
SET username = :newlogin
WHERE uid = :uid
',
'update-user-pass' => '
SET @salt = LEFT(UUID(), 10);
UPDATE mybb_users
SET salt = @salt,
password = MD5(CONCAT(MD5(@salt), MD5(:clear)))
WHERE uid = :uid
',
'insert-group' => '
INSERT INTO mybb_usergroups (title)
VALUES (:group)
',
'join-group' => '
UPDATE mybb_users
SET usergroup = :gid
WHERE uid = :uid
',
'leave-group' => '', // makes probably no sense to implement
),
'users' => array(
array(
'user' => 'Test One',
'pass' => 'fakepass',
'name' => 'Test One',
'mail' => 'no_one@nowhere.com',
'grps' =>
array(
0 => 'Registered',
),
),
array(
'user' => 'Test Two',
'pass' => 'fakepass',
'name' => 'Test Two',
'mail' => 'no_one@nowhere.com',
'grps' =>
array(
0 => 'Super Moderators',
),
),
array(
'user' => 'Test Three',
'pass' => 'fakepass',
'name' => 'Test Three',
'mail' => 'no_one@nowhere.com',
'grps' =>
array(
0 => 'Administrators',
),
),
array(
'user' => 'Test Four',
'pass' => 'fakepass',
'name' => 'Test Four',
'mail' => 'no_one@nowhere.com',
'grps' =>
array(
0 => 'Moderators',
),
),
),
);
|