diff options
author | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-12-22 21:02:26 +0300 |
---|---|---|
committer | Marcin Łojewski <marcin.lojewski@mlojewski.me> | 2018-12-22 21:02:26 +0300 |
commit | 06c650be2cf8ab1fa4fb6710ad4564b30c4d3d37 (patch) | |
tree | c341297a07f9c56e3d07971f49afb62344536c89 | |
parent | 49f581504846d70a3cfedb973a23f7935519cfed (diff) | |
parent | 1c1cd89bb2d0b62bcb2cfd84a6741ec57a1bfdee (diff) |
Merge branch 'hotfix/issue#83'v4.2.1
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | appinfo/info.xml | 2 | ||||
-rw-r--r-- | lib/Query/QueryProvider.php | 92 |
3 files changed, 52 insertions, 47 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f07ac7..6937e05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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/) 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 ### Added - Support for Nextcloud 15 @@ -108,6 +112,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - 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.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 diff --git a/appinfo/info.xml b/appinfo/info.xml index 83ded89..6652457 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -8,7 +8,7 @@ Retrieve the users and groups info. Allow the users to change their passwords. Sync the users' email addresses with the addresses stored by Nextcloud. </description> - <version>4.2.0</version> + <version>4.2.1</version> <licence>agpl</licence> <author>Marcin Łojewski</author> <author>Andreas Böhler</author> diff --git a/lib/Query/QueryProvider.php b/lib/Query/QueryProvider.php index cd027d0..0a1bf76 100644 --- a/lib/Query/QueryProvider.php +++ b/lib/Query/QueryProvider.php @@ -87,80 +87,80 @@ class QueryProvider implements \ArrayAccess $uidParam = Query::UID_PARAM; $groupColumns - = "$gGID AS gid, " . - (empty($gName) ? $gGID : $gName) . " AS name, " . - (empty($gAdmin) ? "false" : $gAdmin) . " AS admin"; + = "g.$gGID AS gid, " . + (empty($gName) ? "g." . $gGID : "g." . $gName) . " AS name, " . + (empty($gAdmin) ? "false" : "g." . $gAdmin) . " AS admin"; $userColumns - = "$uUID AS uid, " . - (empty($uName) ? $uUID : $uName) . " AS name, " . - (empty($uEmail) ? "null" : $uEmail) . " AS email, " . - (empty($uQuota) ? "null" : $uQuota) . " AS quota, " . - (empty($uHome) ? "null" : $uHome) . " AS home, " . - (empty($uActive) ? "true" : $uActive) . " AS active, " . - (empty($uAvatar) ? "false" : $uAvatar) . " AS avatar, " . - (empty($uSalt) ? "null" : $uSalt) . " AS salt"; + = "u.$uUID AS uid, " . + (empty($uName) ? "u." . $uUID : "u." . $uName) . " AS name, " . + (empty($uEmail) ? "null" : "u." . $uEmail) . " AS email, " . + (empty($uQuota) ? "null" : "u." . $uQuota) . " AS quota, " . + (empty($uHome) ? "null" : "u." . $uHome) . " AS home, " . + (empty($uActive) ? "true" : "u." . $uActive) . " AS active, " . + (empty($uAvatar) ? "false" : "u." . $uAvatar) . " AS avatar, " . + (empty($uSalt) ? "null" : "u." . $uSalt) . " AS salt"; $this->queries = [ Query::BELONGS_TO_ADMIN => - "SELECT COUNT($gGID) > 0 AS admin " . - "FROM $group, $userGroup " . - "WHERE $ugGID = $gGID " . - "AND $ugUID = :$uidParam " . - "AND $gAdmin", + "SELECT COUNT(g.$gGID) > 0 AS admin " . + "FROM $group g, $userGroup ug " . + "WHERE ug.$ugGID = g.$gGID " . + "AND ug.$ugUID = :$uidParam " . + "AND g.$gAdmin", Query::COUNT_GROUPS => - "SELECT COUNT($ugGID) " . - "FROM $userGroup " . - "WHERE $ugGID = :$gidParam " . - "AND $ugUID " . + "SELECT COUNT(ug.$ugGID) " . + "FROM $userGroup ug " . + "WHERE ug.$ugGID = :$gidParam " . + "AND ug.$ugUID " . "LIKE :$searchParam", Query::COUNT_USERS => - "SELECT COUNT($uUID) AS count " . - "FROM $user " . - "WHERE $uUID LIKE :$searchParam", + "SELECT COUNT(u.$uUID) AS count " . + "FROM $user u " . + "WHERE u.$uUID LIKE :$searchParam", Query::FIND_GROUP => "SELECT $groupColumns " . - "FROM $group " . - "WHERE $gGID = :$gidParam", + "FROM $group g " . + "WHERE g.$gGID = :$gidParam", Query::FIND_GROUP_USERS => - "SELECT $ugUID AS uid " . - "FROM $userGroup " . - "WHERE $ugGID = :$gidParam " . - "AND $ugUID " . + "SELECT ug.$ugUID AS uid " . + "FROM $userGroup ug " . + "WHERE ug.$ugGID = :$gidParam " . + "AND ug.$ugUID " . "LIKE :$searchParam " . - "ORDER BY $ugUID", + "ORDER BY ug.$ugUID", Query::FIND_GROUPS => "SELECT $groupColumns " . - "FROM $group " . - "WHERE $gGID LIKE :$searchParam " . - "ORDER BY $gGID", + "FROM $group g " . + "WHERE g.$gGID LIKE :$searchParam " . + "ORDER BY g.$gGID", Query::FIND_USER => - "SELECT $userColumns, $uPassword AS password " . - "FROM $user " . - "WHERE $uUID = :$uidParam", + "SELECT $userColumns, u.$uPassword AS password " . + "FROM $user u " . + "WHERE u.$uUID = :$uidParam", Query::FIND_USER_CASE_INSENSITIVE => - "SELECT $userColumns, $uPassword AS password " . - "FROM $user " . - "WHERE lower($uUID) = lower(:$uidParam)", + "SELECT $userColumns, u.$uPassword AS password " . + "FROM $user u " . + "WHERE lower(u.$uUID) = lower(:$uidParam)", Query::FIND_USER_GROUPS => "SELECT $groupColumns " . - "FROM $group, $userGroup " . - "WHERE $ugGID = $gGID " . - "AND $ugUID = :$uidParam " . - "ORDER BY $gGID", + "FROM $group g, $userGroup ug " . + "WHERE ug.$ugGID = g.$gGID " . + "AND ug.$ugUID = :$uidParam " . + "ORDER BY g.$gGID", Query::FIND_USERS => "SELECT $userColumns " . - "FROM $user " . - "WHERE $uUID LIKE :$searchParam " . - "ORDER BY $uUID", + "FROM $user u " . + "WHERE u.$uUID LIKE :$searchParam " . + "ORDER BY u.$uUID", Query::UPDATE_DISPLAY_NAME => "UPDATE $user " . |