Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ gem 'jquery-rails', '~> 4.4'
gem 'lazy_high_charts', '~> 1.6'
gem 'pg', '~> 1.1'
gem 'puma', '~> 5.0'
gem 'pundit', '~> 2.1'
gem 'rails', '~> 6.1.1'
gem 'sass-rails', '>= 6'
gem 'sprockets', '~> 4.0'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ GEM
public_suffix (4.0.6)
puma (5.2.1)
nio4r (~> 2.0)
pundit (2.1.0)
activesupport (>= 3.0.0)
racc (1.5.2)
rack (2.2.3)
rack-mini-profiler (2.3.1)
Expand Down Expand Up @@ -259,6 +261,7 @@ DEPENDENCIES
listen (~> 3.3)
pg (~> 1.1)
puma (~> 5.0)
pundit (~> 2.1)
rack-mini-profiler (~> 2.0)
rails (~> 6.1.1)
rubocop (~> 1.9)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationController < ActionController::Base
include Pundit
end
49 changes: 49 additions & 0 deletions app/policies/application_policy.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class ApplicationPolicy
attr_reader :user, :record

def initialize(user, record)
@user = user
@record = record
end

def index?
false
end

def show?
false
end

def create?
false
end

def new?
create?
end

def update?
false
end

def edit?
update?
end

def destroy?
false
end

class Scope
attr_reader :user, :scope

def initialize(user, scope)
@user = user
@scope = scope
end

def resolve
scope.all
end
end
end