Skip to content

Commit

Permalink
Validate and munge right values
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink committed May 4, 2018
1 parent 19e4527 commit 376895e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/puppet/type/user_right.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@

newparam(:name, :namevar => true) do
desc 'The user right name'

validate do |value|
fail "Invalid right name #{value}" unless value =~ /^[A-Za-z]+$/
end

munge do |value|
value.downcase
end
end

newproperty(:sid, :array_matching => :all) do
Expand Down
8 changes: 8 additions & 0 deletions lib/puppet/type/user_right_assignment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@

newparam(:right) do
desc 'The right to append users to'

validate do |value|
fail "Invalid right name #{value}" unless value =~ /^[A-Za-z]+$/
end

munge do |value|
value.downcase
end
end

newparam(:sid) do
Expand Down

0 comments on commit 376895e

Please sign in to comment.