Skip to content
Daniel Berger edited this page Mar 6, 2016 · 1 revision

Description

The win32-security gem is a wrapper for MS Windows security features. This includes SID's, ACL's and ACE's.

Usage

require 'win32-security'
include Win32
   
sid = Security::SID.open('some_user')
   
sid.valid? # => true
sid.to_s   # => "S-1-5-21-3733855671-1102023144-2002619019-1000"
sid.length # => 28
sid.sid    # => "\001\005\000\000\000\000\000\005\025\000\000\000..."

acl  = Security::ACL.new
mask = Security::ACL::GENERIC_READ | Security::ACL::GENERIC_WRITE

acl.add_access_allowed_ace('some_user', mask)
acl.add_access_denied_ace('some_user', Security::ACL::GENERIC_EXECUTE)

acl.acl_count # => 2
acl.valid?    # => true

Clone this wiki locally