blob: 7c484727994166d9397d32a682c9e98b8eeae566 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
require 'active_model/mass_assignment_security/sanitizer'
module ActiveModel
module MassAssignmentSecurity
class PermissionSet < Set
attr_accessor :logger
def +(values)
super(values.map(&:to_s))
end
def include?(key)
super(remove_multiparameter_id(key))
end
protected
def remove_multiparameter_id(key)
key.to_s.gsub(/\(.+/, '')
end
end
class WhiteList < PermissionSet
include Sanitizer
def deny?(key)
!include?(key)
end
end
class BlackList < PermissionSet
include Sanitizer
def deny?(key)
include?(key)
end
end
end
end
|