Skip to content

Commit

Permalink
WIP: Policy for Resume
Browse files Browse the repository at this point in the history
  • Loading branch information
FaxriddinMaxmadiyorov committed Oct 15, 2023
1 parent 7970080 commit e1d744e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/resumes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ def index

def show
@resume = Resume.find(params[:id])
authorize! @resume, with: ResumePolicy
end

def new
@resume = Resume.new
authorize! @resume, with: ResumePolicy
end

def edit
Expand Down
6 changes: 2 additions & 4 deletions app/policies/resume_policy.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
class ResumePolicy < ApplicationPolicy
authorize :user, optional: true

def show?
record.open? || (user && (user.admin? || user.moderator?))
def new?
user.company?
end
end

0 comments on commit e1d744e

Please sign in to comment.