module Chef::Mixin::Securable
Public Class Methods
included(including_class)
click to toggle source
Callback that fires when included; will extend the including class with WindowsMacros
and define rights and deny_rights on it.
# File lib/chef/mixin/securable.rb, line 181 def self.included(including_class) if RUBY_PLATFORM.match?(/mswin|mingw|windows/) including_class.extend(WindowsMacros) # create a default 'rights' attribute including_class.rights_attribute(:rights) including_class.rights_attribute(:deny_rights) end end
Public Instance Methods
group(arg = nil)
click to toggle source
# File lib/chef/mixin/securable.rb, line 33 def group(arg = nil) set_or_return( :group, arg, regex: Chef::Config[:group_valid_regex] ) end
mode(arg = nil)
click to toggle source
# File lib/chef/mixin/securable.rb, line 41 def mode(arg = nil) set_or_return( :mode, arg, callbacks: { "not in valid numeric range" => lambda do |m| if m.is_a?(String) m =~ /^0/ || m = "0#{m}" end # Windows does not support the sticky or setuid bits if ChefUtils.windows? Integer(m) <= 0777 && Integer(m) >= 0 else Integer(m) <= 07777 && Integer(m) >= 0 end end, } ) end
owner(arg = nil)
click to toggle source
# File lib/chef/mixin/securable.rb, line 23 def owner(arg = nil) set_or_return( :owner, arg, regex: Chef::Config[:user_valid_regex] ) end
Also aliased as: user