aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-01-02 17:10:31 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-04-27 12:00:45 +0200
commitb6c17c6ce76080df0e291f60a85c0e42afab8f39 (patch)
tree3b26ccfc21ffe384a0c972d37a1ae2f12c7e7da5 /apps
parent6385a5af36957cac4e1beed531d941129eb3a5a0 (diff)
downloadnextcloud-server-b6c17c6ce76080df0e291f60a85c0e42afab8f39.tar.gz
nextcloud-server-b6c17c6ce76080df0e291f60a85c0e42afab8f39.zip
Clear up return types
usersInGroup index by int for BC, searchInGroup index by uid (string). Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/Access.php5
-rw-r--r--apps/user_ldap/lib/Group_LDAP.php11
-rw-r--r--apps/user_ldap/lib/Group_Proxy.php2
3 files changed, 12 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 9a97a28c376..3f120caefe6 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -631,7 +631,7 @@ class Access extends LDAPUtility {
* gives back the user names as they are used ownClod internally
*
* @param array $ldapUsers as returned by fetchList()
- * @return array an array with the user names to use in Nextcloud
+ * @return array<int,string> an array with the user names to use in Nextcloud
*
* gives back the user names as they are used ownClod internally
* @throws \Exception
@@ -644,7 +644,7 @@ class Access extends LDAPUtility {
* gives back the group names as they are used ownClod internally
*
* @param array $ldapGroups as returned by fetchList()
- * @return array an array with the group names to use in Nextcloud
+ * @return array<int,string> an array with the group names to use in Nextcloud
*
* gives back the group names as they are used ownClod internally
* @throws \Exception
@@ -655,6 +655,7 @@ class Access extends LDAPUtility {
/**
* @param array[] $ldapObjects as returned by fetchList()
+ * @return array<int,string>
* @throws \Exception
*/
private function ldap2NextcloudNames(array $ldapObjects, bool $isUsers): array {
diff --git a/apps/user_ldap/lib/Group_LDAP.php b/apps/user_ldap/lib/Group_LDAP.php
index fac71093665..84267171d37 100644
--- a/apps/user_ldap/lib/Group_LDAP.php
+++ b/apps/user_ldap/lib/Group_LDAP.php
@@ -466,7 +466,7 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
}
/**
- * @return array A list of users that have the given group as gid number
+ * @return array<int,string> A list of users that have the given group as gid number
* @throws ServerNotAvailableException
*/
public function getUsersInGidNumber(
@@ -591,6 +591,7 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
/**
* @throws ServerNotAvailableException
+ * @return array<int,string>
*/
public function getUsersInPrimaryGroup(
string $groupDN,
@@ -840,7 +841,7 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
* @param string $search
* @param int $limit
* @param int $offset
- * @return array with user ids
+ * @return array<int,string> user ids
* @throws Exception
* @throws ServerNotAvailableException
*/
@@ -909,7 +910,11 @@ class Group_LDAP extends BackendUtility implements GroupInterface, IGroupLDAP, I
if (empty($ldap_users)) {
break;
}
- $groupUsers[] = $this->access->dn2username($ldap_users[0]['dn'][0]);
+ $uid = $this->access->dn2username($ldap_users[0]['dn'][0]);
+ if (!$uid) {
+ break;
+ }
+ $groupUsers[] = $uid;
break;
default:
//we got DNs, check if we need to filter by search or we can give back all of them
diff --git a/apps/user_ldap/lib/Group_Proxy.php b/apps/user_ldap/lib/Group_Proxy.php
index 74655840f47..5f8d0562fd9 100644
--- a/apps/user_ldap/lib/Group_Proxy.php
+++ b/apps/user_ldap/lib/Group_Proxy.php
@@ -171,7 +171,7 @@ class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGet
/**
* get a list of all users in a group
*
- * @return string[] with user ids
+ * @return array<int,string> user ids
*/
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$this->setup();