Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turn LDAP's treat remnants as disabled feature config-independent #46992

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Aug 2, 2024

Summary

Since former LDAP users cannot be bound to a server configuration anymore (or theoretically belong to more than one) this feature has to be config independent. This PR:

  • changes the existing logic from config-bound to app-global
  • including web interface changes
  • has a migration step to set the new values based on the old ones – one previous activation enables it for the whole LDAP backend

A backport to 28 will need further adjustments as IAppConfig was only introduced in 29.

Screenshot_20240802_181949

Checklist

@blizzz blizzz added this to the Nextcloud 30 milestone Aug 2, 2024
@blizzz blizzz requested review from artonge, come-nc, a team and yemkareems and removed request for a team August 2, 2024 16:21
- *ldap_mark_remnants_as_disabled were old values and removed now, after
- combining their value and storing into current
  backend_mark_remnants_as_disabled

Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
@blizzz blizzz force-pushed the fix/noid/ldap-remnants-as-disabled-global branch from 65f3833 to 6a0351e Compare August 2, 2024 17:01

// if it was enabled for at least one configuration, use it as global configuration
$filteredKeys = array_filter($allKeys, static function (string $key): bool {
return str_contains($key, 'ldap_mark_remnants_as_disabled');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return str_contains($key, 'ldap_mark_remnants_as_disabled');
return str_ends_with($key, 'ldap_mark_remnants_as_disabled');

Comment on lines +427 to +430
if (!$this->treatRemnantsAsDisabled()) {
return $queryDatabaseValue();
}
return !$this->deletedUsersIndex->isUserMarked($uid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic is wrong here.
If treatRemnantsAsDisabled is true and the user is not marked we should still query the DB.

Suggested change
if (!$this->treatRemnantsAsDisabled()) {
return $queryDatabaseValue();
}
return !$this->deletedUsersIndex->isUserMarked($uid);
if ($this->treatRemnantsAsDisabled() && $this->deletedUsersIndex->isUserMarked($uid)) {
return false;
} else {
return $queryDatabaseValue();
}

@@ -414,6 +419,14 @@ protected function getLcValue(string $varName): string {
return mb_strtolower($this->getValue($varName), 'UTF-8');
}

protected function getGlobalAppValueAsBool(string $varName): bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it returns bool the magic property in phpdoc before the class should be typed to bool I think.
Also the default value in getDefaults is now unused for this property I think.

This was referenced Aug 5, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 30, Nextcloud 31 Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants