Commit Graph

91 Commits (1b273b8c2c08057eea4aed637cdd8c1c3f869fc3)

Author SHA1 Message Date
Ferdinand Thiessen 1b273b8c2c
chore(IAccountManager): remove deprecated visibility constants
Those constants are not used anywhere anymore and are deprecated for
more than ten versions. So its time to cleanup the interface.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-05-14 19:15:24 +07:00
Ferdinand Thiessen fbef47a5d7
fix(AccountManager): Sanitize social media handles
Ensure to only accept valid X and fediverse handles.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-02-06 11:58:24 +07:00
Git'Fellow c254855222 chore(db): Correctly apply query types
fix: psalm

fix: error

fix: add batch

fix: fatal error

fix: add batch

chore: add batch

chore: add batch

fix: psalm

fix: typo

fix: psalm

fix: return bool

fix: revert Manager
2024-10-17 09:21:07 +07:00
John Molakvoæ (skjnldsv) 26abc86eca
feat: add profile pronouns
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2024-09-17 22:20:36 +07:00
Jake Nabasny f863290572
feat(ldap): sync additional properties to profile and SAB
Synced from LDAP to profile:
- Date of birth

Synced from LDAP to SAB (via the profile):
- Biography
- Date of birth

Original code by Jake Nabasny (GitHub: @slapcat)

Co-authored-by: Jake Nabasny <jake@nabasny.com>
Co-authored-by: Richard Steinmetz <richard@steinmetz.cloud>
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
2024-05-30 12:01:13 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Joas Schilling aa5f037af7
chore: apply changes from Nextcloud coding standards 1.1.1
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2023-11-23 10:36:13 +07:00
Joas Schilling 0956b493b6
fix(phonenumber): Use the newly introduced API to limit 3rdparty lib usage
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-09-25 15:54:21 +07:00
Max 99a4a9cd09 fix: always use display name from correct backend
Overwrite the display name after the account is initialized
when using an instacne of IGetDisplayNameBackend.

Before when using a variation of user_oidc and registering
a Backend.php implementing IGetDisplayNameBackend
the personal setting page shows 'uid'.

The UserManager/AccountManager seems not to use consistently
the correct backend.

The correct backend is used in this sequence:

server/lib/private/TemplateLayout.php

          $userDisplayName = \OC_User::getDisplayName();
          $this->assign(user_displayname, $userDisplayName);

In the settings page, it definitely not calls the registered backend,
but seems to fall back to default Backend and shows (usually) uid
or a value from the standard account property table.

Signed-off-by: Max <max@nextcloud.com>
2023-08-15 14:55:03 +07:00
Joas Schilling 68fc9b48c2
feat!: Migrate AccountManager event to typed event
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-07-28 14:11:19 +07:00
Faraz Samapoor 0133515644 Renames the property to improve the code readbility/clarity.
Based on:
 https://github.com/nextcloud/server/pull/38978#pullrequestreview-1514202944

Co-authored-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2023-07-05 14:23:09 +07:00
Faraz Samapoor 8cb078b58c Fixes testcase errors.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2023-07-02 12:01:11 +07:00
Faraz Samapoor a1acacf032 Fixes Psalm error.
Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2023-07-01 13:57:46 +07:00
Faraz Samapoor ed972439fc Refactors lib/private/Accounts.
Mainly using PHP8's constructor property promotion.

Signed-off-by: Faraz Samapoor <fsa@adlas.at>
2023-07-01 13:57:46 +07:00
Christoph Wurst b8c61b3515 fix(caching): Avoid checking existence before fetching
The cache might expire between checking for key existence and fetching
the value. In this rare case the code continues with a null value when
it doesn't expect one.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2023-06-12 09:44:48 +07:00
Robin Appelman 9f1d497a0b
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in  lib/private to improve code readability.
2023-06-01 23:10:00 +07:00
Joas Schilling 4809e8d9a9
fix(CI): Satisfy psalm by removing a now obsolete type check
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-05-31 15:42:15 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Carl Schwan d1209d8302 Rename mastodon to fediverse
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-11-22 08:40:12 +07:00
Carl Schwan 86d9626901 Add mastodon personal info field
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-11-21 16:28:56 +07:00
Carl Schwan d5c23dbb9f Move CappedMemoryCache to OCP
This is an helpful helper that should be used in more place than just
server and this is already the case with groupfodlers, deck, user_oidc
and more using it, so let's make it public

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-07-14 15:54:31 +07:00
Joas Schilling 3235785c24
Fix exception handling when profile data is too long
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-06-09 22:07:46 +07:00
Thomas Citharel 4d26a9afa0
Allow to tweak default scopes for accounts
Close #6582

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2022-05-16 22:54:51 +07:00
Carl Schwan eef973e85b Minor optimizations for saving user personal information
* Remove double hook: the OC_User::changeUser triggers an
OC\AccountManager::userUpdated and the app is already listening to this
signal in its Application definition

