Merge branch 'hotfix/issue#83'

This commit is contained in:
Marcin Łojewski
2018-12-22 19:02:26 +01:00
3 changed files with 52 additions and 47 deletions

View File

@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [4.2.1] - 2018-12-22
### Fixed
- SQL error when same column names given in several tables
## [4.2.0] - 2018-12-16 ## [4.2.0] - 2018-12-16
### Added ### Added
- Support for Nextcloud 15 - Support for Nextcloud 15
@@ -108,6 +112,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed ### Changed
- Supported version of ownCloud, Nextcloud: ownCloud 10, Nextcloud 12 - Supported version of ownCloud, Nextcloud: ownCloud 10, Nextcloud 12
[4.2.1]: https://github.com/nextcloud/user_sql/compare/v4.2.0...v4.2.1
[4.2.0]: https://github.com/nextcloud/user_sql/compare/v4.1.0...v4.2.0 [4.2.0]: https://github.com/nextcloud/user_sql/compare/v4.1.0...v4.2.0
[4.1.0]: https://github.com/nextcloud/user_sql/compare/v4.0.1...v4.1.0 [4.1.0]: https://github.com/nextcloud/user_sql/compare/v4.0.1...v4.1.0
[4.0.1]: https://github.com/nextcloud/user_sql/compare/v4.0.0...v4.0.1 [4.0.1]: https://github.com/nextcloud/user_sql/compare/v4.0.0...v4.0.1

View File

@@ -8,7 +8,7 @@
Retrieve the users and groups info. Allow the users to change their passwords. Retrieve the users and groups info. Allow the users to change their passwords.
Sync the users' email addresses with the addresses stored by Nextcloud. Sync the users' email addresses with the addresses stored by Nextcloud.
</description> </description>
<version>4.2.0</version> <version>4.2.1</version>
<licence>agpl</licence> <licence>agpl</licence>
<author>Marcin Łojewski</author> <author>Marcin Łojewski</author>
<author>Andreas Böhler</author> <author>Andreas Böhler</author>

View File

