Hello, I’ve just created a test-user. With this user I can see the E-Mail addresses of other users in nextcloud over the contacts-shortcut upper right side. But my primary account (group admin) has no E-Mail icon although I have an E-Mail address stored.
So my questions are:
What’s the reason why my E-Mail address is not being shown?
Is it possible to hide the E-Mail addresses from being shown to other users?
Sure man but i didn’t found something under keywords like www.giyf.com/nextcloud+hide+email+address
If it was answered a half a dozen times, just link a thread.
All that I can find is to hide the list of usernames but that’s not what I want.
I already looked up in the forum and i saw that some guys have a lock beside their personal settings:
I miss such a setting.
@anon99252149 scary, with an existing account there is no privacy setting for the E-Mail address available but with a test account I have the menu option
It’s really bad that I have to activate the federated cloud option for allowing users to share their data with a global and public addressbook. Otherwise I don’t have the option to set the E-Mail address from “Contacts” to “Private”
@anon made a nonsense comment, don’t care about this noob. He doesn’t exist anymore… It doesn’t address the contacts app, it’s a server-feature. It’s related to a problem if federated cloud-sharing is disabled. I’ve created an issue (https://github.com/nextcloud/server/issues/9638#issuecomment-404694454) which is marked as bug. Since mid-2018 nobody cares. Please comment on this issue to trigger development and process.
Oh, that issue doesn’t handle default settings, it’s just about that the option to change your settings is not available, if you deactivated federation.
In my case, I needed to change it after the users were created. Impersonating each single user or changing all passwords and logging into their accounts was not a feasible option.
So I resorted to manually updating the DB. I anyone is in the same situation, the following might work to make the email private for all users:
Get the desired set of users. In my example, I use all
Iterate each uid and get the json data of their respective account from the database
Use jq to change email.scope from contacts to private.
So far so good, we now have the json we want to update the db with. But the tricky part for me was to update the db with the manipulated json string. I ran into encoding issues using postgres on the shell. So my solution was:
Create an SQL update statement for each UID using awk and saved it to a .sql file.
Run the update statements of the .sql through the db
IMPORTANT: Backup your DB before trying this!
Example code using postgres and docker/docker-compose:
docker-compose exec -T [DB_CONTAINER_COMPOSE] psql -tU [DB_NAME] -c "select uid from oc_accounts;" |
# Remove trailing newline that postgres adds for some reason.
head -n -1 |
# iterate each UID from the last query
while read line; do
# retrieve data of UID from DB
docker exec [DB_CONTAINER_FULL_NAME] \
psql -tU [DB_NAME] -c "select data from oc_accounts where uid='$line';" |
# set email.scope to `private`
jq --raw-output --compact-output -e '.email.scope = "private"' |
# create update statement using awk
awk -v q="'" -v uid="$line" \
'{ print "UPDATE oc_accounts SET data = " q $0 q " WHERE uid = " q uid q ";" }'
# redirect all update statements to a single .sql file
done > update.sql
Ok, quite terrible, but at least it’s a “one” liner. Now if using docker:
docker cp update.sql [DB_CONTAINER_FULL_NAME]:/
And finally, execute the statement, after you made a backup of the DB and double checked the generated update.sql!
Would be great if such simple tasks could be performed more productively with NC! Best solution: Don’t need to perform them at all; just make everything private by default except the username! Users can be informed that their personal info can be made public. But users can not be told “eerr…btw…your email is public. turn it private if you want, so that at least not any more users see it from now on.”
modify /var/www/nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php on line 268
$entry->addEMailAddress($email);
to
// $entry->addEMailAddress($email);