Open YeapGuy opened 1 year ago
Which, however, as I sort of expected, resulted in this error when starting Nextcloud:
Why did you expect an issue? I've just copied the very same exact thing and it works properly. The issue is with the notify_push rust backend, which tries and fails to parse the PHP code to get configuration, not with Nextcloud itself.
I'd try to put the values directly and report the issue to the notify_push repository or directly to https://github.com/icewind1991/php-literal-parser (which is the rust library that's being used) cc @icewind1991 :
<?php
$CONFIG = array (
// other irrelevant config
'account_manager.default_property_scope' =>
array (
"displayname" => "v2-local",
"email" => "v2-local",
"avatar" => "v2-local"
),
'maintenance' => false,
);
Ah, okay. I thought it wouldn't work because the values aren't enclosed in quotes like everything else in the config. But yeah, as I mention, I don't know PHP well. Anyways, how can I then fix this? Use the snippet you sent? Would that work?
I had the same problem with a fresh install of Nextcloud 25 (v25.0.2.3
, php v8.1.13
, Ubuntu Server, nginx, MySQL), and found this issue. As per the documentation here I had this entry in my config.php
:
'account_manager.default_property_scope' => [
\OCP\Accounts\IAccountManager::PROPERTY_DISPLAYNAME => \OCP\Accounts\IAccountManager::SCOPE_LOCAL
\OCP\Accounts\IAccountManager::PROPERTY_EMAIL => \OCP\Accounts\IAccountManager::SCOPE_LOCAL
\OCP\Accounts\IAccountManager::PROPERTY_AVATAR => \OCP\Accounts\IAccountManager::SCOPE_LOCAL
\OCP\Accounts\IAccountManager::PROPERTY_ADDRESS => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_WEBSITE => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_PHONE => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_TWITTER => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_FEDIVERSE => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_ORGANISATION => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_ROLE => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_HEADLINE => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY => \OCP\Accounts\IAccountManager::SCOPE_PRIVATE
],
and got webserver errors like this:
[error] <...> FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected fully qualified name "\OCP\Accounts\IAccountManager", expecting "]" in /var/www/nextcloud/config/config.php on line 51" while reading response header from upstream <...>
And I also tried to quote the values but that didn't work, with the defaults not set correctly on a new account. As @tcitworld suggested I replaced the config with:
'account_manager.default_property_scope' =>
array (
"displayname" => "v2-local",
"email" => "v2-local",
"avatar" => "v2-local",
"address" => "v2-private",
"website" => "v2-private",
"phone" => "v2-private",
"twitter" => "v2-private",
"fediverse" => "v2-private",
"organisation" => "v2-private",
"role" => "v2-private",
"headline" => "v2-private",
"biography" => "v2-private",
),
(See definition of scopes and properties)
This fixed the error and new accounts now seem to have the correct default scopes set. I don't know if this is the intended behaviour, but if it is maybe the documentation here (and here?) should be changed to reflect that.
@sboettcher The issue in your case was probably just the missing comma after each entry of the array (documentation lacked one).
Unfortunately, neither of the two approaches mentioned by @sboettcher works on my Nextcloud v25.0.4 instance. Any other idea?
PS: @tcitworld, I took care of the commas. ;-)
Hi, please update to 25.0.7 or better 26.0.2 and report back if it fixes the issue. Thank you!
My goal is to add a label like e.g. 26-feedback to this ticket of an up-to-date major Nextcloud version where the bug could be reproduced. However this is not going to work without your help. So thanks for all your effort!
If you don't manage to reproduce the issue in time and the issue gets closed but you can reproduce the issue afterwards, feel free to create a new bug report with up-to-date information by following this link: https://github.com/nextcloud/server/issues/new?assignees=&labels=bug%2C0.+Needs+triage&template=BUG_REPORT.yml&title=%5BBug%5D%3A+
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.
No me funciona en la versión 27 de nextcloud
The issue generally exists whenever variables are used inside the config, which are, obviously, not literals.
There are multiple references in the documentation to variables being used and in some instances it can not easily be circumvented, e.g. putting the $_SERVER['HTTP_HOST'] ip into the trusted_domains array or injecting pod annotations into runtime configs such as maintenance mode.
A workaround is duplicating some of the configuration into another file which only uses literals and explicitly call the notify_push binary with this config, or invoking the notify_push binary explicit variables, but this would expose passwords to the argument string and possibly to env.
⚠️ This issue respects the following points: ⚠️
Bug description
I am trying to configure the user profile fields' default visibility, and according to the docs, it should be possible within config.php: https://docs.nextcloud.com/server/latest/admin_manual/configuration_user/profile_configuration.html#property-scopes So I tried that like so:
Which, however, as I sort of expected, resulted in this error when starting Nextcloud:
So I went ahead, and changed these values to strings, like so:
Didn't work. No errors this time, but creating a new user, the display name, email and avatar are still set to "Federated". So I tried escaping the backslashes:
Nope. Same as when not escaping them.
Steps to reproduce
Expected behavior
New users should be created with the configured profile fields visibility
Installation method
Official All-in-One appliance
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.0
Web server
Apache (supported)
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
@tcitworld implemented this, so perhaps he can elaborate? I looked at your code, but I only have very basic knowledge of PHP, so unfortunately I cannot pin down what should be changed to make this work.