Add attribute ApplicationPolicy::Context#params
This commit is contained in:
parent
cae534bc71
commit
5445ac9c6f
2 changed files with 12 additions and 2 deletions
|
@ -24,6 +24,7 @@ private
|
||||||
def pundit_user
|
def pundit_user
|
||||||
@pundit_user ||= ApplicationPolicy::Context.new(
|
@pundit_user ||= ApplicationPolicy::Context.new(
|
||||||
account: current_account,
|
account: current_account,
|
||||||
|
params: params,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,10 @@ private
|
||||||
context&.account
|
context&.account
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def params
|
||||||
|
context&.params
|
||||||
|
end
|
||||||
|
|
||||||
def restricted?
|
def restricted?
|
||||||
Rails.application.restricted?
|
Rails.application.restricted?
|
||||||
end
|
end
|
||||||
|
@ -76,16 +80,21 @@ private
|
||||||
context&.account
|
context&.account
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def params
|
||||||
|
context&.params
|
||||||
|
end
|
||||||
|
|
||||||
def restricted?
|
def restricted?
|
||||||
Rails.application.restricted?
|
Rails.application.restricted?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class Context
|
class Context
|
||||||
attr_reader :account
|
attr_reader :account, :params
|
||||||
|
|
||||||
def initialize(account:)
|
def initialize(account:, params:)
|
||||||
@account = account
|
@account = account
|
||||||
|
@params = params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue