Problem/Motivation
In a multi-user site, where multiple users can create their own feeds, it is required to give users the ability to manage their own feeds and feed items.
Proposed resolution
Add the following permissions (per feed type):
view own $id feeds
update own $id feeds
delete own $id feeds
delete own $id feed items
import own $id feeds
schedule_import own $id feeds
unlock own $id feeds
Remaining tasks
- Add the permissions to \Drupal\feeds\FeedsPermissions.
- Make sure that the permissions get respected (changes required in FeedAccessControlHandler).
- Add test coverage for each permission (new Functional test)
Original report by alayham
In a multi-user site, where multiple users can create their own feeds, it is required to give users the ability to manage their own feeds and feed items.
I suggest adding the following permissions to feeds:
edit own feeds
delete own feeds
delete own feed items
import own feeds
view own feeds
Issue fork feeds-3136344
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
megachrizGood suggestion. I didn’t realize these permissions didn’t exist already.
I suggest to add the following as well:
“Unlock own feeds” would probably be a rare permission to assign, as unlocking is more a site administrator kind of task, but just listed it here for completeness.
Patches are welcome. :)
Having a functional test for this feature would be great.
Comment #3
jrochate commentedHi.
Is there any alternative to limit feeds to it's owner, while this feature is not available?
Comment #4
megachrizAn alternative I can think of is creating a separate feed type and a separate role per user that need to create feeds, but that doesn't sound convenient to me. Though if you only have 2 or 3 users that need to create feeds, it could be an acceptable workaround.
I think a feature like this shouldn't be too hard to code, I think it should be doable in one day to make. Therefore I'm adding this issue to #3165018: [meta] Feeds intermediate issues. This way, it could be picked up during sprints. The next global sprint is on January 28-30, so you could try to promote this issue for that.
See https://groups.drupal.org/node/536597.
Comment #5
megachrizComment #9
megachrizCode looks good so far, thanks @DigantDj :)
Now just the automated tests. Do you want to handle that as well?
Comment #10
megachriz@DigantDj
Tests look great! I do see for some cases tests are missing:
I think there needs to be an additional check that an user isn't able to do stuff on a feed from an other feed type that he/she owns. So if an user has the permission "view own [feed type 1] feeds", I think the test should assert that the user cannot view own feeds of feed type 2. So just to cover the case that "$operation own" only applies to one feed type.
Comment #11
megachrizBy the way, the "Unlock" operation was just added today on the admin listing ;).
Comment #12
digantdj commented@MegaChriz Thanks for the feedback, the changes have been pushed to the merge request.
Comment #13
kristen polTests were added for:
as per #10 so removing tag.
Comment #15
megachrizThanks for your work @DigantDj. I made a few small changes (code style fixes, minor corrections in code comments, small addition to unlock test) and merged the result.
Comment #16
digantdj commentedThe changes look good @MegaChriz.