sys-admin 1.7.1 → 1.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.md} +48 -25
- data/Gemfile +3 -0
- data/LICENSE +177 -0
- data/{MANIFEST → MANIFEST.md} +5 -3
- data/README.md +159 -0
- data/Rakefile +2 -2
- data/lib/bsd/sys/admin.rb +13 -7
- data/lib/darwin/sys/admin.rb +14 -7
- data/lib/linux/sys/admin.rb +13 -12
- data/lib/sunos/sys/admin.rb +12 -5
- data/lib/sys/admin.rb +1 -1
- data/lib/sys/admin/common.rb +3 -6
- data/lib/unix/sys/admin.rb +7 -5
- data/lib/windows/sys/admin.rb +13 -10
- data/sys-admin.gemspec +6 -7
- data/test/test_sys_admin.rb +1 -1
- metadata +22 -43
- metadata.gz.sig +0 -0
- data/README +0 -148
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d87741306e11fa28da2582a0c3bd0ba994cbeaea92744afa894bc07e996b975
|
4
|
+
data.tar.gz: 2c2d445e5b58d5298741bb33e1ffdaa12b509e092ea8d5ee1c7139ff6afa84b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de6f1e3e923441b4be9a73c4c9a93509d75a546c7a8b0a9e0681b161fa72332f859d498aa46fee36c60ebdc01c651dca10a89f93d4c3fe198a00eb73f7865d54
|
7
|
+
data.tar.gz: 87375e7a062284f4713accc6e8b9ad245f9d0c66184d614789cef89b9a0e20b6ed1272b9cd8ad7e25f7d118e1100ba4d71f0c69aadead4e4e5b859fc330f84ed
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{CHANGES → CHANGES.md}
RENAMED
@@ -1,30 +1,53 @@
|
|
1
|
-
|
1
|
+
## 1.7.6 - 24-Mar-2021
|
2
|
+
* Changed the implementation for `Admin.get_login` on Linux since the
|
3
|
+
underlying `getlogin` C function is unreliable, especially in certain
|
4
|
+
virtualized environments.
|
5
|
+
* Added win32-security back to the gemspec as a dependency for Windows.
|
6
|
+
I'm not sure why I removed it, and bundler definitely needs it.
|
7
|
+
* Fixed some private access modifiers that weren't actually doing anything.
|
8
|
+
|
9
|
+
## 1.7.5 - 30-Dec-2020
|
10
|
+
* Switched from rdoc to markdown since github isn't rendering rdoc properly.
|
11
|
+
|
12
|
+
## 1.7.4 - 19-Mar-2020
|
13
|
+
* Properly include a LICENSE file as per the Apache-2.0 license.
|
14
|
+
|
15
|
+
## 1.7.3 - 16-Jan-2020
|
16
|
+
* Add explicit .rdoc extension to various rdoc files so that they show up
|
17
|
+
better in github.
|
18
|
+
* Some formatting adjustments to the rdoc files.
|
19
|
+
|
20
|
+
## 1.7.2 - 28-Jan-2019
|
21
|
+
* Fixed the license name, was missing a hyphen.
|
22
|
+
* Fixed the homepage in the gemspec.
|
23
|
+
|
24
|
+
## 1.7.1 - 19-Mar-2018
|
2
25
|
* Fixed deprecation warnings in tests.
|
3
26
|
* Added gemspec metadata.
|
4
27
|
* Updated cert again, this one should last 10 years.
|
5
|
-
|
6
|
-
|
28
|
+
|
29
|
+
## 1.7.0 - 21-Feb-2018
|
7
30
|
* Changed the license to Apache 2.0.
|
8
31
|
* VERSION constant is now frozen.
|
9
32
|
* Ignore dependency warnings in gem:create task.
|
10
33
|
* Minor README updates.
|
11
34
|
* Updated cert.
|
12
35
|
|
13
|
-
|
36
|
+
## 1.6.4 - 6-Sep-2015
|
14
37
|
* Added a sys-admin.rb file for convenience.
|
15
38
|
* Set VERSION in a single place.
|
16
39
|
* Assume Rubygems 2.x for Rakefile tasks.
|
17
40
|
* This gem is now signed.
|
18
41
|
|
19
|
-
|
42
|
+
## 1.6.3 - 8-Mar-2014
|
20
43
|
* The Admin#get_group method now handles groups with very large numbers
|
21
44
|
of members more robustly.
|
22
45
|
|
23
|
-
|
46
|
+
## 1.6.2 - 11-Feb-2014
|
24
47
|
* The User#gid method is now supported on MS Windows. It returns the user's
|
25
48
|
primary group ID.
|
26
49
|
|
27
|
-
|
50
|
+
## 1.6.1 - 24-Jan-2014
|
28
51
|
* Added the Admin.add_group_member and Admin.remove_group member methods. These
|
29
52
|
let you add a user to a specific group. Thanks go to Alexey Kolyanov for the
|
30
53
|
idea and the code.
|
@@ -34,7 +57,7 @@
|
|
34
57
|
* Updated the gem:create task in the Rakefile.
|
35
58
|
* Added rake as a development dependency.
|
36
59
|
|
37
|
-
|
60
|
+
## 1.6.0 - 5-Jan-2013
|
38
61
|
* Converted code to use FFI. This mostly only affects the unix flavors.
|
39
62
|
* The Admin.users and Admin.groups methods no longer accept a block.
|
40
63
|
* Some test suite updates.
|
@@ -42,13 +65,13 @@
|
|
42
65
|
separate gems. There is now a single, unified gem that works on all
|
43
66
|
supported platforms.
|
44
67
|
|
45
|
-
|
68
|
+
## 1.5.6 - 30-Jul-2011
|
46
69
|
* Fixed issue for non-gnu platforms where it would use the wrong function
|
47
70
|
prototype because the Ruby core team took it upon themselves to explicitly
|
48
71
|
defined _GNU_SOURCE in config.h in 1.8.7 and later for reasons that baffle me.
|
49
72
|
* Some tests on Windows are now skipped unless run with elevated security.
|
50
73
|
|
51
|
-
|
74
|
+
## 1.5.5 - 5-Jul-2011
|
52
75
|
* Modified lastlog handling, and ignore getpwent_r and getgrent_r, on AIX.
|
53
76
|
Thanks go to Rick Ohnemus for the spot and patches.
|
54
77
|
* Explicitly set spec.cpu on Windows to 'universal' in the gem creation task.
|
@@ -56,21 +79,21 @@
|
|
56
79
|
being generated was incorrect if no options were passed. Thanks go to
|
57
80
|
Matthew Brown for the spot.
|
58
81
|
|
59
|
-
|
82
|
+
## 1.5.4 - 7-Oct-2010
|
60
83
|
* Prefer the getlastlogx() function over lastlog() where supported.
|
61
84
|
|
62
|
-
|
85
|
+
## 1.5.3 - 6-Oct-2010
|
63
86
|
* Refactored the Rakefile. The old installation tasks have been replaced
|
64
87
|
with gem build and install tasks. In addition, the platform handling has
|
65
88
|
been updated for MS Windows.
|
66
89
|
* Portions of the gemspec have been moved into the Rakefile gem tasks.
|
67
90
|
* Deploying the mingw gem by default for MS Windows now.
|
68
91
|
|
69
|
-
|
92
|
+
## 1.5.2 - 2-Aug-2009
|
70
93
|
* Now compatible with Ruby 1.9.x.
|
71
94
|
* Added test-unit as a development dependency.
|
72
95
|
|
73
|
-
|
96
|
+
## 1.5.1 - 23-Jul-2009
|
74
97
|
* Added the User#dir attribute. This attribute contains a user's home
|
75
98
|
directory if set, or nil if it isn't.
|
76
99
|
* User objects returned by the Admin.users method now include the uid.
|
@@ -78,7 +101,7 @@
|
|
78
101
|
* Added win32-security as a dependency.
|
79
102
|
* Changed license to Artistic 2.0.
|
80
103
|
|
81
|
-
|
104
|
+
## 1.5.0 - 29-Mar-2009
|
82
105
|
* INTERFACE CHANGE (WINDOWS ONLY): The interface for MS Windows has undergone
|
83
106
|
a radical change. Most methods now accept a hash of options that are
|
84
107
|
passed directly to the underlying WMI class. Please see the documentation
|
@@ -95,14 +118,14 @@
|
|
95
118
|
get lastlog information even if the lastlog.h or utmp.h headers couldn't
|
96
119
|
be found.
|
97
120
|
|
98
|
-
|
121
|
+
## 1.4.4 - 19-Nov-2008
|
99
122
|
* Added the User#uid method for MS Windows (which is just the user's relative
|
100
123
|
identifier).
|
101
124
|
* Now requires test-unit 2.x.
|
102
125
|
* Some updates to the test suite to take advantage of test-unit 2.x features.
|
103
126
|
* Some minor gemspec tweaks.
|
104
127
|
|
105
|
-
|
128
|
+
## 1.4.3 - 2-Mar-2008
|
106
129
|
* The block form of Admin.users now properly ensures that endpwent() is
|
107
130
|
called. Likewise, the block form of Admin.groups now properly ensures
|
108
131
|
that endgrent() is called. This would only have been an issue if you
|
@@ -110,7 +133,7 @@
|
|
110
133
|
* The AdminError class is now Admin::Error.
|
111
134
|
* Some internal directory layout changes.
|
112
135
|
|
113
|
-
|
136
|
+
## 1.4.2 - 26-Jun-2007
|
114
137
|
* Fixed a bug in the Admin.get_login method where it would return junk
|
115
138
|
if the underlying getlogin() function failed (Unix). Thanks go to Gonzalo
|
116
139
|
Garramuno for the spot. This bug also resulted in some refactoring of the
|
@@ -118,13 +141,13 @@
|
|
118
141
|
* Removed the install.rb file. The logic in that file has been moved directly
|
119
142
|
into the Rakefile.
|
120
143
|
|
121
|
-
|
144
|
+
## 1.4.1 - 21-Mar-2007
|
122
145
|
* Bug fix for OS X. Thanks go to an anonymous user for the spot.
|
123
146
|
* Added a Rakefile. Building, testing and installing should now use the
|
124
147
|
Rake tasks (for non-gem installs).
|
125
148
|
* Much more inline documentation, especially for User and Group attributes.
|
126
149
|
|
127
|
-
|
150
|
+
## 1.4.0 - 20-Jan-2007
|
128
151
|
* Added the following methods: add_local_user, config_local_user,
|
129
152
|
delete_local_user, add_global_group, config_global_group, and
|
130
153
|
delete_global_group. MS Windows only at the moment.
|
@@ -140,18 +163,18 @@
|
|
140
163
|
integer.
|
141
164
|
* Renamed tc_win32.rb to tc_windows.rb
|
142
165
|
|
143
|
-
|
166
|
+
## 1.3.1 - 29-Jun-2005
|
144
167
|
* Fixed a bug where the inability to read the lastlog file caused an error.
|
145
168
|
From now on that error is ignored, and the lastlog attributes of the User
|
146
169
|
object are set to nil.
|
147
170
|
* Added a beta version of Admin.delete_user (Windows only).
|
148
171
|
|
149
|
-
|
172
|
+
## 1.3.0 - 3-Jun-2005
|
150
173
|
* Bug fixes for Linux.
|
151
174
|
* Removed the version.h file - no longer needed since the Win32 version is
|
152
175
|
pure Ruby.
|
153
176
|
|
154
|
-
|
177
|
+
## 1.2.0 - 30-Apr-2005
|
155
178
|
* Replaced the Win32 version with a pure Ruby version that uses Win32API and
|
156
179
|
win32ole + WMI.
|
157
180
|
* The LocalGroup class no longer exists in the Win32 version. Instead, it is
|
@@ -161,7 +184,7 @@
|
|
161
184
|
over global accounts.
|
162
185
|
* Corresponding doc changes and test suite changes.
|
163
186
|
|
164
|
-
|
187
|
+
## 1.1.0 - 1-Apr-2005
|
165
188
|
* Fixed bug where a segfault could occur when trying to retrieve a user or
|
166
189
|
group by an ID that didn't exist (Unix).
|
167
190
|
* Added tests for intentional failures.
|
@@ -169,5 +192,5 @@
|
|
169
192
|
* Modified the way User objects are created internally (Unix).
|
170
193
|
* Fixed a bug in the User#shell attribute (Unix).
|
171
194
|
|
172
|
-
|
195
|
+
## 1.0.0 - 25-Mar-2005
|
173
196
|
* Initial release
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/{MANIFEST → MANIFEST.md}
RENAMED
data/README.md
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
## Description
|
2
|
+
The sys-admin library is a unified, cross platform replacement for the Etc module.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
`gem install sys-admin`
|
6
|
+
|
7
|
+
## Synopsis
|
8
|
+
```ruby
|
9
|
+
require 'sys/admin' # or sys-admin
|
10
|
+
include Sys
|
11
|
+
|
12
|
+
# Returns an Array of User objects
|
13
|
+
a = Admin.users
|
14
|
+
|
15
|
+
# Returns an Array of Group objects
|
16
|
+
g = Admin.groups
|
17
|
+
|
18
|
+
# Get information about a particular user
|
19
|
+
p Admin.get_user("nobody")
|
20
|
+
p Admin.get_user("nobody", :localaccount => true)
|
21
|
+
|
22
|
+
# Get information about a particular group
|
23
|
+
p Admin.get_group("adm")
|
24
|
+
p Admin.get_group("adm", :localaccount => true)
|
25
|
+
```
|
26
|
+
|
27
|
+
## Admin
|
28
|
+
`Admin.get_login`
|
29
|
+
|
30
|
+
Returns the user name (only) of the current login.
|
31
|
+
|
32
|
+
```
|
33
|
+
Admin.get_user(name, options = {})
|
34
|
+
Admin.get_user(uid, options = {})
|
35
|
+
```
|
36
|
+
|
37
|
+
Returns a User object based on `name` or `uid`. The `options` hash is
|
38
|
+
for MS Windows only, and allows you to restrict the search based on the
|
39
|
+
options you provide, e.g. 'domain' or 'localaccount'.
|
40
|
+
|
41
|
+
```
|
42
|
+
Admin.get_group(name, options = {})
|
43
|
+
Admin.get_group(gid, options = {})
|
44
|
+
```
|
45
|
+
|
46
|
+
Returns a Group object based on `name` or `uid`. The `options` hash is
|
47
|
+
for MS Windows only, and allows you to restrict the search based on the
|
48
|
+
options you provide, e.g. 'domain' or 'localaccount'.
|
49
|
+
|
50
|
+
`Admin.groups(options = {})`
|
51
|
+
|
52
|
+
Returns an Array of Group objects.
|
53
|
+
|
54
|
+
The `options` hash is for MS Windows only, and allows you to restrict the
|
55
|
+
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
56
|
+
|
57
|
+
`Admin.users(options = {})`
|
58
|
+
|
59
|
+
Returns an Array of User objects.
|
60
|
+
|
61
|
+
The `options` hash is for MS Windows only, and allows you to restrict the
|
62
|
+
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
63
|
+
|
64
|
+
## User class
|
65
|
+
### User (Windows)
|
66
|
+
The User class has the following attributes on MS Windows systems:
|
67
|
+
|
68
|
+
* account_type
|
69
|
+
* caption
|
70
|
+
* description
|
71
|
+
* domain
|
72
|
+
* password
|
73
|
+
* full_name
|
74
|
+
* gid
|
75
|
+
* install_date
|
76
|
+
* name
|
77
|
+
* sid
|
78
|
+
* status
|
79
|
+
* disabled?
|
80
|
+
* local?
|
81
|
+
* lockout?
|
82
|
+
* password_changeable?
|
83
|
+
* password_expires?
|
84
|
+
* password_required?
|
85
|
+
* uid
|
86
|
+
|
87
|
+
### User (Unix)
|
88
|
+
The User class has the following attributes on Unix systems:
|
89
|
+
|
90
|
+
* name
|
91
|
+
* passwd
|
92
|
+
* uid
|
93
|
+
* gid
|
94
|
+
* dir
|
95
|
+
* shell
|
96
|
+
* gecos
|
97
|
+
* quota
|
98
|
+
* age
|
99
|
+
* class
|
100
|
+
* comment
|
101
|
+
* change
|
102
|
+
* expire
|
103
|
+
|
104
|
+
## Group Classes
|
105
|
+
### Group (Windows)
|
106
|
+
The Group class has the following attributes on MS Windows systems:
|
107
|
+
|
108
|
+
* caption
|
109
|
+
* description
|
110
|
+
* domain
|
111
|
+
* install_date
|
112
|
+
* name
|
113
|
+
* sid
|
114
|
+
* status
|
115
|
+
* gid
|
116
|
+
* local?
|
117
|
+
|
118
|
+
### Group (Unix)
|
119
|
+
The Group class has the following attributes on Unix systems:
|
120
|
+
|
121
|
+
* name
|
122
|
+
* gid
|
123
|
+
* members
|
124
|
+
* passwd
|
125
|
+
|
126
|
+
## Error Classes
|
127
|
+
`Admin::Error < StandardError`
|
128
|
+
|
129
|
+
Raised if anything goes wrong with any of the above methods.
|
130
|
+
|
131
|
+
## Developer's Notes
|
132
|
+
### MS Windows
|
133
|
+
The Windows version now uses a win32ole + WMI approach to getting
|
134
|
+
information. This means that the WMI service must be running on the
|
135
|
+
target machine in order to work (which it is, by default).
|
136
|
+
|
137
|
+
### UNIX
|
138
|
+
The underlying implementation is similar to core Ruby's Etc implementation.
|
139
|
+
But, in addition to the different interface, I use the re-entrant version
|
140
|
+
of the appropriate functions when available.
|
141
|
+
|
142
|
+
## Future Plans
|
143
|
+
* Make the User and Group objects comparable.
|
144
|
+
* Add ability to add, configure and delete users on Unix platforms.
|
145
|
+
|
146
|
+
## Known Bugs
|
147
|
+
None that I'm aware of. If you find any, please log them on the project page at:
|
148
|
+
|
149
|
+
https://github.com/djberg96/sys-admin
|
150
|
+
|
151
|
+
## License
|
152
|
+
Apache-2.0
|
153
|
+
|
154
|
+
## Copyright
|
155
|
+
(C) 2005-2020, Daniel J. Berger
|
156
|
+
All Rights Reserved
|
157
|
+
|
158
|
+
## Author
|
159
|
+
Daniel J. Berger
|