Sha256: 0fe2f7dc153d6c4c14a7852ae39a3fb8ac1874e653dcc5f8a4e073269d619ea9
Contents?: true
Size: 523 Bytes
Versions: 11
Compression:
Stored size: 523 Bytes
Contents
class CarloadDashboardPolicy < Struct.new(:user, :dashboard) [:index, :new, :edit, :destroy].each do |action| define_method :"#{action}?" do return true if Carload.auth_solution == :none return false if not user action = :all if not Carload.dashboard[:permits_user][action] Array(Carload.dashboard[:permits_user][action]).each do |permission| return true if eval "user.#{permission}" end false end end def create? new? end def update? edit? end end
Version data entries
11 entries across 11 versions & 1 rubygems