@@ -87,80 +87,80 @@ class QueryProvider implements \ArrayAccess
$uidParam = Query::UID_PARAM; $uidParam = Query::UID_PARAM;
$groupColumns $groupColumns
= "$gGID AS gid, " . = "g.$gGID AS gid, " .
(empty($gName) ? $gGID : $gName) . " AS name, " . (empty($gName) ? "g." . $gGID : "g." . $gName) . " AS name, " .
(empty($gAdmin) ? "false" : $gAdmin) . " AS admin"; (empty($gAdmin) ? "false" : "g." . $gAdmin) . " AS admin";
$userColumns $userColumns
= "$uUID AS uid, " . = "u.$uUID AS uid, " .
(empty($uName) ? $uUID : $uName) . " AS name, " . (empty($uName) ? "u." . $uUID : "u." . $uName) . " AS name, " .
(empty($uEmail) ? "null" : $uEmail) . " AS email, " . (empty($uEmail) ? "null" : "u." . $uEmail) . " AS email, " .
(empty($uQuota) ? "null" : $uQuota) . " AS quota, " . (empty($uQuota) ? "null" : "u." . $uQuota) . " AS quota, " .
(empty($uHome) ? "null" : $uHome) . " AS home, " . (empty($uHome) ? "null" : "u." . $uHome) . " AS home, " .
(empty($uActive) ? "true" : $uActive) . " AS active, " . (empty($uActive) ? "true" : "u." . $uActive) . " AS active, " .
(empty($uAvatar) ? "false" : $uAvatar) . " AS avatar, " . (empty($uAvatar) ? "false" : "u." . $uAvatar) . " AS avatar, " .
(empty($uSalt) ? "null" : $uSalt) . " AS salt"; (empty($uSalt) ? "null" : "u." . $uSalt) . " AS salt";
$this->queries = [ $this->queries = [
Query::BELONGS_TO_ADMIN => Query::BELONGS_TO_ADMIN =>
"SELECT COUNT($gGID) > 0 AS admin " . "SELECT COUNT(g.$gGID) > 0 AS admin " .
"FROM $group, $userGroup " . "FROM $group g, $userGroup ug " .
"WHERE $ugGID = $gGID " . "WHERE ug.$ugGID = g.$gGID " .
"AND $ugUID = :$uidParam " . "AND ug.$ugUID = :$uidParam " .
"AND $gAdmin", "AND g.$gAdmin",
Query::COUNT_GROUPS => Query::COUNT_GROUPS =>
"SELECT COUNT($ugGID) " . "SELECT COUNT(ug.$ugGID) " .
"FROM $userGroup " . "FROM $userGroup ug " .
"WHERE $ugGID = :$gidParam " . "WHERE ug.$ugGID = :$gidParam " .
"AND $ugUID " . "AND ug.$ugUID " .
"LIKE :$searchParam", "LIKE :$searchParam",
Query::COUNT_USERS => Query::COUNT_USERS =>
"SELECT COUNT($uUID) AS count " . "SELECT COUNT(u.$uUID) AS count " .
"FROM $user " . "FROM $user u " .
"WHERE $uUID LIKE :$searchParam", "WHERE u.$uUID LIKE :$searchParam",
Query::FIND_GROUP => Query::FIND_GROUP =>
"SELECT $groupColumns " . "SELECT $groupColumns " .
"FROM $group " . "FROM $group g " .
"WHERE $gGID = :$gidParam", "WHERE g.$gGID = :$gidParam",
Query::FIND_GROUP_USERS => Query::FIND_GROUP_USERS =>
"SELECT $ugUID AS uid " . "SELECT ug.$ugUID AS uid " .
"FROM $userGroup " . "FROM $userGroup ug " .
"WHERE $ugGID = :$gidParam " . "WHERE ug.$ugGID = :$gidParam " .
"AND $ugUID " . "AND ug.$ugUID " .
"LIKE :$searchParam " . "LIKE :$searchParam " .
"ORDER BY $ugUID", "ORDER BY ug.$ugUID",
Query::FIND_GROUPS => Query::FIND_GROUPS =>
"SELECT $groupColumns " . "SELECT $groupColumns " .
"FROM $group " . "FROM $group g " .
"WHERE $gGID LIKE :$searchParam " . "WHERE g.$gGID LIKE :$searchParam " .
"ORDER BY $gGID", "ORDER BY g.$gGID",
Query::FIND_USER => Query::FIND_USER =>
"SELECT $userColumns, $uPassword AS password " . "SELECT $userColumns, u.$uPassword AS password " .
"FROM $user " . "FROM $user u " .
"WHERE $uUID = :$uidParam", "WHERE u.$uUID = :$uidParam",
Query::FIND_USER_CASE_INSENSITIVE => Query::FIND_USER_CASE_INSENSITIVE =>
"SELECT $userColumns, $uPassword AS password " . "SELECT $userColumns, u.$uPassword AS password " .
"FROM $user " . "FROM $user u " .
"WHERE lower($uUID) = lower(:$uidParam)", "WHERE lower(u.$uUID) = lower(:$uidParam)",
Query::FIND_USER_GROUPS => Query::FIND_USER_GROUPS =>
"SELECT $groupColumns " . "SELECT $groupColumns " .
"FROM $group, $userGroup " . "FROM $group g, $userGroup ug " .
"WHERE $ugGID = $gGID " . "WHERE ug.$ugGID = g.$gGID " .
"AND $ugUID = :$uidParam " . "AND ug.$ugUID = :$uidParam " .
"ORDER BY $gGID", "ORDER BY g.$gGID",
Query::FIND_USERS => Query::FIND_USERS =>
"SELECT $userColumns " . "SELECT $userColumns " .
"FROM $user " . "FROM $user u " .
"WHERE $uUID LIKE :$searchParam " . "WHERE u.$uUID LIKE :$searchParam " .
"ORDER BY $uUID", "ORDER BY u.$uUID",
Query::UPDATE_DISPLAY_NAME => Query::UPDATE_DISPLAY_NAME =>
"UPDATE $user " . "UPDATE $user " .