Disable redactions with write_api scope

Requires write_redactions scope to redact. Previously it was possible to redact with either write_redactions or write_api.
This commit is contained in:
Anton Khorev 2024-09-08 12:31:31 +03:00
parent 1fce0c00f1
commit 8b024f48c1
4 changed files with 13 additions and 52 deletions

View file

@ -27,7 +27,7 @@ class ApiCapability
if user.moderator?
can [:destroy, :restore], ChangesetComment if scope?(token, :write_api)
can :destroy, Note if scope?(token, :write_notes)
can :redact, [OldNode, OldWay, OldRelation] if user&.terms_agreed? && (scope?(token, :write_api) || scope?(token, :write_redactions))
can :redact, [OldNode, OldWay, OldRelation] if user&.terms_agreed? && scope?(token, :write_redactions)
end
end
end