aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AllConfig.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/AllConfig.php')
-rw-r--r--lib/private/AllConfig.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 58706e290fb..09520aae2a9 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -459,6 +459,38 @@ class AllConfig implements \OCP\IConfig {
return $userIDs;
}
+ /**
+ * Determines the users that have the given value set for a specific app-key-pair
+ *
+ * @param string $appName the app to get the user for
+ * @param string $key the key to get the user for
+ * @param string $value the value to get the user for
+ * @return array of user IDs
+ */
+ public function getUsersForUserValueCaseInsensitive($appName, $key, $value) {
+ // TODO - FIXME
+ $this->fixDIInit();
+
+ $sql = 'SELECT `userid` FROM `*PREFIX*preferences` ' .
+ 'WHERE `appid` = ? AND `configkey` = ? ';
+
+ if($this->getSystemValue('dbtype', 'sqlite') === 'oci') {
+ //oracle hack: need to explicitly cast CLOB to CHAR for comparison
+ $sql .= 'AND LOWER(to_char(`configvalue`)) = LOWER(?)';
+ } else {
+ $sql .= 'AND LOWER(`configvalue`) = LOWER(?)';
+ }
+
+ $result = $this->connection->executeQuery($sql, array($appName, $key, $value));
+
+ $userIDs = array();
+ while ($row = $result->fetch()) {
+ $userIDs[] = $row['userid'];
+ }
+
+ return $userIDs;
+ }
+
public function getSystemConfig() {
return $this->systemConfig;
}