media_privacy

Read and save the site's uploaded media privacy policy. Administrators can configure this policy under Configuration > Privacy > Uploaded media.

Read the validated settings map in a template:

{% with m.media_privacy.settings as policy %}
    {% if policy.strip %}Metadata stripping is enabled.{% endif %}
{% endwith %}

The settings model path requires an editable administrator context, returning {error, eacces} otherwise. Unknown paths return {error, unknown_path}. This model has no write path; the administration form calls the Erlang API.

Settings use binary keys:

KeyValuesDefault
stripBoolean; strip embedded metadata from supported uploadsfalse
retainall, selected, noneall
fieldsList of selected metadata groupstitle, description, copyright, focus_point
locationexact, rounded, removeexact
precisionDecimal places for rounded coordinates, from 0 to 63
import_title, import_summary, import_bodyBoolean; import into empty resource fieldstrue

Selectable groups are title, description, creator, copyright, capture_date, camera, location, focus_point, keywords, credit_source, and license. Keywords retain the complete keyword list. Credit/source keeps credit text, source text and source URL; license keeps the license identifier or URL, usage terms and rights-statement URL. With mod_copyright enabled, retained credit/source and recognized licenses populate its properties on new media resources. Focus point retention keeps the EXIF subject area and the derived point used for cropping. Camera retention includes make/model, lens information, focal length, aperture, shutter speed, ISO, metering, flash and related exposure settings; serial numbers and unique image identifiers are excluded. Retained location coordinates supply the created media resource's GPS location unless editorial coordinates are supplied. Retention controls stored metadata; removing metadata from the uploaded file also requires strip. See mod_media_exif for supported formats and stripping behavior.

From Erlang, policy(Context) returns {ok, Settings} or {error, metadata_privacy_config}. It supplies defaults when configuration is absent. This is an internal upload-policy read and does not check ACLs.

save(Settings, Context) requires an editable administrator context, validates the supplied map, fills omitted keys with defaults, and stores the complete policy atomically as JSON in mod_media_exif.metadata_privacy. It returns ok, {error, eacces}, or a validation/storage error. To change one setting while preserving the others, read the current policy first:

{ok, Settings} = m_media_privacy:policy(Context),
m_media_privacy:save(Settings#{<<"precision">> => 2}, Context).

from_form(Qs) parses the administration form's binary-keyed proplist and returns {ok, Settings} or {error, metadata_privacy_config}. It neither saves settings nor checks permissions; the caller must use save/2 to persist them.

Edit on GitHub