-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fetch default privacy scopes and set properties appropriate #1048
base: main
Are you sure you want to change the base?
Fetch default privacy scopes and set properties appropriate #1048
Conversation
5274df5
to
c1dd620
Compare
…stead of using 'v2-local' (closes nextcloud#1047) Signed-off-by: Björn Bores <[email protected]>
c1dd620
to
9aabd12
Compare
I had to force-push because I somehow missed to check if a default value for BIRTHDAY is already available for using in case of gender (which is - like PRONOUNS - not availible before NC v31). Sorry for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this PR!
A few minor change requests and we're good to go.
@@ -227,7 +231,7 @@ public function provisionUser(string $tokenUserId, int $providerId, object $idTo | |||
$this->eventDispatcher->dispatchTyped($event); | |||
$this->logger->debug('Phone mapping event dispatched'); | |||
if ($event->hasValue()) { | |||
$account->setProperty('phone', $event->getValue(), $scope, '1', ''); | |||
$account->setProperty('phone', $event->getValue(), $defaultScopes[\OCP\Accounts\IAccountManager::PROPERTY_PHONE] ?? $fallbackScope, '1', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$account->setProperty('phone', $event->getValue(), $defaultScopes[\OCP\Accounts\IAccountManager::PROPERTY_PHONE] ?? $fallbackScope, '1', ''); | |
$account->setProperty('phone', $event->getValue(), $defaultScopes[IAccountManager::PROPERTY_PHONE] ?? $fallbackScope, '1', ''); |
IAccountManager
is imported, you don't need the full class path.
$defaultScopes = array_merge(AccountManager::DEFAULT_SCOPES, | ||
$this->config->getSystemValue('account_manager.default_property_scope', [])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$defaultScopes = array_merge(AccountManager::DEFAULT_SCOPES, | |
$this->config->getSystemValue('account_manager.default_property_scope', [])); | |
$defaultScopes = array_merge( | |
AccountManager::DEFAULT_SCOPES, | |
$this->config->getSystemValue('account_manager.default_property_scope', []) ?? [], | |
); |
The ?? []
will fix the PhpUnit tests (I'm not sure why they fail).
If you rebase on the main branch, you'll get rid of one Psalm issue ( The other one ( |
Fetch default values for privacy scopes and use these for user provisioning instead of always take 'v2-local' which will reveal sensitive information on default (closes #1047)