* Make createCard not check if an card exists if we already checked
  previously. We also don't try to get the card if the user is disabled
  as we don't use the card in this case

We this change we go from 100 DB requests to 80 DB requests when saving
an user email address.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
(cherry picked from commit c6fd482edf33214a9ad4787e4cac278f871fa7c8)
2022-05-12 21:02:52 +07:00
Carl Schwan 9cb992e93c Cache account information
Currently, each field of the profile settings is fetching the account
information. This patch makes it so that only the first time do a DB call
and all the later ones are cached.

Reduce by 5 queries when loading the profile setting page and I suppose
other pages are affected since loading a page generates always fetch at
least once the account information to see if the profile feature is enabled
for the user.

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-04-05 19:29:54 +07:00
Christopher Ng 108abd77ed Add profile default setting for admin
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2022-03-18 02:55:12 +07:00
Carl Schwan 89d109a4d9
Merge pull request #30508 from nextcloud/fix/psaml-bin
Fix psalm not running
2022-01-13 09:51:04 +07:00
Carl Schwan 6312c0df69
Check style update
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-01-13 00:19:07 +07:00
Christopher Ng 19a3656fd9 Fix email verification
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2022-01-06 23:47:42 +07:00
Arthur Schiwon 998144f832
Obey col length of 255 to insert and search in accounts_data
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-11-26 16:30:14 +07:00
Arthur Schiwon e26d6f080b
fix populating account array with missing default values
- both $userData and $defaultUserData have numeric indices
- each element contains at least the name and other fields
- appending the missing data array is sufficient

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-10-22 23:05:43 +07:00
Christopher Ng 7215148a24 Add new account properties
- New properties
  - Organisation
  - Role
  - Headline
  - Biography
  - Profile Enabled property
- Fix errors with building default account properties
- Fix L10N factory method `getLanguage` not public error
- Update tests

Signed-off-by: Christopher Ng <chrng8@gmail.com>
2021-10-19 04:44:40 +07:00
Arthur Schiwon aacaad2a3f
implement verification for additional mails
- mails added by (sub)admins are automatically verified
- provisioning_api controller as verification endpoint
- IAccountProperty gets a locallyVerified property
- IPropertyCollection gets a method to fetch an IAccountProperty by value
  - an remove equivalent was already present
- AccountManager always initiates mail verification on update if necessary
- add core success template for arbitrary title and message

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-09 14:03:35 +07:00
Arthur Schiwon ad0a11b2bf
cleanup
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 01:03:44 +07:00
Arthur Schiwon 506227b509
adjust internal data handling logic to fix store and load
- format as stored previously in oc_accounts table is kept

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:48:01 +07:00
Arthur Schiwon c7bf4295cc
adjust email verification checker
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:47:36 +07:00
Arthur Schiwon d64411e9df
fix code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:45:49 +07:00
Arthur Schiwon 3d6ffd3da2
adjust verification state updater method
- also fixes scope of internal methods

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:42:42 +07:00
Arthur Schiwon af3fdbea7b
make AccountManager actually write multi value properties
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:41:12 +07:00
Arthur Schiwon 13818005a3
prov api reports additional emails on getUser
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-30 00:41:10 +07:00
blizzz 662ab937e0
Merge pull request #27189 from nextcloud/feat/26866/account-collection-properties
Extend Accounts with multivalue properties (PropertyCollection)
2021-06-08 14:25:18 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Arthur Schiwon 35d5395089
psalm happiness
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

psalm happiness

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-04 19:57:00 +07:00
Arthur Schiwon 2701c3e7dc
fix code style
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-03 20:54:25 +07:00
Arthur Schiwon 44827e37c0
allow interacting with IAccountPropertyCollections
- in fact the API could be done in a nicer way and it might be possible to
  work without IAccountPropertyCollection, but only with the
  IAccountProperties.
- To keep it simple at first and not overengineer the blunt attempt is
  followed
- If necessary helpful in the further cause of development adjustements or
  extensions can be done quickly with this base


Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-03 20:49:49 +07:00
Arthur Schiwon 839bff1641
deal with property collections when fetching users (with update)
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-03 20:49:49 +07:00
Arthur Schiwon 956bfba2e2
refactor validators and sanitizers
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-06-03 20:49:48 +07:00
Joas Schilling aa651fd629
Merge pull request #26259 from nextcloud/feature/noid/validate-website-to-be-valid
Validate the website field input to be a valid URL
2021-04-26 13:56:01 +07:00
Daniel Calviño Sánchez 7159a70894 Guard against null phone number value
"parsePhoneNumber()" expects a string, so a TypeError would be thrown if
the phone number value is null.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2021-04-23 11:44:42 +07:00
Joas Schilling d80cc76ee7
Validate the website field input to be a valid URL
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-04-22 16:34:13 +07:00