diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-10-26 13:42:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-26 13:42:29 +0200 |
commit | f8ca3bb2a1dd648f41e8fea5b5eb87b53bc8d521 (patch) | |
tree | 442181ac32f6c8a9601619aa9c94635c09fc02ce /app/policies/admin/status_policy.rb | |
parent | dee69be60ef72f714ca3cbbd47e83f1015332f06 (diff) |
Add ability to view previous edits of a status in admin UI (#19462)
* Add ability to view previous edits of a status in admin UI * Change moderator access to posts to be controlled by a separate policy
Diffstat (limited to 'app/policies/admin/status_policy.rb')
-rw-r--r-- | app/policies/admin/status_policy.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/policies/admin/status_policy.rb b/app/policies/admin/status_policy.rb new file mode 100644 index 000000000..ffaa30f13 --- /dev/null +++ b/app/policies/admin/status_policy.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class Admin::StatusPolicy < ApplicationPolicy + def initialize(current_account, record, preloaded_relations = {}) + super(current_account, record) + + @preloaded_relations = preloaded_relations + end + + def index? + role.can?(:manage_reports, :manage_users) + end + + def show? + role.can?(:manage_reports, :manage_users) && (record.public_visibility? || record.unlisted_visibility? || record.reported?) + end + + def destroy? + role.can?(:manage_reports) + end + + def update? + role.can?(:manage_reports) + end + + def review? + role.can?(:manage_taxonomies) + end +end |