Class: Sys::Admin::Group

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

Overview

The Group class encapsulates information found in /etc/group.

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:



129
130
131
# File 'lib/sys/admin/common.rb', line 129

def initialize
  yield self if block_given?
end

Instance Attribute Details

#captionObject

Short description of the object.



923
924
925
# File 'lib/windows/sys/admin.rb', line 923

def caption
  @caption
end

#descriptionObject

Description of the group.



926
927
928
# File 'lib/windows/sys/admin.rb', line 926

def description
  @description
end

#domainObject

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



929
930
931
# File 'lib/windows/sys/admin.rb', line 929

def domain
  @domain
end

#gidObject

The group ID.



116
117
118
# File 'lib/sys/admin/common.rb', line 116

def gid
  @gid
end

#install_dateObject

Date the group was added.



932
933
934
# File 'lib/windows/sys/admin.rb', line 932

def install_date
  @install_date
end

#local=(value) ⇒ Object (writeonly)

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



947
948
949
# File 'lib/windows/sys/admin.rb', line 947

def local=(value)
  @local = value
end

#membersObject

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



119
120
121
# File 'lib/sys/admin/common.rb', line 119

def members
  @members
end

#nameObject

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



113
114
115
# File 'lib/sys/admin/common.rb', line 113

def name
  @name
end

#passwdObject

The group password, if any.



122
123
124
# File 'lib/sys/admin/common.rb', line 122

def passwd
  @passwd
end

#sidObject

Security identifier for this group.



938
939
940
# File 'lib/windows/sys/admin.rb', line 938

def sid
  @sid
end

#statusObject

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



941
942
943
# File 'lib/windows/sys/admin.rb', line 941

def status
  @status
end

Instance Method Details

#local?Boolean

Returns whether or not the group is a local group.

Returns:

  • (Boolean)


963
964
965
# File 'lib/windows/sys/admin.rb', line 963

def local?
   @local
end

#sid_typeObject

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



969
970
971
# File 'lib/windows/sys/admin.rb', line 969

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



986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
# File 'lib/windows/sys/admin.rb', line 986

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

  @sid_type
end