# 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 194
    def self.included(including_class)
      if RUBY_PLATFORM =~ /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 { |m|
            if m.kind_of?(String)
              m =~ /^0/ || m="0#{m}"
            end

            # Windows does not support the sticky or setuid bits
            if Chef::Platform.windows?
              Integer(m)<=0777 && Integer(m)>=0
            else
              Integer(m)<=07777 && Integer(m)>=0
            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
user(arg=nil)
Alias for: owner