Sha256: dd598a9a0f94839f5f295e97fe126371aaf083efed9a203aaf05b17fdc0c5074
Contents?: true
Size: 516 Bytes
Versions: 4
Compression:
Stored size: 516 Bytes
Contents
class DashboardPolicy < 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
4 entries across 4 versions & 1 rubygems