Class: Sys::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/windows/sys/admin.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Group

Creates and returns a new Group object. This class encapsulates the information for a group account, whether it be global or local.

Yields self if a block is given.

Yields:

  • (_self)

Yield Parameters:

  • _self (Sys::Group)

    the object that the method was called on



44
45
46
# File 'lib/windows/sys/admin.rb', line 44

def initialize
  yield self if block_given?
end

Instance Attribute Details

#captionObject

Short description of the object.



10
11
12
# File 'lib/windows/sys/admin.rb', line 10

def caption
  @caption
end

#descriptionObject

Description of the group.



13
14
15
# File 'lib/windows/sys/admin.rb', line 13

def description
  @description
end

#domainObject

Name of the Windows domain to which the group account belongs.



16
17
18
# File 'lib/windows/sys/admin.rb', line 16

def domain
  @domain
end

#gidObject

The group ID.



31
32
33
# File 'lib/windows/sys/admin.rb', line 31

def gid
  @gid
end

#install_dateObject

Date the group was added.



19
20
21
# File 'lib/windows/sys/admin.rb', line 19

def install_date
  @install_date
end

#local=(value) ⇒ Object (writeonly)

Sets whether or not the group is local (as opposed to global).



34
35
36
# File 'lib/windows/sys/admin.rb', line 34

def local=(value)
  @local = value
end

#membersObject

An array of members for that group. May contain SID’s.



37
38
39
# File 'lib/windows/sys/admin.rb', line 37

def members
  @members
end

#nameObject

Name of the Windows group account on the Group#domain specified.



22
23
24
# File 'lib/windows/sys/admin.rb', line 22

def name
  @name
end

#sidObject

Security identifier for this group.



25
26
27
# File 'lib/windows/sys/admin.rb', line 25

def sid
  @sid
end

#statusObject

Current status for the group, such as “ok”, “error”, etc.



28
29
30
# File 'lib/windows/sys/admin.rb', line 28

def status
  @status
end

Instance Method Details

#local?Boolean

Returns whether or not the group is a local group.

Returns:

  • (Boolean)


50
51
52
# File 'lib/windows/sys/admin.rb', line 50

def local?
   @local
end

#sid_typeObject

Returns the type of SID (Security Identifier) as a stringified value.



56
57
58
# File 'lib/windows/sys/admin.rb', line 56

def sid_type
   @sid_type
end

#sid_type=(stype) ⇒ Object

Sets the SID (Security Identifier) type to stype, which can be one of the following constant values:

  • Admin::SidTypeUser

  • Admin::SidTypeGroup

  • Admin::SidTypeDomain

  • Admin::SidTypeAlias

  • Admin::SidTypeWellKnownGroup

  • Admin::SidTypeDeletedAccount

  • Admin::SidTypeInvalid

  • Admin::SidTypeUnknown

  • Admin::SidTypeComputer



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/windows/sys/admin.rb', line 73

def sid_type=(stype)
  if stype.kind_of?(String)
    @sid_type = stype.downcase
  else
    case stype
       when Admin::SidTypeUser
          @sid_type = "user"
       when Admin::SidTypeGroup
          @sid_type = "group"
       when Admin::SidTypeDomain
          @sid_type = "domain"
       when Admin::SidTypeAlias
          @sid_type = "alias"
       when Admin::SidTypeWellKnownGroup
          @sid_type = "well_known_group"
       when Admin::SidTypeDeletedAccount
          @sid_type = "deleted_account"
       when Admin::SidTypeInvalid
          @sid_type = "invalid"
       when Admin::SidTypeUnknown
          @sid_type = "unknown"
       when Admin::SidTypeComputer
          @sid_type = "computer"
       else
          @sid_type = "unknown"
    end
  end
end