Class: Decidim::Comments::Permissions

Inherits:
DefaultPermissions show all
Defined in:
decidim-comments/app/permissions/decidim/comments/permissions.rb

Instance Method Summary collapse

Methods inherited from DefaultPermissions

#initialize

Constructor Details

This class inherits a constructor from Decidim::DefaultPermissions

Instance Method Details

#permissionsObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'decidim-comments/app/permissions/decidim/comments/permissions.rb', line 6

def permissions
  return permission_action if permission_action.subject != :comment

  case permission_action.action
  when :read
    can_read_comments?
  when :create
    can_create_comment?
  when :update, :destroy
    can_update_comment?
  when :vote
    can_vote_comment?
  end

  permission_action
end