Class: SearchHistoryPolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- SearchHistoryPolicy
- Defined in:
- app/policies/search_history_policy.rb
Instance Method Summary collapse
- #create? ⇒ Boolean
- #destroy? ⇒ Boolean
- #index? ⇒ Boolean
- #remove_all? ⇒ Boolean
- #show? ⇒ Boolean
- #update? ⇒ Boolean
Instance Method Details
#create? ⇒ Boolean
17 18 19 |
# File 'app/policies/search_history_policy.rb', line 17 def create? false end |
#destroy? ⇒ Boolean
25 26 27 |
# File 'app/policies/search_history_policy.rb', line 25 def destroy? show? end |
#index? ⇒ Boolean
2 3 4 |
# File 'app/policies/search_history_policy.rb', line 2 def index? true if user.try(:has_role?, 'User') end |
#remove_all? ⇒ Boolean
29 30 31 |
# File 'app/policies/search_history_policy.rb', line 29 def remove_all? true if user.try(:has_role?, 'User') end |
#show? ⇒ Boolean
6 7 8 9 10 11 12 13 14 15 |
# File 'app/policies/search_history_policy.rb', line 6 def show? case user.try(:role).try(:name) when 'Administrator' true when 'Librarian' true if record.user == user when 'User' true if record.user == user end end |
#update? ⇒ Boolean
21 22 23 |
# File 'app/policies/search_history_policy.rb', line 21 def update? false end |