sys-admin 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +173 -168
- data/MANIFEST +18 -18
- data/README +148 -148
- data/Rakefile +47 -47
- data/certs/djberg96_pub.pem +21 -21
- data/doc/sys-admin-unix.txt +162 -162
- data/doc/sys-admin-windows.txt +346 -346
- data/examples/example_groups.rb +27 -27
- data/examples/example_users.rb +41 -41
- data/lib/bsd/sys/admin.rb +256 -256
- data/lib/darwin/sys/admin.rb +237 -237
- data/lib/linux/sys/admin.rb +273 -273
- data/lib/sunos/sys/admin.rb +261 -261
- data/lib/sys-admin.rb +1 -1
- data/lib/sys/admin.rb +24 -24
- data/lib/sys/admin/common.rb +137 -137
- data/lib/sys/admin/custom.rb +16 -16
- data/lib/unix/sys/admin.rb +163 -163
- data/lib/windows/sys/admin.rb +997 -997
- data/sys-admin.gemspec +39 -31
- data/test/test_sys_admin.rb +23 -19
- data/test/test_sys_admin_unix.rb +260 -260
- data/test/test_sys_admin_windows.rb +337 -337
- metadata +32 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fc5a6e4241a2079b4b053afc23e964478d97dabbe8534b89dff5a1e30eb70021
|
4
|
+
data.tar.gz: f5576fe04be229bc4a1e9a207fae244dd9385ae599ac1a41fcbb5f689e0ddfb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0abb1505ea82e7bb2be19ad4f81167347bf5dc838c40a9f306a024c0316519535e5b19ca2be1517b97b83e0873e76601b6462c15e8ec73c0fe01cc6d134c7023
|
7
|
+
data.tar.gz: 7ed678a7746cb6217443accf91f140ea37f4c0aa14cc49392334264efa418e5f66772fb6d01956daa1f37cf342f79ca0076c69b9226c1ce23d86f11c5c0416c8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGES
CHANGED
@@ -1,168 +1,173 @@
|
|
1
|
-
== 1.7.
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
*
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
*
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
*
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
*
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
*
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
*
|
72
|
-
|
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
|
-
|
101
|
-
*
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
*
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
*
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
* Added
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
*
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
* Added
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
*
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
== 1.
|
150
|
-
*
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
*
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
*
|
163
|
-
|
164
|
-
|
165
|
-
* Fixed a
|
166
|
-
|
167
|
-
|
168
|
-
*
|
1
|
+
== 1.7.1 - 19-Mar-2018
|
2
|
+
* Fixed deprecation warnings in tests.
|
3
|
+
* Added gemspec metadata.
|
4
|
+
* Updated cert again, this one should last 10 years.
|
5
|
+
|
6
|
+
== 1.7.0 - 21-Feb-2018
|
7
|
+
* Changed the license to Apache 2.0.
|
8
|
+
* VERSION constant is now frozen.
|
9
|
+
* Ignore dependency warnings in gem:create task.
|
10
|
+
* Minor README updates.
|
11
|
+
* Updated cert.
|
12
|
+
|
13
|
+
== 1.6.4 - 6-Sep-2015
|
14
|
+
* Added a sys-admin.rb file for convenience.
|
15
|
+
* Set VERSION in a single place.
|
16
|
+
* Assume Rubygems 2.x for Rakefile tasks.
|
17
|
+
* This gem is now signed.
|
18
|
+
|
19
|
+
== 1.6.3 - 8-Mar-2014
|
20
|
+
* The Admin#get_group method now handles groups with very large numbers
|
21
|
+
of members more robustly.
|
22
|
+
|
23
|
+
== 1.6.2 - 11-Feb-2014
|
24
|
+
* The User#gid method is now supported on MS Windows. It returns the user's
|
25
|
+
primary group ID.
|
26
|
+
|
27
|
+
== 1.6.1 - 24-Jan-2014
|
28
|
+
* Added the Admin.add_group_member and Admin.remove_group member methods. These
|
29
|
+
let you add a user to a specific group. Thanks go to Alexey Kolyanov for the
|
30
|
+
idea and the code.
|
31
|
+
* Modified the Admin.configure_user method so that you don't need to know the
|
32
|
+
old password. Just pass a single string argument for the new password.
|
33
|
+
* Fixed a potential encoding issue for the Admin.get_login method on JRuby.
|
34
|
+
* Updated the gem:create task in the Rakefile.
|
35
|
+
* Added rake as a development dependency.
|
36
|
+
|
37
|
+
== 1.6.0 - 5-Jan-2013
|
38
|
+
* Converted code to use FFI. This mostly only affects the unix flavors.
|
39
|
+
* The Admin.users and Admin.groups methods no longer accept a block.
|
40
|
+
* Some test suite updates.
|
41
|
+
* Because all code is now pure Ruby, there is longer any need for two
|
42
|
+
separate gems. There is now a single, unified gem that works on all
|
43
|
+
supported platforms.
|
44
|
+
|
45
|
+
== 1.5.6 - 30-Jul-2011
|
46
|
+
* Fixed issue for non-gnu platforms where it would use the wrong function
|
47
|
+
prototype because the Ruby core team took it upon themselves to explicitly
|
48
|
+
defined _GNU_SOURCE in config.h in 1.8.7 and later for reasons that baffle me.
|
49
|
+
* Some tests on Windows are now skipped unless run with elevated security.
|
50
|
+
|
51
|
+
== 1.5.5 - 5-Jul-2011
|
52
|
+
* Modified lastlog handling, and ignore getpwent_r and getgrent_r, on AIX.
|
53
|
+
Thanks go to Rick Ohnemus for the spot and patches.
|
54
|
+
* Explicitly set spec.cpu on Windows to 'universal' in the gem creation task.
|
55
|
+
* Fixed a bug in the User.get_login and User.get_group methods where the query
|
56
|
+
being generated was incorrect if no options were passed. Thanks go to
|
57
|
+
Matthew Brown for the spot.
|
58
|
+
|
59
|
+
== 1.5.4 - 7-Oct-2010
|
60
|
+
* Prefer the getlastlogx() function over lastlog() where supported.
|
61
|
+
|
62
|
+
== 1.5.3 - 6-Oct-2010
|
63
|
+
* Refactored the Rakefile. The old installation tasks have been replaced
|
64
|
+
with gem build and install tasks. In addition, the platform handling has
|
65
|
+
been updated for MS Windows.
|
66
|
+
* Portions of the gemspec have been moved into the Rakefile gem tasks.
|
67
|
+
* Deploying the mingw gem by default for MS Windows now.
|
68
|
+
|
69
|
+
== 1.5.2 - 2-Aug-2009
|
70
|
+
* Now compatible with Ruby 1.9.x.
|
71
|
+
* Added test-unit as a development dependency.
|
72
|
+
|
73
|
+
== 1.5.1 - 23-Jul-2009
|
74
|
+
* Added the User#dir attribute. This attribute contains a user's home
|
75
|
+
directory if set, or nil if it isn't.
|
76
|
+
* User objects returned by the Admin.users method now include the uid.
|
77
|
+
Previously only the Admin.get_user method set it.
|
78
|
+
* Added win32-security as a dependency.
|
79
|
+
* Changed license to Artistic 2.0.
|
80
|
+
|
81
|
+
== 1.5.0 - 29-Mar-2009
|
82
|
+
* INTERFACE CHANGE (WINDOWS ONLY): The interface for MS Windows has undergone
|
83
|
+
a radical change. Most methods now accept a hash of options that are
|
84
|
+
passed directly to the underlying WMI class. Please see the documentation
|
85
|
+
for details.
|
86
|
+
* Now works on various BSD flavors.
|
87
|
+
* Added the User#groups method. This returns an array of groups that the
|
88
|
+
user belongs to. Suggestion inspired by Gonzalo Garramuno.
|
89
|
+
* Added the Group#members method. The returns an array of users that the
|
90
|
+
group contains.
|
91
|
+
* Changed User#class to User#access_class for UNIX flavors to avoid
|
92
|
+
conflicts with the Ruby core Object method.
|
93
|
+
* Added more tests and renamed the test files.
|
94
|
+
* Removed an unnecessary function call where a platform might try to
|
95
|
+
get lastlog information even if the lastlog.h or utmp.h headers couldn't
|
96
|
+
be found.
|
97
|
+
|
98
|
+
== 1.4.4 - 19-Nov-2008
|
99
|
+
* Added the User#uid method for MS Windows (which is just the user's relative
|
100
|
+
identifier).
|
101
|
+
* Now requires test-unit 2.x.
|
102
|
+
* Some updates to the test suite to take advantage of test-unit 2.x features.
|
103
|
+
* Some minor gemspec tweaks.
|
104
|
+
|
105
|
+
== 1.4.3 - 2-Mar-2008
|
106
|
+
* The block form of Admin.users now properly ensures that endpwent() is
|
107
|
+
called. Likewise, the block form of Admin.groups now properly ensures
|
108
|
+
that endgrent() is called. This would only have been an issue if you
|
109
|
+
broke out of the block before it terminated.
|
110
|
+
* The AdminError class is now Admin::Error.
|
111
|
+
* Some internal directory layout changes.
|
112
|
+
|
113
|
+
== 1.4.2 - 26-Jun-2007
|
114
|
+
* Fixed a bug in the Admin.get_login method where it would return junk
|
115
|
+
if the underlying getlogin() function failed (Unix). Thanks go to Gonzalo
|
116
|
+
Garramuno for the spot. This bug also resulted in some refactoring of the
|
117
|
+
underlying C code.
|
118
|
+
* Removed the install.rb file. The logic in that file has been moved directly
|
119
|
+
into the Rakefile.
|
120
|
+
|
121
|
+
== 1.4.1 - 21-Mar-2007
|
122
|
+
* Bug fix for OS X. Thanks go to an anonymous user for the spot.
|
123
|
+
* Added a Rakefile. Building, testing and installing should now use the
|
124
|
+
Rake tasks (for non-gem installs).
|
125
|
+
* Much more inline documentation, especially for User and Group attributes.
|
126
|
+
|
127
|
+
== 1.4.0 - 20-Jan-2007
|
128
|
+
* Added the following methods: add_local_user, config_local_user,
|
129
|
+
delete_local_user, add_global_group, config_global_group, and
|
130
|
+
delete_global_group. MS Windows only at the moment.
|
131
|
+
* Added corresponding tests.
|
132
|
+
* Added much more inline documentation.
|
133
|
+
* Major refactoring of the get_lastlog_info helper function in admin.h. This
|
134
|
+
fixed a major bug in some flavors of Linux where the Admin.users method
|
135
|
+
could go into an infinite loop. It also fixed some minor bugs where console
|
136
|
+
and host values were sometimes filled with junk characters.
|
137
|
+
* Added the User#change attribute, and a check for the pw_change struct member
|
138
|
+
in the extconf.rb file.
|
139
|
+
* The User#expire attribute is now handled as a Time object instead of an
|
140
|
+
integer.
|
141
|
+
* Renamed tc_win32.rb to tc_windows.rb
|
142
|
+
|
143
|
+
== 1.3.1 - 29-Jun-2005
|
144
|
+
* Fixed a bug where the inability to read the lastlog file caused an error.
|
145
|
+
From now on that error is ignored, and the lastlog attributes of the User
|
146
|
+
object are set to nil.
|
147
|
+
* Added a beta version of Admin.delete_user (Windows only).
|
148
|
+
|
149
|
+
== 1.3.0 - 3-Jun-2005
|
150
|
+
* Bug fixes for Linux.
|
151
|
+
* Removed the version.h file - no longer needed since the Win32 version is
|
152
|
+
pure Ruby.
|
153
|
+
|
154
|
+
== 1.2.0 - 30-Apr-2005
|
155
|
+
* Replaced the Win32 version with a pure Ruby version that uses Win32API and
|
156
|
+
win32ole + WMI.
|
157
|
+
* The LocalGroup class no longer exists in the Win32 version. Instead, it is
|
158
|
+
now an attribute of a Group object. The issue was forced by WMI.
|
159
|
+
* The default for users and groups on Win32 systems is now local rather than
|
160
|
+
global. See the documentation for why you probably don't want to iterate
|
161
|
+
over global accounts.
|
162
|
+
* Corresponding doc changes and test suite changes.
|
163
|
+
|
164
|
+
== 1.1.0 - 1-Apr-2005
|
165
|
+
* Fixed bug where a segfault could occur when trying to retrieve a user or
|
166
|
+
group by an ID that didn't exist (Unix).
|
167
|
+
* Added tests for intentional failures.
|
168
|
+
* Added lastlog information tothe User class (Unix).
|
169
|
+
* Modified the way User objects are created internally (Unix).
|
170
|
+
* Fixed a bug in the User#shell attribute (Unix).
|
171
|
+
|
172
|
+
== 1.0.0 - 25-Mar-2005
|
173
|
+
* Initial release
|
data/MANIFEST
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
* sys-admin.gemspec
|
2
|
-
* CHANGES
|
3
|
-
* MANIFEST
|
4
|
-
* Rakefile
|
5
|
-
* README
|
6
|
-
* certs/djberg96_pub.pem
|
7
|
-
* examples/groups.rb
|
8
|
-
* examples/users.rb
|
9
|
-
* lib/sys/admin.rb
|
10
|
-
* lib/darwin/sys/admin.rb
|
11
|
-
* lib/linux/sys/admin.rb
|
12
|
-
* lib/bsd/sys/admin.rb
|
13
|
-
* lib/sunos/sys/admin.rb
|
14
|
-
* lib/sys/admin/common.rb
|
15
|
-
* lib/sys/admin/custom.rb
|
16
|
-
* test/test_sys_admin.rb
|
17
|
-
* test/test_sys_admin_unix.rb
|
18
|
-
* test/test_sys_admin_windows.rb
|
1
|
+
* sys-admin.gemspec
|
2
|
+
* CHANGES
|
3
|
+
* MANIFEST
|
4
|
+
* Rakefile
|
5
|
+
* README
|
6
|
+
* certs/djberg96_pub.pem
|
7
|
+
* examples/groups.rb
|
8
|
+
* examples/users.rb
|
9
|
+
* lib/sys/admin.rb
|
10
|
+
* lib/darwin/sys/admin.rb
|
11
|
+
* lib/linux/sys/admin.rb
|
12
|
+
* lib/bsd/sys/admin.rb
|
13
|
+
* lib/sunos/sys/admin.rb
|
14
|
+
* lib/sys/admin/common.rb
|
15
|
+
* lib/sys/admin/custom.rb
|
16
|
+
* test/test_sys_admin.rb
|
17
|
+
* test/test_sys_admin_unix.rb
|
18
|
+
* test/test_sys_admin_windows.rb
|
data/README
CHANGED
@@ -1,148 +1,148 @@
|
|
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
|
-
require 'sys/admin' # or sys-admin
|
9
|
-
include Sys
|
10
|
-
|
11
|
-
# Returns an Array of User objects
|
12
|
-
a = Admin.users
|
13
|
-
|
14
|
-
# Returns an Array of Group objects
|
15
|
-
g = Admin.groups
|
16
|
-
|
17
|
-
# Get information about a particular user
|
18
|
-
p Admin.get_user("nobody")
|
19
|
-
p Admin.get_user("nobody", :localaccount => true)
|
20
|
-
|
21
|
-
# Get information about a particular group
|
22
|
-
p Admin.get_group("adm")
|
23
|
-
p Admin.get_group("adm", :localaccount => true)
|
24
|
-
|
25
|
-
== Admin
|
26
|
-
Admin.get_login
|
27
|
-
Returns the user name (only) of the current login.
|
28
|
-
|
29
|
-
Admin.get_user(name, options = {})
|
30
|
-
Admin.get_user(uid, options = {})
|
31
|
-
Returns a User object based on +name+ or +uid+. The +options+ hash is
|
32
|
-
for MS Windows only, and allows you to restrict the search based on the
|
33
|
-
options you provide, e.g. 'domain' or 'localaccount'.
|
34
|
-
|
35
|
-
Admin.get_group(name, options = {})
|
36
|
-
Admin.get_group(gid, options = {})
|
37
|
-
Returns a Group 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
|
-
Admin.groups(options = {})
|
42
|
-
Returns an Array of Group objects.
|
43
|
-
|
44
|
-
The +options+ hash is for MS Windows only, and allows you to restrict the
|
45
|
-
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
46
|
-
|
47
|
-
Admin.users(options = {})
|
48
|
-
Returns an Array of User objects.
|
49
|
-
|
50
|
-
The +options+ hash is for MS Windows only, and allows you to restrict the
|
51
|
-
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
52
|
-
|
53
|
-
== User class
|
54
|
-
=== User (Windows)
|
55
|
-
The User class has the following attributes on MS Windows systems:
|
56
|
-
|
57
|
-
* account_type
|
58
|
-
* caption
|
59
|
-
* description
|
60
|
-
* domain
|
61
|
-
* password
|
62
|
-
* full_name
|
63
|
-
* gid
|
64
|
-
* install_date
|
65
|
-
* name
|
66
|
-
* sid
|
67
|
-
* status
|
68
|
-
* disabled?
|
69
|
-
* local?
|
70
|
-
* lockout?
|
71
|
-
* password_changeable?
|
72
|
-
* password_expires?
|
73
|
-
* password_required?
|
74
|
-
* uid
|
75
|
-
|
76
|
-
=== User (Unix)
|
77
|
-
The User class has the following attributes on Unix systems:
|
78
|
-
|
79
|
-
* name
|
80
|
-
* passwd
|
81
|
-
* uid
|
82
|
-
* gid
|
83
|
-
* dir
|
84
|
-
* shell
|
85
|
-
* gecos
|
86
|
-
* quota
|
87
|
-
* age
|
88
|
-
* class
|
89
|
-
* comment
|
90
|
-
* change
|
91
|
-
* expire
|
92
|
-
|
93
|
-
== Group Classes
|
94
|
-
=== Group (Windows)
|
95
|
-
The Group class has the following attributes on MS Windows systems:
|
96
|
-
|
97
|
-
* caption
|
98
|
-
* description
|
99
|
-
* domain
|
100
|
-
* install_date
|
101
|
-
* name
|
102
|
-
* sid
|
103
|
-
* status
|
104
|
-
* gid
|
105
|
-
* local?
|
106
|
-
|
107
|
-
=== Group (Unix)
|
108
|
-
The Group class has the following attributes on Unix systems:
|
109
|
-
|
110
|
-
* name
|
111
|
-
* gid
|
112
|
-
* members
|
113
|
-
* passwd
|
114
|
-
|
115
|
-
== Error Classes
|
116
|
-
Admin::Error < StandardError
|
117
|
-
Raised if anything goes wrong with any of the above methods.
|
118
|
-
|
119
|
-
== Developer's Notes
|
120
|
-
=== MS Windows
|
121
|
-
The Windows version now uses a win32ole + WMI approach to getting
|
122
|
-
information. This means that the WMI service must be running on the
|
123
|
-
target machine in order to work (which it is, by default).
|
124
|
-
|
125
|
-
=== UNIX
|
126
|
-
The underlying implementation is similar to core Ruby's Etc implementation.
|
127
|
-
But, in addition to the different interface, I use the re-entrant version
|
128
|
-
of the appropriate functions when available.
|
129
|
-
|
130
|
-
== Future Plans
|
131
|
-
Make the User and Group objects comparable.
|
132
|
-
Add ability to add, configure and delete users on Unix platforms.
|
133
|
-
|
134
|
-
== Known Bugs
|
135
|
-
None that I'm aware of. If you find any, please log them on the project
|
136
|
-
page at:
|
137
|
-
|
138
|
-
https://github.com/djberg96/sys-admin
|
139
|
-
|
140
|
-
== License
|
141
|
-
Apache 2.0
|
142
|
-
|
143
|
-
== Copyright
|
144
|
-
(C) 2005-2018, Daniel J. Berger
|
145
|
-
All Rights Reserved
|
146
|
-
|
147
|
-
== Author
|
148
|
-
Daniel J. Berger
|
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
|
+
require 'sys/admin' # or sys-admin
|
9
|
+
include Sys
|
10
|
+
|
11
|
+
# Returns an Array of User objects
|
12
|
+
a = Admin.users
|
13
|
+
|
14
|
+
# Returns an Array of Group objects
|
15
|
+
g = Admin.groups
|
16
|
+
|
17
|
+
# Get information about a particular user
|
18
|
+
p Admin.get_user("nobody")
|
19
|
+
p Admin.get_user("nobody", :localaccount => true)
|
20
|
+
|
21
|
+
# Get information about a particular group
|
22
|
+
p Admin.get_group("adm")
|
23
|
+
p Admin.get_group("adm", :localaccount => true)
|
24
|
+
|
25
|
+
== Admin
|
26
|
+
Admin.get_login
|
27
|
+
Returns the user name (only) of the current login.
|
28
|
+
|
29
|
+
Admin.get_user(name, options = {})
|
30
|
+
Admin.get_user(uid, options = {})
|
31
|
+
Returns a User object based on +name+ or +uid+. The +options+ hash is
|
32
|
+
for MS Windows only, and allows you to restrict the search based on the
|
33
|
+
options you provide, e.g. 'domain' or 'localaccount'.
|
34
|
+
|
35
|
+
Admin.get_group(name, options = {})
|
36
|
+
Admin.get_group(gid, options = {})
|
37
|
+
Returns a Group 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
|
+
Admin.groups(options = {})
|
42
|
+
Returns an Array of Group objects.
|
43
|
+
|
44
|
+
The +options+ hash is for MS Windows only, and allows you to restrict the
|
45
|
+
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
46
|
+
|
47
|
+
Admin.users(options = {})
|
48
|
+
Returns an Array of User objects.
|
49
|
+
|
50
|
+
The +options+ hash is for MS Windows only, and allows you to restrict the
|
51
|
+
search based on the options you provide, e.g. 'domain' or 'localaccount'.
|
52
|
+
|
53
|
+
== User class
|
54
|
+
=== User (Windows)
|
55
|
+
The User class has the following attributes on MS Windows systems:
|
56
|
+
|
57
|
+
* account_type
|
58
|
+
* caption
|
59
|
+
* description
|
60
|
+
* domain
|
61
|
+
* password
|
62
|
+
* full_name
|
63
|
+
* gid
|
64
|
+
* install_date
|
65
|
+
* name
|
66
|
+
* sid
|
67
|
+
* status
|
68
|
+
* disabled?
|
69
|
+
* local?
|
70
|
+
* lockout?
|
71
|
+
* password_changeable?
|
72
|
+
* password_expires?
|
73
|
+
* password_required?
|
74
|
+
* uid
|
75
|
+
|
76
|
+
=== User (Unix)
|
77
|
+
The User class has the following attributes on Unix systems:
|
78
|
+
|
79
|
+
* name
|
80
|
+
* passwd
|
81
|
+
* uid
|
82
|
+
* gid
|
83
|
+
* dir
|
84
|
+
* shell
|
85
|
+
* gecos
|
86
|
+
* quota
|
87
|
+
* age
|
88
|
+
* class
|
89
|
+
* comment
|
90
|
+
* change
|
91
|
+
* expire
|
92
|
+
|
93
|
+
== Group Classes
|
94
|
+
=== Group (Windows)
|
95
|
+
The Group class has the following attributes on MS Windows systems:
|
96
|
+
|
97
|
+
* caption
|
98
|
+
* description
|
99
|
+
* domain
|
100
|
+
* install_date
|
101
|
+
* name
|
102
|
+
* sid
|
103
|
+
* status
|
104
|
+
* gid
|
105
|
+
* local?
|
106
|
+
|
107
|
+
=== Group (Unix)
|
108
|
+
The Group class has the following attributes on Unix systems:
|
109
|
+
|
110
|
+
* name
|
111
|
+
* gid
|
112
|
+
* members
|
113
|
+
* passwd
|
114
|
+
|
115
|
+
== Error Classes
|
116
|
+
Admin::Error < StandardError
|
117
|
+
Raised if anything goes wrong with any of the above methods.
|
118
|
+
|
119
|
+
== Developer's Notes
|
120
|
+
=== MS Windows
|
121
|
+
The Windows version now uses a win32ole + WMI approach to getting
|
122
|
+
information. This means that the WMI service must be running on the
|
123
|
+
target machine in order to work (which it is, by default).
|
124
|
+
|
125
|
+
=== UNIX
|
126
|
+
The underlying implementation is similar to core Ruby's Etc implementation.
|
127
|
+
But, in addition to the different interface, I use the re-entrant version
|
128
|
+
of the appropriate functions when available.
|
129
|
+
|
130
|
+
== Future Plans
|
131
|
+
Make the User and Group objects comparable.
|
132
|
+
Add ability to add, configure and delete users on Unix platforms.
|
133
|
+
|
134
|
+
== Known Bugs
|
135
|
+
None that I'm aware of. If you find any, please log them on the project
|
136
|
+
page at:
|
137
|
+
|
138
|
+
https://github.com/djberg96/sys-admin
|
139
|
+
|
140
|
+
== License
|
141
|
+
Apache 2.0
|
142
|
+
|
143
|
+
== Copyright
|
144
|
+
(C) 2005-2018, Daniel J. Berger
|
145
|
+
All Rights Reserved
|
146
|
+
|
147
|
+
== Author
|
148
|
+
Daniel J. Berger
|