Files
codeocean/app/policies/admin_or_author_policy.rb
2021-05-14 22:03:06 +02:00

12 lines
286 B
Ruby

# frozen_string_literal: true
class AdminOrAuthorPolicy < ApplicationPolicy
%i[create? index? new?].each do |action|
define_method(action) { admin? || teacher? }
end
%i[destroy? edit? show? update?].each do |action|
define_method(action) { admin? || author? }
end
end