activesambaldap 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS.en +8 -1
- data/NEWS.ja +8 -1
- data/README.en +9 -6
- data/README.ja +5 -3
- data/Rakefile +47 -1
- data/bin/asl-groupadd +8 -5
- data/bin/asl-groupdel +6 -3
- data/bin/asl-groupmod +15 -11
- data/bin/asl-groupshow +3 -1
- data/bin/asl-passwd +14 -11
- data/bin/asl-populate +19 -14
- data/bin/asl-purge +3 -1
- data/bin/asl-samba-computeradd +8 -6
- data/bin/asl-samba-groupadd +4 -2
- data/bin/asl-samba-groupdel +4 -2
- data/bin/asl-samba-groupmod +8 -7
- data/bin/asl-samba-useradd +8 -6
- data/bin/asl-samba-userdel +4 -2
- data/bin/asl-samba-usermod +15 -8
- data/bin/asl-useradd +50 -49
- data/bin/asl-userdel +17 -8
- data/bin/asl-usermod +54 -49
- data/bin/asl-usershow +3 -1
- data/data/locale/ja/LC_MESSAGES/active-samba-ldap.mo +0 -0
- data/lib/active_samba_ldap.rb +2 -1
- data/lib/active_samba_ldap/account_entry.rb +13 -11
- data/lib/active_samba_ldap/base.rb +26 -25
- data/lib/active_samba_ldap/command.rb +11 -7
- data/lib/active_samba_ldap/configuration.rb +6 -4
- data/lib/active_samba_ldap/entry.rb +5 -4
- data/lib/active_samba_ldap/get_text_support.rb +12 -0
- data/lib/active_samba_ldap/group_entry.rb +4 -3
- data/lib/active_samba_ldap/populate.rb +1 -1
- data/lib/active_samba_ldap/samba_account_entry.rb +4 -4
- data/lib/active_samba_ldap/samba_group_entry.rb +4 -3
- data/lib/active_samba_ldap/user.rb +5 -4
- data/lib/active_samba_ldap/version.rb +1 -1
- data/po/active-samba-ldap.pot +463 -0
- data/po/ja/active-samba-ldap.po +469 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl/scaffold_asl_generator.rb → scaffold_active_samba_ldap/scaffold_active_samba_ldap_generator.rb} +1 -2
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/computer.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/dc.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/group.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/idmap.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/ldap.yml +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/ou.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_controller.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_helper.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_index.rhtml +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_populate.rhtml +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/samba_purge.rhtml +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/unix_id_pool.rb +0 -0
- data/rails/plugin/active_samba_ldap/generators/{scaffold_asl → scaffold_active_samba_ldap}/templates/user.rb +0 -0
- data/rails/plugin/active_samba_ldap/init.rb +15 -3
- data/test/asl-test-utils.rb +2 -1
- data/test/command.rb +5 -2
- data/test/run-test.rb +6 -2
- data/test/test-unit-ext.rb +4 -2
- data/test/test-unit-ext/backtrace-filter.rb +17 -0
- data/test/test-unit-ext/long-display-for-emacs.rb +25 -0
- data/test/test-unit-ext/priority.rb +20 -7
- data/test/test_asl_groupadd.rb +2 -2
- data/test/test_asl_groupdel.rb +11 -11
- data/test/test_asl_groupmod.rb +7 -6
- data/test/test_asl_groupshow.rb +1 -1
- data/test/test_asl_passwd.rb +11 -10
- data/test/test_asl_populate.rb +6 -6
- data/test/test_asl_purge.rb +1 -1
- data/test/test_asl_useradd.rb +11 -9
- data/test/test_asl_userdel.rb +6 -4
- data/test/test_asl_usermod.rb +8 -8
- data/test/test_asl_usershow.rb +1 -1
- data/test/test_entry.rb +21 -0
- metadata +38 -30
data/bin/asl-purge
CHANGED
@@ -7,11 +7,13 @@ require 'time'
|
|
7
7
|
require 'active_samba_ldap'
|
8
8
|
require 'active_samba_ldap/command'
|
9
9
|
|
10
|
+
include ActiveSambaLdap::GetTextSupport
|
11
|
+
|
10
12
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
11
13
|
end
|
12
14
|
|
13
15
|
unless Process.uid.zero?
|
14
|
-
$stderr.puts
|
16
|
+
$stderr.puts(_("need root authority."))
|
15
17
|
exit 1
|
16
18
|
end
|
17
19
|
|
data/bin/asl-samba-computeradd
CHANGED
@@ -3,14 +3,16 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
options.ou = nil
|
8
10
|
|
9
11
|
opts.banner += " COMPUTER_NAME"
|
10
12
|
|
11
13
|
opts.on("-o", "--ou=OU",
|
12
|
-
"add the user in the organizational unit OU",
|
13
|
-
"(relative to the user suffix)") do |ou|
|
14
|
+
_("add the user in the organizational unit OU"),
|
15
|
+
_("(relative to the user suffix)")) do |ou|
|
14
16
|
if /^ou=/ =~ ou
|
15
17
|
options.ou = ou
|
16
18
|
else
|
@@ -28,7 +30,7 @@ else
|
|
28
30
|
end
|
29
31
|
|
30
32
|
unless Process.uid.zero?
|
31
|
-
$stderr.puts
|
33
|
+
$stderr.puts(_("need root authority."))
|
32
34
|
exit 1
|
33
35
|
end
|
34
36
|
|
@@ -52,12 +54,12 @@ class UnixIdPool < ActiveSambaLdap::UnixIdPool
|
|
52
54
|
end
|
53
55
|
|
54
56
|
unless Computer.valid_name?(name)
|
55
|
-
$stderr.puts
|
57
|
+
$stderr.puts(_("illegal computer name: %s") % name)
|
56
58
|
exit 1
|
57
59
|
end
|
58
60
|
|
59
61
|
if Computer.exists?(name)
|
60
|
-
$stderr.puts
|
62
|
+
$stderr.puts(_("computer already exists: %s") % name)
|
61
63
|
exit 1
|
62
64
|
end
|
63
65
|
|
@@ -73,7 +75,7 @@ computer = nil
|
|
73
75
|
begin
|
74
76
|
computer = Computer.create(:uid => name, :group_class => Group)
|
75
77
|
rescue ActiveSambaLdap::UidNumberAlreadyExists
|
76
|
-
$stderr.puts
|
78
|
+
$stderr.puts(_("UID already exists: %s") % uid_number)
|
77
79
|
exit 1
|
78
80
|
rescue ActiveSambaLdap::GidNumberDoesNotExist,
|
79
81
|
ActiveSambaLdap::GroupDoesNotExist,
|
data/bin/asl-samba-groupadd
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
opts.banner += " GROUP_NAME"
|
8
10
|
end
|
@@ -16,7 +18,7 @@ else
|
|
16
18
|
end
|
17
19
|
|
18
20
|
unless Process.uid.zero?
|
19
|
-
$stderr.puts
|
21
|
+
$stderr.puts(_("need root authority."))
|
20
22
|
exit 1
|
21
23
|
end
|
22
24
|
|
@@ -31,7 +33,7 @@ class UnixIdPool < ActiveSambaLdap::UnixIdPool
|
|
31
33
|
end
|
32
34
|
|
33
35
|
if Group.exists?(name)
|
34
|
-
$stderr.puts
|
36
|
+
$stderr.puts(_("group already exists: %s") % name)
|
35
37
|
exit 1
|
36
38
|
end
|
37
39
|
|
data/bin/asl-samba-groupdel
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
opts.banner += " GROUP_NAME"
|
8
10
|
end
|
@@ -16,7 +18,7 @@ else
|
|
16
18
|
end
|
17
19
|
|
18
20
|
unless Process.uid.zero?
|
19
|
-
$stderr.puts
|
21
|
+
$stderr.puts(_("need root authority."))
|
20
22
|
exit 1
|
21
23
|
end
|
22
24
|
|
@@ -35,7 +37,7 @@ class Computer < ActiveSambaLdap::Computer
|
|
35
37
|
end
|
36
38
|
|
37
39
|
unless Group.exists?(name)
|
38
|
-
$stderr.puts
|
40
|
+
$stderr.puts(_("group doesn't exist: %s") % name)
|
39
41
|
exit 1
|
40
42
|
end
|
41
43
|
group = Group.find(name)
|
data/bin/asl-samba-groupmod
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
options.members_to_add = nil
|
8
10
|
options.members_to_delete = nil
|
@@ -10,9 +12,9 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
|
10
12
|
opts.banner += " GROUP_NAME"
|
11
13
|
|
12
14
|
opts.on("-a", "--add-members=MEMBER1,MEMBER2,MEBMER3", Array,
|
13
|
-
"add members (comma delimited)") {|options.members_to_add|}
|
15
|
+
_("add members (comma delimited)")) {|options.members_to_add|}
|
14
16
|
opts.on("-d", "--delete-members=MEMBER1,MEMBER2,MEBMER3", Array,
|
15
|
-
"delete members (comma delimited)") {|options.members_to_delete|}
|
17
|
+
_("delete members (comma delimited)")) {|options.members_to_delete|}
|
16
18
|
end
|
17
19
|
|
18
20
|
name = nil
|
@@ -24,7 +26,7 @@ else
|
|
24
26
|
end
|
25
27
|
|
26
28
|
unless Process.uid.zero?
|
27
|
-
$stderr.puts
|
29
|
+
$stderr.puts(_("need root authority."))
|
28
30
|
exit 1
|
29
31
|
end
|
30
32
|
|
@@ -43,7 +45,7 @@ class Computer < ActiveSambaLdap::Computer
|
|
43
45
|
end
|
44
46
|
|
45
47
|
unless Group.exists?(name)
|
46
|
-
$stderr.puts
|
48
|
+
$stderr.puts(_("group doesn't exist: %s") % name)
|
47
49
|
exit 1
|
48
50
|
end
|
49
51
|
group = Group.find(name)
|
@@ -51,9 +53,8 @@ group = Group.find(name)
|
|
51
53
|
if options.members_to_add and options.members_to_delete
|
52
54
|
duplicated_members = options.members_to_add & options.members_to_delete
|
53
55
|
unless duplicated_members.empty?
|
54
|
-
|
55
|
-
|
56
|
-
$stderr.puts message
|
56
|
+
format = _("there are duplicated members in adding and deleting members: %s")
|
57
|
+
$stderr.puts(format % duplicated_members.join(", "))
|
57
58
|
exit 1
|
58
59
|
end
|
59
60
|
end
|
data/bin/asl-samba-useradd
CHANGED
@@ -3,14 +3,16 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
options.ou = nil
|
8
10
|
|
9
11
|
opts.banner += " USER_NAME"
|
10
12
|
|
11
13
|
opts.on("-o", "--ou=OU",
|
12
|
-
"add the user in the organizational unit OU",
|
13
|
-
"(relative to the user suffix)") do |ou|
|
14
|
+
_("add the user in the organizational unit OU"),
|
15
|
+
_("(relative to the user suffix)")) do |ou|
|
14
16
|
if /^ou=/ =~ ou
|
15
17
|
options.ou = ou
|
16
18
|
else
|
@@ -28,7 +30,7 @@ else
|
|
28
30
|
end
|
29
31
|
|
30
32
|
unless Process.uid.zero?
|
31
|
-
$stderr.puts
|
33
|
+
$stderr.puts(_("need root authority."))
|
32
34
|
exit 1
|
33
35
|
end
|
34
36
|
|
@@ -52,12 +54,12 @@ class UnixIdPool < ActiveSambaLdap::UnixIdPool
|
|
52
54
|
end
|
53
55
|
|
54
56
|
unless User.valid_name?(name)
|
55
|
-
$stderr.puts
|
57
|
+
$stderr.puts(_("illegal user name: %s") % name)
|
56
58
|
exit 1
|
57
59
|
end
|
58
60
|
|
59
61
|
if User.exists?(name)
|
60
|
-
$stderr.puts
|
62
|
+
$stderr.puts(_("user already exists: %s") % name)
|
61
63
|
exit 1
|
62
64
|
end
|
63
65
|
|
@@ -70,7 +72,7 @@ user = nil
|
|
70
72
|
begin
|
71
73
|
user = User.create(:uid => name, :group_class => Group)
|
72
74
|
rescue ActiveSambaLdap::UidNumberAlreadyExists
|
73
|
-
$stderr.puts
|
75
|
+
$stderr.puts(_("UID already exists: %s") % uid_number)
|
74
76
|
exit 1
|
75
77
|
rescue ActiveSambaLdap::GidNumberDoesNotExist,
|
76
78
|
ActiveSambaLdap::GroupDoesNotExist,
|
data/bin/asl-samba-userdel
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
opts.banner += " USER_NAME"
|
8
10
|
end
|
@@ -16,7 +18,7 @@ else
|
|
16
18
|
end
|
17
19
|
|
18
20
|
unless Process.uid.zero?
|
19
|
-
$stderr.puts
|
21
|
+
$stderr.puts(_("need root authority."))
|
20
22
|
exit 1
|
21
23
|
end
|
22
24
|
|
@@ -35,7 +37,7 @@ class Group < ActiveSambaLdap::Group
|
|
35
37
|
end
|
36
38
|
|
37
39
|
unless User.exists?(name)
|
38
|
-
$stderr.puts
|
40
|
+
$stderr.puts(_("user doesn't exist: %s") % name)
|
39
41
|
exit 1
|
40
42
|
end
|
41
43
|
|
data/bin/asl-samba-usermod
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'active_samba_ldap'
|
4
4
|
require 'active_samba_ldap/command'
|
5
5
|
|
6
|
+
include ActiveSambaLdap::GetTextSupport
|
7
|
+
|
6
8
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
7
9
|
options.computer_account = false
|
8
10
|
options.gid = nil
|
@@ -10,11 +12,11 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
|
10
12
|
opts.banner += " USER_NAME"
|
11
13
|
|
12
14
|
opts.on("-c", "--[no-]computer-account",
|
13
|
-
"is a Windows Workstation",
|
14
|
-
"(otherwise, Windows user)",
|
15
|
+
_("is a Windows Workstation"),
|
16
|
+
_("(otherwise, Windows user)"),
|
15
17
|
"(#{options.computer_account})") {|options.computer_account|}
|
16
18
|
|
17
|
-
opts.on("-g", "--gid=GID", "gid") {|options.gid|}
|
19
|
+
opts.on("-g", "--gid=GID", _("gid")) {|options.gid|}
|
18
20
|
end
|
19
21
|
|
20
22
|
name = nil
|
@@ -41,21 +43,26 @@ end
|
|
41
43
|
|
42
44
|
options.computer_account = true if /\$$/ =~ name
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
if options.computer_account
|
47
|
+
member_class = Computer
|
48
|
+
member_type = _("computer")
|
49
|
+
else
|
50
|
+
member_class = User
|
51
|
+
member_type = _("user")
|
52
|
+
end
|
46
53
|
|
47
54
|
if options.computer_account
|
48
55
|
name = name.chomp("$") + "$"
|
49
56
|
end
|
50
57
|
|
51
58
|
unless member_class.exists?(name)
|
52
|
-
$stderr.puts
|
59
|
+
$stderr.puts(_("%s doesn't exist: %s") % [member_type, name])
|
53
60
|
exit 1
|
54
61
|
end
|
55
62
|
member = member_class.find(name)
|
56
63
|
|
57
64
|
unless Process.uid.zero?
|
58
|
-
password = ActiveSambaLdap::Command.read_password("Enter your password: ")
|
65
|
+
password = ActiveSambaLdap::Command.read_password(_("Enter your password: "))
|
59
66
|
|
60
67
|
auth_class = Class.new(ActiveSambaLdap::Base)
|
61
68
|
config = ActiveSambaLdap::Base.configurations["reference"]
|
@@ -64,7 +71,7 @@ unless Process.uid.zero?
|
|
64
71
|
:password => password,
|
65
72
|
:allow_anonymous => false))
|
66
73
|
rescue ActiveLdap::AuthenticationError
|
67
|
-
$stderr.puts
|
74
|
+
$stderr.puts(_("password isn't match."))
|
68
75
|
exit 1
|
69
76
|
ensure
|
70
77
|
auth_class.remove_connection
|
data/bin/asl-useradd
CHANGED
@@ -5,6 +5,8 @@ require 'time'
|
|
5
5
|
require 'active_samba_ldap'
|
6
6
|
require 'active_samba_ldap/command'
|
7
7
|
|
8
|
+
include ActiveSambaLdap::GetTextSupport
|
9
|
+
|
8
10
|
argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
9
11
|
options.ou = nil
|
10
12
|
options.computer_account = false
|
@@ -28,7 +30,7 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
|
28
30
|
options.samba_logon_script = nil
|
29
31
|
options.samba_profile_path = nil
|
30
32
|
options.samba_account_flags = nil
|
31
|
-
options.
|
33
|
+
options.common_name = nil
|
32
34
|
options.given_name = nil
|
33
35
|
options.surname = nil
|
34
36
|
options.mail_addresses = nil
|
@@ -37,8 +39,8 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
|
37
39
|
opts.banner += " USER_NAME"
|
38
40
|
|
39
41
|
opts.on("-o", "--ou=OU",
|
40
|
-
"add the user in the organizational unit OU",
|
41
|
-
"(relative to the user suffix)") do |ou|
|
42
|
+
_("add the user in the organizational unit OU"),
|
43
|
+
_("(relative to the user suffix)")) do |ou|
|
42
44
|
if /^ou=/ =~ ou
|
43
45
|
options.ou = ou
|
44
46
|
else
|
@@ -46,88 +48,86 @@ argv, opts, options = ActiveSambaLdap::Command.parse_options do |opts, options|
|
|
46
48
|
end
|
47
49
|
end
|
48
50
|
opts.on("-c", "--[no-]computer-account",
|
49
|
-
"is a Windows Workstation",
|
50
|
-
"(otherwise, Windows user)",
|
51
|
+
_("is a Windows Workstation"),
|
52
|
+
_("(otherwise, Windows user)"),
|
51
53
|
"(#{options.computer_account})") {|options.computer_account|}
|
52
|
-
opts.on("-u", "--uid=UID", Integer, "uid") {|options.uid|}
|
53
|
-
opts.on("-g", "--gid=GID", "gid") {|options.gid|}
|
54
|
+
opts.on("-u", "--uid=UID", Integer, _("uid")) {|options.uid|}
|
55
|
+
opts.on("-g", "--gid=GID", _("gid")) {|options.gid|}
|
54
56
|
opts.on("-G", "--groups=GID1,GID2,GID3", Array,
|
55
|
-
"supplementary groups (comma separated)") do |groups|
|
57
|
+
_("supplementary groups (comma separated)")) do |groups|
|
56
58
|
options.supplementary_groups = groups
|
57
59
|
end
|
58
60
|
opts.on("--[no-]create-group",
|
59
|
-
"create a group for the user",
|
61
|
+
_("create a group for the user"),
|
60
62
|
"(#{options.create_group})") {|options.create_group|}
|
61
63
|
opts.on("-c", "--comment=COMMENT",
|
62
|
-
"set the GECOS field for the new user account") {|options.comment|}
|
63
|
-
opts.on("-s", "--shell=SHELL", "shell") {|options.shell|}
|
64
|
-
opts.on("-G", "--given-name=NAME", "given name") {|options.given_name|}
|
65
|
-
opts.on("-N", "--
|
66
|
-
"
|
67
|
-
opts.on("-S", "--surname=NAME", "surname") {|options.surname|}
|
64
|
+
_("set the GECOS field for the new user account")) {|options.comment|}
|
65
|
+
opts.on("-s", "--shell=SHELL", _("shell")) {|options.shell|}
|
66
|
+
opts.on("-G", "--given-name=NAME", _("given name")) {|options.given_name|}
|
67
|
+
opts.on("-N", "--common-name=NAME",
|
68
|
+
_("common name")) {|options.common_name|}
|
69
|
+
opts.on("-S", "--surname=NAME", _("surname")) {|options.surname|}
|
68
70
|
|
69
71
|
opts.on("-d", "--home-directory=HOME_DIR",
|
70
|
-
"home directory") {|options.home_directory|}
|
72
|
+
_("home directory")) {|options.home_directory|}
|
71
73
|
opts.on("--home-directory-mode=MODE",
|
72
|
-
"permission of home directory") {|options.home_directory_mode|}
|
74
|
+
_("permission of home directory")) {|options.home_directory_mode|}
|
73
75
|
opts.on("--[no-]setup-home-directory",
|
74
|
-
"setup home directory",
|
76
|
+
_("setup home directory"),
|
75
77
|
"(#{options.setup_home_directory})") {|options.setup_home_directory|}
|
76
78
|
opts.on("-k", "--skel=DIR", "--skeleton-directory=DIR",
|
77
|
-
"skeleton directory") {|options.skeleton_directory|}
|
79
|
+
_("skeleton directory")) {|options.skeleton_directory|}
|
78
80
|
|
79
81
|
opts.on("--time=TIME", Integer,
|
80
|
-
"wait TIME seconds before exiting",
|
82
|
+
_("wait TIME seconds before exiting"),
|
81
83
|
"(#{options.time})") {|options.time|}
|
82
84
|
|
83
85
|
opts.separator("")
|
84
|
-
opts.separator("For samba accounts:")
|
86
|
+
opts.separator(_("For samba accounts:"))
|
85
87
|
|
86
|
-
opts.on("-e", "--expire-date=DATE", "expire date") do |date|
|
88
|
+
opts.on("-e", "--expire-date=DATE", _("expire date")) do |date|
|
87
89
|
options.expire_date = Time.parse(date)
|
88
90
|
end
|
89
91
|
opts.on("-C", "--[no-]can-change-password",
|
90
|
-
"can change password") do |bool|
|
92
|
+
_("can change password")) do |bool|
|
91
93
|
options.can_change_password = bool
|
92
94
|
end
|
93
95
|
opts.on("-M", "--[no-]must-change-password",
|
94
|
-
"must change password") do |bool|
|
96
|
+
_("must change password")) do |bool|
|
95
97
|
options.must_change_password = bool
|
96
98
|
end
|
97
99
|
opts.on("--samba-home-path=UNC",
|
98
|
-
"sambaHomePath",
|
99
|
-
"(SMB home share, like '\\\\PDC\\user'") do |unc|
|
100
|
+
_("sambaHomePath"),
|
101
|
+
_("(SMB home share, like '\\\\PDC\\user'")) do |unc|
|
100
102
|
options.samba_home_unc = unc
|
101
103
|
end
|
102
104
|
opts.on("--samba-home-drive=DRIVE",
|
103
|
-
"sambaHomeDrive",
|
104
|
-
"(letter associated with home share,"
|
105
|
-
" like 'H:')") do |drive|
|
105
|
+
_("sambaHomeDrive"),
|
106
|
+
_("(letter associated with home share, like 'H:')")) do |drive|
|
106
107
|
options.samba_home_drive = drive
|
107
108
|
end
|
108
109
|
opts.on("--samba-logon-script=SCRIPT",
|
109
|
-
"sambaLogonScript",
|
110
|
-
"(DOS script to execute on login)") do |script|
|
110
|
+
_("sambaLogonScript"),
|
111
|
+
_("(DOS script to execute on login)")) do |script|
|
111
112
|
options.samba_logon_script = script
|
112
113
|
end
|
113
114
|
opts.on("--samba-profile-path=PATH",
|
114
|
-
"sambaProfilePath",
|
115
|
-
"(profile directory,"
|
116
|
-
" like '\\\\PDC\\profiles\\user')") do |path|
|
115
|
+
_("sambaProfilePath"),
|
116
|
+
_("(profile directory, like '\\\\PDC\\profiles\\user')")) do |path|
|
117
117
|
options.samba_profile_path = path
|
118
118
|
end
|
119
119
|
opts.on("--samba-account-flags=FLAGS",
|
120
|
-
"sambaAcctFlags",
|
121
|
-
"(samba account control bits,"
|
122
|
-
|
120
|
+
_("sambaAcctFlags"),
|
121
|
+
_("(samba account control bits, " \
|
122
|
+
"like '[NDHTUMWSLXI]')")) {|options.samba_account_flags|}
|
123
123
|
|
124
124
|
# opts.on("--mail-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
|
125
125
|
# Array,
|
126
|
-
# "mailAddresses (comma separated)") {|options.mail_addresses|}
|
126
|
+
# _("mailAddresses (comma separated)")) {|options.mail_addresses|}
|
127
127
|
# opts.on("--mail-to-addresses=ADDRESS1,ADDRESS2,ADDRESS3",
|
128
128
|
# Array,
|
129
|
-
# "mailToAddresses (forward address)",
|
130
|
-
# "(comma separated)") do |addresses|
|
129
|
+
# _("mailToAddresses (forward address)"),
|
130
|
+
# _("(comma separated)")) do |addresses|
|
131
131
|
# options.mail_to_addresses = addresses
|
132
132
|
# end
|
133
133
|
end
|
@@ -141,7 +141,7 @@ else
|
|
141
141
|
end
|
142
142
|
|
143
143
|
unless Process.uid.zero?
|
144
|
-
$stderr.puts
|
144
|
+
$stderr.puts(_("need root authority."))
|
145
145
|
exit 1
|
146
146
|
end
|
147
147
|
|
@@ -164,21 +164,22 @@ class UnixIdPool < ActiveSambaLdap::UnixIdPool
|
|
164
164
|
ldap_mapping
|
165
165
|
end
|
166
166
|
|
167
|
-
member_class = options.computer_account ? Computer : User
|
168
|
-
|
169
|
-
member_type = member_class.name.downcase
|
170
|
-
|
171
167
|
if options.computer_account
|
168
|
+
member_class = Computer
|
169
|
+
member_type = _("computer")
|
172
170
|
name = name.chomp("$") + "$"
|
171
|
+
else
|
172
|
+
member_class = User
|
173
|
+
member_type = _("user")
|
173
174
|
end
|
174
175
|
|
175
176
|
unless member_class.valid_name?(name)
|
176
|
-
$stderr.puts
|
177
|
+
$stderr.puts(_("illegal %s name: %s") % [name, member_type])
|
177
178
|
exit 1
|
178
179
|
end
|
179
180
|
|
180
181
|
if member_class.exists?(name)
|
181
|
-
$stderr.puts
|
182
|
+
$stderr.puts(_("%s already exists: %s") % [member_type, name])
|
182
183
|
exit 1
|
183
184
|
end
|
184
185
|
|
@@ -191,7 +192,7 @@ create_options = {
|
|
191
192
|
:home_directory => options.home_directory,
|
192
193
|
:login_shell => options.shell,
|
193
194
|
:given_name => options.given_name,
|
194
|
-
:cn => options.
|
195
|
+
:cn => options.common_name,
|
195
196
|
:sn => options.surname,
|
196
197
|
:gecos => options.comment,
|
197
198
|
:samba_acct_flags => options.samba_account_flags,
|
@@ -220,7 +221,7 @@ member = nil
|
|
220
221
|
begin
|
221
222
|
member = member_class.create(create_options)
|
222
223
|
rescue ActiveSambaLdap::UidNumberAlreadyExists
|
223
|
-
$stderr.puts
|
224
|
+
$stderr.puts(_("UID already exists: %s") % uid_number)
|
224
225
|
exit 1
|
225
226
|
rescue ActiveSambaLdap::GidNumberDoesNotExist,
|
226
227
|
ActiveSambaLdap::GroupDoesNotExist,
|