summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2020-04-15 19:34:23 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-04-16 09:54:49 +0000
commit249d3a828ca8423b2ade8187702f3b21945bd7f4 (patch)
tree55b2c4d671423c30ee8dcf8c9fcbc52e3c5820e3 /lib
parenta5449969104c33964ca8d55995dbe0bafa4dc763 (diff)
downloadnextcloud-server-249d3a828ca8423b2ade8187702f3b21945bd7f4.tar.gz
nextcloud-server-249d3a828ca8423b2ade8187702f3b21945bd7f4.zip
fix credentialsManager documentation and ensure userId to be used as string
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Security/CredentialsManager.php12
-rw-r--r--lib/public/Security/ICredentialsManager.php6
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Security/CredentialsManager.php b/lib/private/Security/CredentialsManager.php
index 0120f69e431..fca968ab782 100644
--- a/lib/private/Security/CredentialsManager.php
+++ b/lib/private/Security/CredentialsManager.php
@@ -54,7 +54,7 @@ class CredentialsManager implements ICredentialsManager {
/**
* Store a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @param mixed $credentials
*/
@@ -62,7 +62,7 @@ class CredentialsManager implements ICredentialsManager {
$value = $this->crypto->encrypt(json_encode($credentials));
$this->dbConnection->setValues(self::DB_TABLE, [
- 'user' => $userId,
+ 'user' => (string)$userId,
'identifier' => $identifier,
], [
'credentials' => $value,
@@ -72,7 +72,7 @@ class CredentialsManager implements ICredentialsManager {
/**
* Retrieve a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return mixed
*/
@@ -80,7 +80,7 @@ class CredentialsManager implements ICredentialsManager {
$qb = $this->dbConnection->getQueryBuilder();
$qb->select('credentials')
->from(self::DB_TABLE)
- ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId)))
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)))
->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier)))
;
$result = $qb->execute()->fetch();
@@ -96,14 +96,14 @@ class CredentialsManager implements ICredentialsManager {
/**
* Delete a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return int rows removed
*/
public function delete($userId, $identifier) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->delete(self::DB_TABLE)
- ->where($qb->expr()->eq('user', $qb->createNamedParameter($userId)))
+ ->where($qb->expr()->eq('user', $qb->createNamedParameter((string)$userId)))
->andWhere($qb->expr()->eq('identifier', $qb->createNamedParameter($identifier)))
;
return $qb->execute();
diff --git a/lib/public/Security/ICredentialsManager.php b/lib/public/Security/ICredentialsManager.php
index 50e565e251d..ecfc8383958 100644
--- a/lib/public/Security/ICredentialsManager.php
+++ b/lib/public/Security/ICredentialsManager.php
@@ -33,7 +33,7 @@ interface ICredentialsManager {
/**
* Store a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @param mixed $credentials
* @since 8.2.0
@@ -43,7 +43,7 @@ interface ICredentialsManager {
/**
* Retrieve a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return mixed
* @since 8.2.0
@@ -53,7 +53,7 @@ interface ICredentialsManager {
/**
* Delete a set of credentials
*
- * @param string|null $userId Null for system-wide credentials
+ * @param string $userId empty string for system-wide credentials
* @param string $identifier
* @return int rows removed
* @since 8.2.0