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

Please allow to disable gravatar.com service (user privacy) #5272

Closed
paulmueller opened this issue Mar 9, 2020 · 3 comments · Fixed by #5426
Closed

Please allow to disable gravatar.com service (user privacy) #5272

paulmueller opened this issue Mar 9, 2020 · 3 comments · Fixed by #5426
Assignees

Comments

@paulmueller
Copy link
Contributor

paulmueller commented Mar 9, 2020

I would like to disable the gravatar.com service in my CKAN instance. This is an issue because now I have to include gravatar.com in my site's privacy policies.

CKAN Version if known (or site URL)

2.8.3

Please describe the expected behaviour

It would be nice if I could disable gravatar via the CKAN .ini file, e.g.

ckan.gravatar_default = disabled

Please describe the actual behaviour

I cannot disable this feature. I also cannot set a user-defined image.

@paulmueller
Copy link
Contributor Author

paulmueller commented Mar 9, 2020

A workaround is to monkey-patch ckan.lib.helpers. This will replace the gravatar with a colored svg image (color defined by email hash) for each user. Put this into your plugin.py:

import ckan.lib.helpers as helpers

@helpers.core_helper
def gravatar(email_hash, size=100, default=None):
    return helpers.literal('''<svg style="vertical-align:middle;" class="gravatar" width="{}" height="{}"><rect width="{}" height="{}" fill="#{}"/></svg>'''.format(
        size, size, size, size, email_hash[:6]))

@helpers.core_helper
def linked_gravatar(email_hash, size=100, default=None):
    return gravatar(email_hash, size, default)

# Monkey-patch to remove gravatar
helpers.gravatar = gravatar
helpers.linked_gravatar = gravatar

@paulmueller
Copy link
Contributor Author

Here is a nicer version using two circles:

import ckan.lib.helpers as helpers

@helpers.core_helper
def gravatar(email_hash, size=100, default=None):
    return helpers.literal('''
        <svg style="vertical-align:middle;" class="gravatar" width="{size}" height="{size}">
        <circle r="{r1}" cx="{center}" cy="{center}" fill="#{fill1}" stroke="gray" stroke-width="{stroke_width}"/>
        <circle r="{r2}" cx="{center}" cy="{center}" fill="#{fill2}" stroke="gray" stroke-width="{stroke_width}"/>
        </svg>'''.format(size=size, center=size/2, r1=size/3, r2=size/6,
                         fill1=email_hash[:6], fill2=email_hash[6:12],
                         stroke_width=size/100))

@helpers.core_helper
def linked_gravatar(email_hash, size=100, default=None):
    return gravatar(email_hash, size, default)

# Monkey-patch to remove gravatar
helpers.gravatar = gravatar
helpers.linked_gravatar = gravatar

Gravatar is a nice idea (upload your own image which will then be used whenever your email address matches), but in terms of user privacy, I think it's kind of outdated (no offense). I would even go as far as proposing to disable it by default...

@wardi
Copy link
Contributor

wardi commented Mar 9, 2020

+1 to removal. gravatar (and md5summing email addresses) doesn't seem like a great idea anymore.

amercader added a commit that referenced this issue Jun 7, 2020
In the same way the org/group ones work. Also image_display_url for the
actual URL.
amercader added a commit that referenced this issue Jun 7, 2020
Change the form type to multipart/form-data and handle the uploads on
the actions
amercader added a commit that referenced this issue Jun 7, 2020
This will take into account first, the userr image_url first if set, and
if no it will default to gravatar, unless it is disabled via
configuration.
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jun 7, 2020
amercader added a commit that referenced this issue Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants