summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-06-05 16:52:00 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-06-05 16:52:00 +0200
commit4b650a20a42b70412cee9dd835e096e16da6d530 (patch)
treed9e774571b0b870fcf4488b72b384ea9b63a0f1e /lib/private
parent9e84a0a1af1d49b37c0539dc417440f29fc45611 (diff)
parentd493c0c9aca4f1286084798f293b3097b16e9d0e (diff)
downloadnextcloud-server-4b650a20a42b70412cee9dd835e096e16da6d530.tar.gz
nextcloud-server-4b650a20a42b70412cee9dd835e096e16da6d530.zip
Merge pull request #8893 from owncloud/feature/get-users-by-preference
Add method to get users by their preference
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/preferences.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/private/preferences.php b/lib/private/preferences.php
index a4bfc650d08..0dc5b26810a 100644
--- a/lib/private/preferences.php
+++ b/lib/private/preferences.php
@@ -243,6 +243,36 @@ class Preferences {
}
/**
+ * Gets the users for a preference
+ * @param string $app
+ * @param string $key
+ * @param string $value
+ * @return array
+ */
+ public function getUsersForValue($app, $key, $value) {
+ $users = array();
+
+ $query = 'SELECT `userid` '
+ . ' FROM `*PREFIX*preferences` '
+ . ' WHERE `appid` = ? AND `configkey` = ? AND ';
+
+ if (\OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') {
+ //FIXME oracle hack: need to explicitly cast CLOB to CHAR for comparison
+ $query .= ' to_char(`configvalue`)= ?';
+ } else {
+ $query .= ' `configvalue` = ?';
+ }
+
+ $result = $this->conn->executeQuery($query, array($app, $key, $value));
+
+ while ($row = $result->fetch()) {
+ $users[] = $row['userid'];
+ }
+
+ return $users;
+ }
+
+ /**
* Deletes a key
* @param string $user user
* @param string $app app