Backport Use context instead of static access

Backport of https://github.com/owncloud/documents/commit/423cb53e14ff7909622eaa5118c1d78bb454d925#diff-d41d8cd98f00b204e9800998ecf8427e
Fixes https://github.com/owncloud/documents/issues/327