Maintenance: Bump pundit from 2.1.1 to 2.2.0
Bumps [pundit](https://github.com/varvet/pundit) from 2.1.1 to 2.2.0. - [Release notes](https://github.com/varvet/pundit/releases) - [Changelog](https://github.com/varvet/pundit/blob/main/CHANGELOG.md) - [Commits](https://github.com/varvet/pundit/compare/v2.1.1...v2.2.0)
This commit is contained in:
parent
1183354321
commit
7a6539b262
4 changed files with 5 additions and 5 deletions
|
@ -385,7 +385,7 @@ GEM
|
|||
public_suffix (4.0.6)
|
||||
puma (4.3.11)
|
||||
nio4r (~> 2.0)
|
||||
pundit (2.1.1)
|
||||
pundit (2.2.0)
|
||||
activesupport (>= 3.0.0)
|
||||
pundit-matchers (1.7.0)
|
||||
rspec-rails (>= 3.0.0)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
module ApplicationController::Authorizes
|
||||
extend ActiveSupport::Concern
|
||||
include Pundit
|
||||
include Pundit::Authorization
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ class KnowledgeBase::Public::CategoriesController < KnowledgeBase::Public::BaseC
|
|||
@categories = categories_filter(@knowledge_base.categories.root)
|
||||
@object_locales = find_locales(@knowledge_base)
|
||||
|
||||
authorize(@categories, policy_class: KnowledgeBase::Public::CategoryPolicy)
|
||||
authorize(@categories, policy_class: Controllers::KnowledgeBase::Public::CategoriesControllerPolicy)
|
||||
rescue Pundit::NotAuthorizedError
|
||||
raise ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||
|
||||
class KnowledgeBase::Public::CategoryPolicy < ApplicationPolicy
|
||||
class Controllers::KnowledgeBase::Public::CategoriesControllerPolicy < ApplicationPolicy
|
||||
def index?
|
||||
return true if user&.permissions?('knowledge_base.editor')
|
||||
return true if record.any?
|
||||
return true if record.present?
|
||||
|
||||
false
|
||||
end
|
Loading…
Reference in a new issue