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)
|
public_suffix (4.0.6)
|
||||||
puma (4.3.11)
|
puma (4.3.11)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
pundit (2.1.1)
|
pundit (2.2.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
pundit-matchers (1.7.0)
|
pundit-matchers (1.7.0)
|
||||||
rspec-rails (>= 3.0.0)
|
rspec-rails (>= 3.0.0)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module ApplicationController::Authorizes
|
module ApplicationController::Authorizes
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
include Pundit
|
include Pundit::Authorization
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ class KnowledgeBase::Public::CategoriesController < KnowledgeBase::Public::BaseC
|
||||||
@categories = categories_filter(@knowledge_base.categories.root)
|
@categories = categories_filter(@knowledge_base.categories.root)
|
||||||
@object_locales = find_locales(@knowledge_base)
|
@object_locales = find_locales(@knowledge_base)
|
||||||
|
|
||||||
authorize(@categories, policy_class: KnowledgeBase::Public::CategoryPolicy)
|
authorize(@categories, policy_class: Controllers::KnowledgeBase::Public::CategoriesControllerPolicy)
|
||||||
rescue Pundit::NotAuthorizedError
|
rescue Pundit::NotAuthorizedError
|
||||||
raise ActiveRecord::RecordNotFound
|
raise ActiveRecord::RecordNotFound
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
||||||
|
|
||||||
class KnowledgeBase::Public::CategoryPolicy < ApplicationPolicy
|
class Controllers::KnowledgeBase::Public::CategoriesControllerPolicy < ApplicationPolicy
|
||||||
def index?
|
def index?
|
||||||
return true if user&.permissions?('knowledge_base.editor')
|
return true if user&.permissions?('knowledge_base.editor')
|
||||||
return true if record.any?
|
return true if record.present?
|
||||||
|
|
||||||
false
|
false
|
||||||
end
|
end
|
Loading…
Reference in a new issue