Repository navigation
fix: system address book card restriction - #63392
Conversation
|
/backport to stable34 |
|
/backport to stable33 |
|
/backport to stable32 |
40cbf7c to
b6f3a6f
Compare
| if (!is_array($excludedGroupIds) || $excludedGroupIds === []) { | ||
| return false; | ||
| } | ||
| return array_intersect($this->groupManager->getUserGroupIds($user), $excludedGroupIds) !== []; |
There was a problem hiding this comment.
question: the logic here and a similar precedent one in ContactsController is applying the group exclusion in a completely different way than the setting itself advertises: in all other places groups are removed from the user's group list so that the checks about group membership only act on groups that are not in the exclude list.
I guess a common use-case is to have "everyone" groups, but exclude them from counting when checking for group membership and keep the filtering working. With the logic above and the configuration I mentioned, everyone would see everyone else.
Is this the desired outcome?
There was a problem hiding this comment.
Hey! Sorry, just saw your comment.
You are correct, I copied the logic from calendar, and it was broken in calendar.
Fixing now
fb6a0f7 to
110863b
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
/backport to stable35 |
|
@ChristophWurst @kesselb @hamza221 +1 please |
|
Looking at #63392 with #65812 in mind, I think we should extract the enumeration settings to a own helper in this PR. class SystemAddressbookAccess {
public function __construct(
private IShareManager $shareManager,
private IGroupManager $groupManager,
) {
}
/** @return list<string>|null group IDs whose members $viewer may see, [] for own card only, null if unrestricted */
private function getVisibleGroupIds(IUser $viewer): ?array {
if ($viewer->getBackendClassName() === 'Guests'
|| !$this->shareManager->allowEnumeration()
|| ($this->shareManager->limitEnumerationToPhone() && !$this->shareManager->limitEnumerationToGroups())) {
return [];
}
if (!$this->shareManager->limitEnumerationToGroups() && !$this->shareManager->shareWithGroupMembersOnly()) {
return null;
}
return array_values(array_diff(
$this->groupManager->getUserGroupIds($viewer),
$this->shareManager->shareWithGroupMembersOnlyExcludeGroupsList(),
));
}
public function canSee(IUser $viewer, IUser $target): bool { /* own → true, guest target → false, null → true, else group intersect */ }
/** @return list<string>|null */
public function getVisibleCardUris(IUser $viewer): ?array { /* own + non-guest members of getVisibleGroupIds() */ }
} |
Federation
Config
Performance
Structure
Housekeeping
|
2f8409d to
e4656ae
Compare
|
Please have another look. |
| $shareEnumeration = $this->config->getAppValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes') === 'yes'; | ||
| $shareEnumerationGroup = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_group', 'no') === 'yes'; | ||
| $shareEnumerationPhone = $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_to_phone', 'no') === 'yes'; | ||
| // Trusted servers have no session user and are not subject to the user restrictions |
There was a problem hiding this comment.
Is it ? this is not how it used to work?
I would assume if enumeration is applied to local users it should not sync with remote servers either
There was a problem hiding this comment.
This is a system address book (a user directory) and the federation process has no user session (system to system) so how do you apply restrictions? We should need to add a UI to select which groups to federate
There was a problem hiding this comment.
Don't share anything I guess
At least that's how it used to work before the patch no?
There was a problem hiding this comment.
At least it should be discussed and not committed as a fix
There was a problem hiding this comment.
I agree which is why I haven't merged it yet
There was a problem hiding this comment.
I think "federated groups" don't exist yet, hence it's not possible that a local and remote user are in the same group. If that option is enabled no cards should be synced.
e4656ae to
86243b7
Compare
|
ci fix ab04f59 , rebasing |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
86243b7 to
a9389fd
Compare
Summary
Checklist
3. to review, feature component)stable32)AI (if applicable)