-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Override can_edit_proposal? permission method to consider anonymous a…
…uthorships
- Loading branch information
1 parent
b7e4cdb
commit 016081c
Showing
1 changed file
with
8 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,14 @@ def allow_anonymous_proposals? | |
def organization | ||
@organization ||= context.fetch(:organization, nil) || context.fetch(:current_organization, nil) | ||
end | ||
|
||
def can_edit_proposal? | ||
toggle_allow(proposal && (proposal.editable_by?(user) || anonymously_editable?)) | ||
end | ||
|
||
def anonymously_editable? | ||
allow_anonymous_proposals? && proposal.editable_by?(Decidim::UserGroup.where(organization: organization).anonymous.first) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
entantoencuanto
Author
Member
|
||
end | ||
end | ||
end | ||
end |
Doesn't this allow any anonymous user to edit all proposals by any other anonymous user? I.e. anyone can edit all anonymous proposals on the platform, as long as they're not signed in?