Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog Post canEdit method allows some members to edit posts for which they are not an editor/author. #607

Open
GuySartorelli opened this issue Apr 14, 2020 · 3 comments

Comments

@GuySartorelli
Copy link
Member

In BlogPost.php, the canEdit method immediately returns true if its parent's canEdit method returns true.

if (parent::canEdit($member)) {
    return true;
}

This happens before any of BlogPost's bespoke checks (e.g. checking $parent->isEditor, $this->isAuthor, etc) which ultimately results in some members being able to edit any blog post even if they're not an author for that post (depending on the permissions checks up the line).

It also means that if the parent says a member should not be able to edit the page, if someone else has listed them as an author they may be able to edit the post anyway.

@GuySartorelli
Copy link
Member Author

My assumption is that this is intended to be

if (!parent::canEdit($member)) {
    return false;
}

which would match what happens in canView and means that if permissions up the line fail then this also fails, but if they pass then we still have to check the requirements for this class itself.

@bergice
Copy link
Contributor

bergice commented Apr 16, 2020

Hi, thanks for reporting this. Feel free to write up a pull request if you have time.

@GuySartorelli
Copy link
Member Author

Thanks! I've linked a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants