Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Controller/GroupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function rename(string $newGroupName,
$groups);

if (!empty($groups)
&& in_array($newGroupName, $groupsNameSearched)) {
&& in_array($newGroupName, $groupsNameSearched, true)) {
return new JSONResponse(
'This group already exists. Please, use another name',
Http::STATUS_CONFLICT
Expand Down Expand Up @@ -486,7 +486,7 @@ public function search(string $pattern, ?bool $ignoreSpaces = null, array $group
});
}

$groups = array_filter($groups, fn ($group) => !in_array($group->getGID(), $groupsPresents));
$groups = array_filter($groups, fn ($group) => !in_array($group->getGID(), $groupsPresents, true));

$groupsFormatted = GroupFormatter::formatGroups($groups);

Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/WorkspaceApiOcsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public function removeUsersFromGroup(int $id, string $gid, array $uids): DataRes
$gids = array_keys($space['groups']);
$spacename = $space['name'];

if (!in_array($gid, $gids)) {
if (!in_array($gid, $gids, true)) {
throw new OCSException("Group {$gid} does not belongs to the {$spacename} workspace.");
}

Expand Down Expand Up @@ -599,7 +599,7 @@ public function addUsersToGroup(int $id, string $gid, array $uids): Response {
$gids = array_keys($workspace['groups']);
$spacename = $workspace['name'];

if (!in_array($gid, $gids)) {
if (!in_array($gid, $gids, true)) {
throw new OCSForbiddenException("Group {$gid} does not belongs to the {$spacename} workspace.");
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Group/SubGroups/SubGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function create(string $groupname, int $id, string $spacename): IGroup {
$groupnames = array_map(fn ($group) => $group->getDisplayName(), $groupsSearched);

if (!is_null($group)) {
if (in_array($displayName, $groupnames)) {
if (in_array($displayName, $groupnames, true)) {
throw new GroupException("Group with display name $displayName already exists.", Http::STATUS_CONFLICT);
}
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Service/Group/ConnectedGroupsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getSpacesByGroups(array $gids): array {
$linkedSpaceGroupsByUserGroups = [];
$linkedSpaceGroupsByUserGroups = array_filter($linkedSpaceGroups, function ($spaceGid) use ($gids, $linkedSpaceGroups) {
foreach ($gids as $gid) {
if (isset($linkedSpaceGroups[$spaceGid]) && in_array($gid, $linkedSpaceGroups[$spaceGid])) {
if (isset($linkedSpaceGroups[$spaceGid]) && in_array($gid, $linkedSpaceGroups[$spaceGid], true)) {
return true;
}
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public function isConnectedToWorkspace(string $gid, array $spaceGids) : bool {

foreach ($spaceGids as $spaceGid) {
if (isset($linkedSpaceGroups[$spaceGid])) {
return in_array($gid, $linkedSpaceGroups[$spaceGid]);
return in_array($gid, $linkedSpaceGroups[$spaceGid], true);
}
}
return false;
Expand Down Expand Up @@ -156,7 +156,7 @@ public function hasConnectedGroups(string $gid, ?string $gidUserGroup = null) :
if (!is_null($gidUserGroup)) {
$values = $linkedSpaceGroups[$gidUserGroup];
if (!is_null($values)) {
return in_array($gid, $values);
return in_array($gid, $values, true);
}
return false;
}
Expand All @@ -183,10 +183,10 @@ public function add(IGroup $group, Space $space): bool {
* @param string $uid user UID
* @param string $spaceUserGid space-u group
*/
public function isStrictSpaceUser(string $uid, string $spaceUserGid) {
public function isStrictSpaceUser(string $uid, string $spaceUserGid): bool {
if (!isset($this->strictSpaceUsers[$spaceUserGid])) {
$this->strictSpaceUsers[$spaceUserGid] = $this->mapper->getStrictSpaceUserIds($spaceUserGid);
}
return in_array($uid, $this->strictSpaceUsers[$spaceUserGid]);
return in_array($uid, $this->strictSpaceUsers[$spaceUserGid], true);
}
}
4 changes: 2 additions & 2 deletions lib/Service/Group/GroupsWorkspaceService.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public function getGroupsUserFromGroupfolder(IUser $user, array $groupfolder, st
$groups = [];
foreach ($this->groupManager->getUserGroups($user) as $group) {
if (
in_array($group->getGID(), array_keys($groupfolder['groups']))
|| in_array($group->getGID(), $groupsWorkspace)
in_array($group->getGID(), array_keys($groupfolder['groups']), true)
|| in_array($group->getGID(), $groupsWorkspace, true)
) {
array_push($groups, $group->getGID());
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function formatUser(IUser $user, array $space, string $role): ?array {
}

foreach ($this->groupManager->getUserGroups($user) as $group) {
if (in_array($group->getGID(), array_keys($space['groups'])) || $this->connectedGroups->isConnectedToWorkspace($group->getGID(), array_keys($space['groups']))) {
if (in_array($group->getGID(), array_keys($space['groups']), true) || $this->connectedGroups->isConnectedToWorkspace($group->getGID(), array_keys($space['groups']))) {
array_push($groups, $group->getGID());
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Share/Group/ShareMembersOnlyFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function filterUsersGroupOnly(array $users): array {
$users,
function ($user) use ($usersInTheSameGroup) {
$usernames = array_values(array_map(fn ($user) => $user->getUID(), $usersInTheSameGroup));
return in_array($user->getUID(), $usernames);
return in_array($user->getUID(), $usernames, true);
});

return $usersInTheSameGroup;
Expand Down
2 changes: 1 addition & 1 deletion lib/Space/SpaceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function renameGroups(int $spaceId, string $oldSpacename, string $newSpac
}

$groups = array_map(fn ($gid) => $this->groupManager->get($gid), $gids);
$groups = array_filter($groups, fn ($group) => !in_array('LDAP', $group->getBackendNames()));
$groups = array_filter($groups, fn ($group) => !in_array('LDAP', $group->getBackendNames(), true));

foreach ($groups as $group) {
$newGroupName = str_replace($oldSpacename, $newSpacename, $group->getDisplayName());
Expand Down
2 changes: 1 addition & 1 deletion lib/Users/UserFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function formatUser(IUser $user, array $space, string $role): array {
// Gets the workspace subgroups the user is member of
$groups = [];
foreach ($this->groupManager->getUserGroups($user) as $group) {
if (in_array($group->getGID(), array_keys($space['groups']))) {
if (in_array($group->getGID(), array_keys($space['groups']), true)) {
array_push($groups, $group->getGID());
}
}
Expand Down