@@ -64,18 +64,19 @@ private function loadQueries()
6464
6565 $ gAdmin = $ this ->properties [DB ::GROUP_ADMIN_COLUMN ];
6666 $ gGID = $ this ->properties [DB ::GROUP_GID_COLUMN ];
67- $ gName = $ this ->properties [DB ::GROUP_NAME_COLUMN ];
67+ $ gName = $ this ->properties [DB ::GROUP_NAME_COLUMN ] || $ this -> properties [ DB :: GROUP_GID_COLUMN ] ;
6868
6969 $ uActive = $ this ->properties [DB ::USER_ACTIVE_COLUMN ];
7070 $ uAvatar = $ this ->properties [DB ::USER_AVATAR_COLUMN ];
7171 $ uDisabled = $ this ->properties [DB ::USER_DISABLED_COLUMN ];
7272 $ uEmail = $ this ->properties [DB ::USER_EMAIL_COLUMN ];
7373 $ uHome = $ this ->properties [DB ::USER_HOME_COLUMN ];
74- $ uName = $ this ->properties [DB ::USER_NAME_COLUMN ];
74+ $ uName = $ this ->properties [DB ::USER_NAME_COLUMN ] || $ this -> properties [ DB :: USER_USERNAME_COLUMN ] || $ this -> properties [ DB :: USER_UID_COLUMN ] ;
7575 $ uPassword = $ this ->properties [DB ::USER_PASSWORD_COLUMN ];
7676 $ uQuota = $ this ->properties [DB ::USER_QUOTA_COLUMN ];
7777 $ uSalt = $ this ->properties [DB ::USER_SALT_COLUMN ];
7878 $ uUID = $ this ->properties [DB ::USER_UID_COLUMN ];
79+ $ uUsername = $ this ->properties [DB ::USER_USERNAME_COLUMN ] || $ this ->properties [DB ::USER_UID_COLUMN ];
7980
8081 $ ugGID = $ this ->properties [DB ::USER_GROUP_GID_COLUMN ];
8182 $ ugUID = $ this ->properties [DB ::USER_GROUP_UID_COLUMN ];
@@ -87,16 +88,18 @@ private function loadQueries()
8788 $ quotaParam = Query::QUOTA_PARAM ;
8889 $ searchParam = Query::SEARCH_PARAM ;
8990 $ uidParam = Query::UID_PARAM ;
91+ $ usernameParam = Query::USERNAME_PARAM ;
9092
9193 $ reverseActiveOpt = $ this ->properties [Opt::REVERSE_ACTIVE ];
9294
9395 $ groupColumns
9496 = "g. $ gGID AS gid, " .
95- ( empty ( $ gName ) ? "g. " . $ gGID : " g. " . $ gName) . " AS name, " .
97+ "g. $ gName AS name, " .
9698 (empty ($ gAdmin ) ? "false " : "g. " . $ gAdmin ) . " AS admin " ;
9799 $ userColumns
98100 = "u. $ uUID AS uid, " .
99- (empty ($ uName ) ? "u. " . $ uUID : "u. " . $ uName ) . " AS name, " .
101+ "u. $ uUsername AS username, " .
102+ "u. $ uName AS name, " .
100103 (empty ($ uEmail ) ? "null " : "u. " . $ uEmail ) . " AS email, " .
101104 (empty ($ uQuota ) ? "null " : "u. " . $ uQuota ) . " AS quota, " .
102105 (empty ($ uHome ) ? "null " : "u. " . $ uHome ) . " AS home, " .
@@ -134,8 +137,7 @@ private function loadQueries()
134137 "SELECT ug. $ ugUID AS uid " .
135138 "FROM $ userGroup ug " .
136139 "WHERE ug. $ ugGID = : $ gidParam " .
137- "AND ug. $ ugUID " .
138- "LIKE : $ searchParam " .
140+ "AND ug. $ ugUID LIKE : $ searchParam " .
139141 "ORDER BY ug. $ ugUID " ,
140142
141143 Query::FIND_GROUPS =>
@@ -145,28 +147,34 @@ private function loadQueries()
145147 (empty ($ gName ) ? "" : "OR g. $ gName LIKE : $ searchParam " ) .
146148 "ORDER BY g. $ gGID " ,
147149
148- Query::FIND_USER =>
149- "SELECT $ userColumns, u. $ uPassword AS password " .
150+ Query::FIND_USER_BY_UID =>
151+ "SELECT $ userColumns " .
150152 "FROM $ user u " .
151153 "WHERE u. $ uUID = : $ uidParam " .
152154 (empty ($ uDisabled ) ? "" : "AND NOT u. $ uDisabled " ),
153155
154- Query::FIND_USER_BY_UID_OR_EMAIL =>
156+ Query::FIND_USER_BY_USERNAME =>
157+ "SELECT $ userColumns, u. $ uPassword AS password " .
158+ "FROM $ user u " .
159+ "WHERE u. $ uUsername = : $ usernameParam " .
160+ (empty ($ uDisabled ) ? "" : "AND NOT u. $ uDisabled " ),
161+
162+ Query::FIND_USER_BY_USERNAME_CASE_INSENSITIVE =>
155163 "SELECT $ userColumns, u. $ uPassword AS password " .
156164 "FROM $ user u " .
157- "WHERE u. $ uUID = : $ uidParam OR u. $ uEmail = : $ emailParam " .
165+ "WHERE lower( u. $ uUsername ) = lower(: $ usernameParam ) " .
158166 (empty ($ uDisabled ) ? "" : "AND NOT u. $ uDisabled " ),
159167
160- Query::FIND_USER_BY_UID_OR_EMAIL_CASE_INSENSITIVE =>
168+ Query::FIND_USER_BY_USERNAME_OR_EMAIL =>
161169 "SELECT $ userColumns, u. $ uPassword AS password " .
162170 "FROM $ user u " .
163- "WHERE lower( u. $ uUID ) = lower(: $ uidParam ) OR lower( u.$ uEmail) = lower( :$ emailParam) " .
171+ "WHERE u. $ uUsername = : $ usernameParam OR u. $ uEmail = : $ emailParam " .
164172 (empty ($ uDisabled ) ? "" : "AND NOT u. $ uDisabled " ),
165173
166- Query::FIND_USER_CASE_INSENSITIVE =>
174+ Query::FIND_USER_BY_USERNAME_OR_EMAIL_CASE_INSENSITIVE =>
167175 "SELECT $ userColumns, u. $ uPassword AS password " .
168176 "FROM $ user u " .
169- "WHERE lower(u. $ uUID ) = lower(: $ uidParam ) " .
177+ "WHERE lower(u. $ uUsername ) = lower(: $ usernameParam ) OR lower(u. $ uEmail ) = lower(: $ emailParam ) " .
170178 (empty ($ uDisabled ) ? "" : "AND NOT u. $ uDisabled " ),
171179
172180 Query::FIND_USER_GROUPS =>
0 commit comments