A key missing piece from File admin is access control. Currently we can mark a file as unpublished, but we cannot restrict access to it. This functionality is waiting on #1227706: Add a file entity access API, which is getting very near to completion.

Meantime, the patch in this issue implements the new file access API and can be used for testing.

To test:

  • Apply the latest patch from #1227706 to file_entity 2.x dev.
  • Apply the patch from this issue to file_admin 1.x dev.
  • Enable both modules on a test site.
  • Create a test authenticated user account.
  • Referring to the instructions on the File admin project page, several files:
    1. A published file with your admin user as author.
    2. An unpublished file with your admin user as author.
    3. A published file with the test authenticated user as author.
    4. An unpublished file with the test authenticated user as author.

    Note the file IDs of each of the files you created.

  • Assign the permission "View own private files" to the "authenticated user" role.

Now log out and test visiting each file as both anonymous user and as your test authenticated user. The file URLs will be in the form file/{fid} where {fid} is the ID of the file.

Expected results:

  • Both anonymous and test authenticated user can view file 1 (A published file with your admin user as author).
  • Neither anonymous nor test authenticated user can view file 2 (An unpublished file with your admin user as author).
  • Both anonymous and test authenticated user can view file 3 (A published file with your test authenticated user as author).
  • As the author, your test authenticated user can view file 4 (An unpublished file with the test authenticated user as author) but anonymous cannot.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nedjo’s picture

Status: Active » Postponed
FileSize
2.56 KB

Here's a patch that can be used to test #1227706: Add a file entity access API.

I'll update the issue summary with test instructions.

nedjo’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Update with test instructions.