sys-admin 1.7.3 → 1.8.0
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/{CHANGES.rdoc → CHANGES.md} +48 -26
- data/Gemfile +2 -0
- data/LICENSE +177 -0
- data/{MANIFEST.rdoc → MANIFEST.md} +5 -3
- data/{README.rdoc → README.md} +53 -44
- data/Rakefile +15 -18
- data/lib/bsd/sys/admin.rb +13 -7
- data/lib/darwin/sys/admin.rb +14 -7
- data/lib/linux/sys/admin.rb +13 -14
- data/lib/sunos/sys/admin.rb +12 -5
- data/lib/sys/admin/common.rb +3 -6
- data/lib/sys/admin.rb +1 -1
- data/lib/unix/sys/admin.rb +7 -5
- data/lib/windows/sys/admin.rb +324 -303
- data/spec/sys_admin_unix_spec.rb +262 -0
- data/spec/sys_admin_windows_spec.rb +350 -0
- data/sys-admin.gemspec +10 -5
- data.tar.gz.sig +0 -0
- metadata +37 -57
- metadata.gz.sig +0 -0
- data/test/test_sys_admin.rb +0 -23
- data/test/test_sys_admin_unix.rb +0 -260
- data/test/test_sys_admin_windows.rb +0 -337
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72d00ed279d1871b324cf2819ba90432093b8063a30e0bbdc9fa66111b588538
|
4
|
+
data.tar.gz: 31bc4f2515a391ba43c1bc9ce0b3bdeffacd6d758b7e98a29a111ced2ab14e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36c4dc086a9929e998695ed02ce9cb89b5bd487cc4cb42aacccc26aab8a3fa3f62fde29a2bbb0792fd6657278fbe874e3366e3dc08a29c2ebc99e087bb1ea939
|
7
|
+
data.tar.gz: 3f9c593cd1b2008966524683d511c1c5e7e6ada91298516adc46afe948dd39cad7da069b426f268376493e6eb28934f020d55be60c73fca2bb756cf885d1e245
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/{CHANGES.rdoc → CHANGES.md}
RENAMED
@@ -1,39 +1,61 @@
|
|
1
|
-
|
1
|
+
## 1.8.0 - 26-Aug-2021
|
2
|
+
* Switched from test-unit to rspec, with some tests refactored. The Rakefile
|
3
|
+
and gemspec files were updated accordingly.
|
4
|
+
* The User and Group classes for the Windows implementation are now properly
|
5
|
+
scoped under Sys::Admin instead of just Sys.
|
6
|
+
* Fixed a bug in the get_user and get_group methods on Winodws where the WQL
|
7
|
+
it generates internally might not be correct.
|
8
|
+
|
9
|
+
## 1.7.6 - 24-Mar-2021
|
10
|
+
* Changed the implementation for `Admin.get_login` on Linux since the
|
11
|
+
underlying `getlogin` C function is unreliable, especially in certain
|
12
|
+
virtualized environments.
|
13
|
+
* Added win32-security back to the gemspec as a dependency for Windows.
|
14
|
+
I'm not sure why I removed it, and bundler definitely needs it.
|
15
|
+
* Fixed some private access modifiers that weren't actually doing anything.
|
16
|
+
|
17
|
+
## 1.7.5 - 30-Dec-2020
|
18
|
+
* Switched from rdoc to markdown since github isn't rendering rdoc properly.
|
19
|
+
|
20
|
+
## 1.7.4 - 19-Mar-2020
|
21
|
+
* Properly include a LICENSE file as per the Apache-2.0 license.
|
22
|
+
|
23
|
+
## 1.7.3 - 16-Jan-2020
|
2
24
|
* Add explicit .rdoc extension to various rdoc files so that they show up
|
3
25
|
better in github.
|
4
26
|
* Some formatting adjustments to the rdoc files.
|
5
27
|
|
6
|
-
|
28
|
+
## 1.7.2 - 28-Jan-2019
|
7
29
|
* Fixed the license name, was missing a hyphen.
|
8
30
|
* Fixed the homepage in the gemspec.
|
9
31
|
|
10
|
-
|
32
|
+
## 1.7.1 - 19-Mar-2018
|
11
33
|
* Fixed deprecation warnings in tests.
|
12
34
|
* Added gemspec metadata.
|
13
35
|
* Updated cert again, this one should last 10 years.
|
14
36
|
|
15
|
-
|
37
|
+
## 1.7.0 - 21-Feb-2018
|
16
38
|
* Changed the license to Apache 2.0.
|
17
39
|
* VERSION constant is now frozen.
|
18
40
|
* Ignore dependency warnings in gem:create task.
|
19
41
|
* Minor README updates.
|
20
42
|
* Updated cert.
|
21
43
|
|
22
|
-
|
44
|
+
## 1.6.4 - 6-Sep-2015
|
23
45
|
* Added a sys-admin.rb file for convenience.
|
24
46
|
* Set VERSION in a single place.
|
25
47
|
* Assume Rubygems 2.x for Rakefile tasks.
|
26
48
|
* This gem is now signed.
|
27
49
|
|
28
|
-
|
50
|
+
## 1.6.3 - 8-Mar-2014
|
29
51
|
* The Admin#get_group method now handles groups with very large numbers
|
30
52
|
of members more robustly.
|
31
53
|
|
32
|
-
|
54
|
+
## 1.6.2 - 11-Feb-2014
|
33
55
|
* The User#gid method is now supported on MS Windows. It returns the user's
|
34
56
|
primary group ID.
|
35
57
|
|
36
|
-
|
58
|
+
## 1.6.1 - 24-Jan-2014
|
37
59
|
* Added the Admin.add_group_member and Admin.remove_group member methods. These
|
38
60
|
let you add a user to a specific group. Thanks go to Alexey Kolyanov for the
|
39
61
|
idea and the code.
|
@@ -43,7 +65,7 @@
|
|
43
65
|
* Updated the gem:create task in the Rakefile.
|
44
66
|
* Added rake as a development dependency.
|
45
67
|
|
46
|
-
|
68
|
+
## 1.6.0 - 5-Jan-2013
|
47
69
|
* Converted code to use FFI. This mostly only affects the unix flavors.
|
48
70
|
* The Admin.users and Admin.groups methods no longer accept a block.
|
49
71
|
* Some test suite updates.
|
@@ -51,13 +73,13 @@
|
|
51
73
|
separate gems. There is now a single, unified gem that works on all
|
52
74
|
supported platforms.
|
53
75
|
|
54
|
-
|
76
|
+
## 1.5.6 - 30-Jul-2011
|
55
77
|
* Fixed issue for non-gnu platforms where it would use the wrong function
|
56
78
|
prototype because the Ruby core team took it upon themselves to explicitly
|
57
79
|
defined _GNU_SOURCE in config.h in 1.8.7 and later for reasons that baffle me.
|
58
80
|
* Some tests on Windows are now skipped unless run with elevated security.
|
59
81
|
|
60
|
-
|
82
|
+
## 1.5.5 - 5-Jul-2011
|
61
83
|
* Modified lastlog handling, and ignore getpwent_r and getgrent_r, on AIX.
|
62
84
|
Thanks go to Rick Ohnemus for the spot and patches.
|
63
85
|
* Explicitly set spec.cpu on Windows to 'universal' in the gem creation task.
|
@@ -65,21 +87,21 @@
|
|
65
87
|
being generated was incorrect if no options were passed. Thanks go to
|
66
88
|
Matthew Brown for the spot.
|
67
89
|
|
68
|
-
|
90
|
+
## 1.5.4 - 7-Oct-2010
|
69
91
|
* Prefer the getlastlogx() function over lastlog() where supported.
|
70
92
|
|
71
|
-
|
93
|
+
## 1.5.3 - 6-Oct-2010
|
72
94
|
* Refactored the Rakefile. The old installation tasks have been replaced
|
73
95
|
with gem build and install tasks. In addition, the platform handling has
|
74
96
|
been updated for MS Windows.
|
75
97
|
* Portions of the gemspec have been moved into the Rakefile gem tasks.
|
76
98
|
* Deploying the mingw gem by default for MS Windows now.
|
77
99
|
|
78
|
-
|
100
|
+
## 1.5.2 - 2-Aug-2009
|
79
101
|
* Now compatible with Ruby 1.9.x.
|
80
102
|
* Added test-unit as a development dependency.
|
81
103
|
|
82
|
-
|
104
|
+
## 1.5.1 - 23-Jul-2009
|
83
105
|
* Added the User#dir attribute. This attribute contains a user's home
|
84
106
|
directory if set, or nil if it isn't.
|
85
107
|
* User objects returned by the Admin.users method now include the uid.
|
@@ -87,7 +109,7 @@
|
|
87
109
|
* Added win32-security as a dependency.
|
88
110
|
* Changed license to Artistic 2.0.
|
89
111
|
|
90
|
-
|
112
|
+
## 1.5.0 - 29-Mar-2009
|
91
113
|
* INTERFACE CHANGE (WINDOWS ONLY): The interface for MS Windows has undergone
|
92
114
|
a radical change. Most methods now accept a hash of options that are
|
93
115
|
passed directly to the underlying WMI class. Please see the documentation
|
@@ -104,14 +126,14 @@
|
|
104
126
|
get lastlog information even if the lastlog.h or utmp.h headers couldn't
|
105
127
|
be found.
|
106
128
|
|
107
|
-
|
129
|
+
## 1.4.4 - 19-Nov-2008
|
108
130
|
* Added the User#uid method for MS Windows (which is just the user's relative
|
109
131
|
identifier).
|
110
132
|
* Now requires test-unit 2.x.
|
111
133
|
* Some updates to the test suite to take advantage of test-unit 2.x features.
|
112
134
|
* Some minor gemspec tweaks.
|
113
135
|
|
114
|
-
|
136
|
+
## 1.4.3 - 2-Mar-2008
|
115
137
|
* The block form of Admin.users now properly ensures that endpwent() is
|
116
138
|
called. Likewise, the block form of Admin.groups now properly ensures
|
117
139
|
that endgrent() is called. This would only have been an issue if you
|
@@ -119,7 +141,7 @@
|
|
119
141
|
* The AdminError class is now Admin::Error.
|
120
142
|
* Some internal directory layout changes.
|
121
143
|
|
122
|
-
|
144
|
+
## 1.4.2 - 26-Jun-2007
|
123
145
|
* Fixed a bug in the Admin.get_login method where it would return junk
|
124
146
|
if the underlying getlogin() function failed (Unix). Thanks go to Gonzalo
|
125
147
|
Garramuno for the spot. This bug also resulted in some refactoring of the
|
@@ -127,13 +149,13 @@
|
|
127
149
|
* Removed the install.rb file. The logic in that file has been moved directly
|
128
150
|
into the Rakefile.
|
129
151
|
|
130
|
-
|
152
|
+
## 1.4.1 - 21-Mar-2007
|
131
153
|
* Bug fix for OS X. Thanks go to an anonymous user for the spot.
|
132
154
|
* Added a Rakefile. Building, testing and installing should now use the
|
133
155
|
Rake tasks (for non-gem installs).
|
134
156
|
* Much more inline documentation, especially for User and Group attributes.
|
135
157
|
|
136
|
-
|
158
|
+
## 1.4.0 - 20-Jan-2007
|
137
159
|
* Added the following methods: add_local_user, config_local_user,
|
138
160
|
delete_local_user, add_global_group, config_global_group, and
|
139
161
|
delete_global_group. MS Windows only at the moment.
|
@@ -149,18 +171,18 @@
|
|
149
171
|
integer.
|
150
172
|
* Renamed tc_win32.rb to tc_windows.rb
|
151
173
|
|
152
|
-
|
174
|
+
## 1.3.1 - 29-Jun-2005
|
153
175
|
* Fixed a bug where the inability to read the lastlog file caused an error.
|
154
176
|
From now on that error is ignored, and the lastlog attributes of the User
|
155
177
|
object are set to nil.
|
156
178
|
* Added a beta version of Admin.delete_user (Windows only).
|
157
179
|
|
158
|
-
|
180
|
+
## 1.3.0 - 3-Jun-2005
|
159
181
|
* Bug fixes for Linux.
|
160
182
|
* Removed the version.h file - no longer needed since the Win32 version is
|
161
183
|
pure Ruby.
|
162
184
|
|
163
|
-
|
185
|
+
## 1.2.0 - 30-Apr-2005
|
164
186
|
* Replaced the Win32 version with a pure Ruby version that uses Win32API and
|
165
187
|
win32ole + WMI.
|
166
188
|
* The LocalGroup class no longer exists in the Win32 version. Instead, it is
|
@@ -170,7 +192,7 @@
|
|
170
192
|
over global accounts.
|
171
193
|
* Corresponding doc changes and test suite changes.
|
172
194
|
|
173
|
-
|
195
|
+
## 1.1.0 - 1-Apr-2005
|
174
196
|
* Fixed bug where a segfault could occur when trying to retrieve a user or
|
175
197
|
group by an ID that didn't exist (Unix).
|
176
198
|
* Added tests for intentional failures.
|
@@ -178,5 +200,5 @@
|
|
178
200
|
* Modified the way User objects are created internally (Unix).
|
179
201
|
* Fixed a bug in the User#shell attribute (Unix).
|
180
202
|
|
181
|
-
|
203
|
+
## 1.0.0 - 25-Mar-2005
|
182
204
|
* 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/{README.rdoc → README.md}
RENAMED
@@ -1,62 +1,71 @@
|
|
1
|
-
|
1
|
+
## Description
|
2
2
|
The sys-admin library is a unified, cross platform replacement for the Etc module.
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
## Installation
|
5
|
+
`gem install sys-admin`
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
include Sys
|
7
|
+
## Adding the trusted cert
|
8
|
+
`gem cert --add <(curl -Ls https://raw.githubusercontent.com/djberg96/sys-admin/main/certs/djberg96_pub.pem)`
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
## Synopsis
|
11
|
+
```ruby
|
12
|
+
require 'sys/admin' # or sys-admin
|
13
|
+
include Sys
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
# Returns an Array of User objects
|
16
|
+
a = Admin.users
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
p Admin.get_user("nobody", :localaccount => true)
|
18
|
+
# Returns an Array of Group objects
|
19
|
+
g = Admin.groups
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
# Get information about a particular user
|
22
|
+
p Admin.get_user("nobody")
|
23
|
+
p Admin.get_user("nobody", :localaccount => true)
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
# Get information about a particular group
|
26
|
+
p Admin.get_group("adm")
|
27
|
+
p Admin.get_group("adm", :localaccount => true)
|
28
|
+
```
|
29
|
+
|
30
|
+
## Admin
|
31
|
+
`Admin.get_login`
|
27
32
|
|
28
33
|
Returns the user name (only) of the current login.
|
29
34
|
|
30
|
-
|
31
|
-
|
35
|
+
```
|
36
|
+
Admin.get_user(name, options = {})
|
37
|
+
Admin.get_user(uid, options = {})
|
38
|
+
```
|
32
39
|
|
33
|
-
Returns a User object based on
|
40
|
+
Returns a User object based on `name` or `uid`. The `options` hash is
|
34
41
|
for MS Windows only, and allows you to restrict the search based on the
|
35
42
|
options you provide, e.g. 'domain' or 'localaccount'.
|
36
43
|
|
37
|
-
|
38
|
-
|
44
|
+
```
|
45
|
+
Admin.get_group(name, options = {})
|
46
|
+
Admin.get_group(gid, options = {})
|
47
|
+
```
|
39
48
|
|
40
|
-
Returns a Group object based on
|
49
|
+
Returns a Group object based on `name` or `uid`. The `options` hash is
|
41
50
|
for MS Windows only, and allows you to restrict the search based on the
|
42
51
|
options you provide, e.g. 'domain' or 'localaccount'.
|
43
52
|
|
44
|
-
|
53
|
+
`Admin.groups(options = {})`
|
45
54
|
|
46
55
|
Returns an Array of Group objects.
|
47
56
|
|
48
|
-
The
|
57
|
+
The `options` hash is for MS Windows only, and allows you to restrict the
|
49
58
|
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
50
59
|
|
51
|
-
|
60
|
+
`Admin.users(options = {})`
|
52
61
|
|
53
62
|
Returns an Array of User objects.
|
54
63
|
|
55
|
-
The
|
64
|
+
The `options` hash is for MS Windows only, and allows you to restrict the
|
56
65
|
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
57
66
|
|
58
|
-
|
59
|
-
|
67
|
+
## User class
|
68
|
+
### User (Windows)
|
60
69
|
The User class has the following attributes on MS Windows systems:
|
61
70
|
|
62
71
|
* account_type
|
@@ -78,7 +87,7 @@ The User class has the following attributes on MS Windows systems:
|
|
78
87
|
* password_required?
|
79
88
|
* uid
|
80
89
|
|
81
|
-
|
90
|
+
### User (Unix)
|
82
91
|
The User class has the following attributes on Unix systems:
|
83
92
|
|
84
93
|
* name
|
@@ -95,8 +104,8 @@ The User class has the following attributes on Unix systems:
|
|
95
104
|
* change
|
96
105
|
* expire
|
97
106
|
|
98
|
-
|
99
|
-
|
107
|
+
## Group Classes
|
108
|
+
### Group (Windows)
|
100
109
|
The Group class has the following attributes on MS Windows systems:
|
101
110
|
|
102
111
|
* caption
|
@@ -109,7 +118,7 @@ The Group class has the following attributes on MS Windows systems:
|
|
109
118
|
* gid
|
110
119
|
* local?
|
111
120
|
|
112
|
-
|
121
|
+
### Group (Unix)
|
113
122
|
The Group class has the following attributes on Unix systems:
|
114
123
|
|
115
124
|
* name
|
@@ -117,37 +126,37 @@ The Group class has the following attributes on Unix systems:
|
|
117
126
|
* members
|
118
127
|
* passwd
|
119
128
|
|
120
|
-
|
121
|
-
|
129
|
+
## Error Classes
|
130
|
+
`Admin::Error < StandardError`
|
122
131
|
|
123
132
|
Raised if anything goes wrong with any of the above methods.
|
124
133
|
|
125
|
-
|
126
|
-
|
134
|
+
## Developer's Notes
|
135
|
+
### MS Windows
|
127
136
|
The Windows version now uses a win32ole + WMI approach to getting
|
128
137
|
information. This means that the WMI service must be running on the
|
129
138
|
target machine in order to work (which it is, by default).
|
130
139
|
|
131
|
-
|
140
|
+
### UNIX
|
132
141
|
The underlying implementation is similar to core Ruby's Etc implementation.
|
133
142
|
But, in addition to the different interface, I use the re-entrant version
|
134
143
|
of the appropriate functions when available.
|
135
144
|
|
136
|
-
|
145
|
+
## Future Plans
|
137
146
|
* Make the User and Group objects comparable.
|
138
147
|
* Add ability to add, configure and delete users on Unix platforms.
|
139
148
|
|
140
|
-
|
149
|
+
## Known Bugs
|
141
150
|
None that I'm aware of. If you find any, please log them on the project page at:
|
142
151
|
|
143
152
|
https://github.com/djberg96/sys-admin
|
144
153
|
|
145
|
-
|
154
|
+
## License
|
146
155
|
Apache-2.0
|
147
156
|
|
148
|
-
|
157
|
+
## Copyright
|
149
158
|
(C) 2005-2020, Daniel J. Berger
|
150
159
|
All Rights Reserved
|
151
160
|
|
152
|
-
|
161
|
+
## Author
|
153
162
|
Daniel J. Berger
|