Skip to content

Prevent contributors from uploading media files#10812

Merged
planarvoid merged 2 commits intodevelopfrom
issue/10666-contributor-media-permision
Nov 28, 2019
Merged

Prevent contributors from uploading media files#10812
planarvoid merged 2 commits intodevelopfrom
issue/10666-contributor-media-permision

Conversation

@malinajirka
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka commented Nov 18, 2019

Fixes #10666

I recommend using another diff tool than GitHub - eg. the changes in Android Studio diff are more obvious.

The goal of this PR is to prevent users who don't have permission, to upload media files from the Editor (eg. Contributors). Ideal solution wouldn't even show the items on the UI (eg. we wouldn't show "Capture image" as we know, it'll require media upload). I decided to implement this temporary solution and we can consider reverting it when we add support for filtering media options before Gutenberg shows them on the UI. We could use similar technique to this for all options we show on the UI. Wdyt?

To test:

  1. Switch to a site on which you are in "Contributor" role
  2. Create a new draft in Gutenberg
  3. Try to upload media - Image block, Video block, Media&Text block
    => the only option which should work is WPMedia library as the media files are already present on the server

PR submission checklist:

  • I have considered adding unit tests where possible.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Nov 18, 2019

You can test the changes on this Pull Request by downloading the APK here.

@malinajirka malinajirka changed the base branch from master-edit-post-activity-refactor to develop November 19, 2019 10:22
# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/ui/photopicker/PhotoPickerFragment.java
#	WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java
@planarvoid planarvoid self-assigned this Nov 28, 2019
Copy link
Copy Markdown
Contributor

@planarvoid planarvoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! It works well 👍

@planarvoid planarvoid merged commit cb27331 into develop Nov 28, 2019
@planarvoid planarvoid deleted the issue/10666-contributor-media-permision branch November 28, 2019 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contributors shouldn't be allowed to upload media

2 participants