foreman_users 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/application.js +1 -0
- data/app/controllers/foreman_users/syusers_controller.rb +8 -8
- data/app/models/foreman_users/syuser.rb +3 -4
- data/app/views/foreman_users/syusers/_form.html.erb +36 -57
- data/app/views/foreman_users/syusers/_sub.html.erb +22 -7
- data/lib/foreman_users/version.rb +1 -1
- metadata +39 -22
@@ -0,0 +1 @@
|
|
1
|
+
//= require jquery_nested_form
|
@@ -25,8 +25,8 @@ class ForemanUsers::SyusersController < ApplicationController
|
|
25
25
|
# GET /syusers/new.json
|
26
26
|
def new
|
27
27
|
@syuser = ForemanUsers::Syuser.new
|
28
|
-
|
29
|
-
#
|
28
|
+
sygroups = @syuser.sygroups.new
|
29
|
+
#5.times { @syuser.sygroups.build}
|
30
30
|
respond_to do |format|
|
31
31
|
format.html # new.html.erb
|
32
32
|
format.json { render json: @syuser }
|
@@ -36,12 +36,12 @@ class ForemanUsers::SyusersController < ApplicationController
|
|
36
36
|
# GET /syusers/1/edit
|
37
37
|
def edit
|
38
38
|
@syuser = ForemanUsers::Syuser.find(params[:id])
|
39
|
-
sygroup_time = @syuser.sygroups.size
|
40
|
-
if sygroup_time == 0
|
41
|
-
|
42
|
-
else
|
43
|
-
|
44
|
-
end
|
39
|
+
# sygroup_time = @syuser.sygroups.size
|
40
|
+
# if sygroup_time == 0
|
41
|
+
# 5.times { @syuser.sygroups.build}
|
42
|
+
# else
|
43
|
+
# 5.times { @syuser.sygroups.build}
|
44
|
+
# end
|
45
45
|
end
|
46
46
|
|
47
47
|
# POST /syusers
|
@@ -2,12 +2,11 @@ class ForemanUsers::Syuser < ActiveRecord::Base
|
|
2
2
|
require "fileutils"
|
3
3
|
attr_accessible :title, :body, :name, :ensure , :gid, :groups, :home , :password, :password_max_age, :password_min_age, :shell, :uid, :sygroups_attributes
|
4
4
|
|
5
|
-
|
6
5
|
has_many :sygroups, class_name: "ForemanUsers::Sygroup"
|
7
|
-
|
6
|
+
accepts_nested_attributes_for :sygroups, reject_if: proc { |attributes| attributes['gid'].blank?| attributes['name'].blank? | attributes['ensure'].blank? } , allow_destroy: true
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
after_create :create_dir
|
9
|
+
after_update :create_dir
|
11
10
|
#after_destory :destory_dir
|
12
11
|
def create_dir
|
13
12
|
#目前用 "/home/stdtnt/app/"代替 "/etc/puppet/environments/production/modules/users"
|
@@ -1,53 +1,48 @@
|
|
1
1
|
<%= javascript 'syusers', 'syuser_edit', 'syuser_edit_interfaces', 'class_edit', 'compute_resource', 'lookup_keys'%>
|
2
2
|
|
3
|
-
<%=
|
3
|
+
<%= nested_form_for @syuser, :html => {:data => {:id => @syuser.try(:id), :submit => 'progress_bar'}} do |f| %>
|
4
4
|
<%= base_errors_for @syuser %>
|
5
5
|
<div class="row clearfix">
|
6
6
|
<div class="row">
|
7
|
-
<div class="form-group col-md-
|
8
|
-
|
9
|
-
<%= f.text_field :name, :size => "col-md-
|
7
|
+
<div class="form-group col-md-3">
|
8
|
+
<label>name</label>
|
9
|
+
<%= f.text_field :name, :size => "col-md-3", placeholder: "填写用户名", class: "form-control" %>
|
10
10
|
</div>
|
11
|
-
<div class="form-group col-md-
|
12
|
-
<label
|
11
|
+
<div class="form-group col-md-3">
|
12
|
+
<label>ensure</label> <br />
|
13
13
|
<%= f.select :ensure, [['Please select an ensure', nil], 'present', 'absent', 'role'], placeholder: "ensure", control_label: 'ensure', class: "form-control"%>
|
14
14
|
</div>
|
15
|
-
</div>
|
16
15
|
|
17
|
-
|
18
|
-
<div class="form-group col-md-6">
|
16
|
+
<div class="form-group col-md-3">
|
19
17
|
<label>gid</label>
|
20
|
-
<%= f.text_field :gid, :size => "col-md-
|
18
|
+
<%= f.text_field :gid, :size => "col-md-3", placeholder: "填写gid", class: "form-control" %>
|
21
19
|
</div>
|
22
|
-
<div class="form-group col-md-
|
20
|
+
<div class="form-group col-md-3">
|
23
21
|
<label>groups</label>
|
24
|
-
<%= f.text_field :groups, :size => "col-md-
|
22
|
+
<%= f.text_field :groups, :size => "col-md-3", placeholder: "填写组名", class: "form-control" %>
|
25
23
|
</div>
|
26
24
|
</div>
|
27
25
|
|
28
26
|
|
29
27
|
<div class="row">
|
30
|
-
<div class="form-group col-md-
|
28
|
+
<div class="form-group col-md-3">
|
31
29
|
<label>home</label>
|
32
|
-
<%= f.text_field :home, :size => "col-md-
|
30
|
+
<%= f.text_field :home, :size => "col-md-3", placeholder: "填写用户名", class: "form-control"%>
|
33
31
|
</div>
|
34
|
-
<div class="form-group col-md-
|
32
|
+
<div class="form-group col-md-3">
|
35
33
|
<label>password</label>
|
36
|
-
<%= f.text_field :password, :size => "col-md-
|
34
|
+
<%= f.text_field :password, :size => "col-md-3", placeholder: "填写密码" , class: "form-control"%>
|
37
35
|
</div>
|
38
|
-
</div>
|
39
36
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<label>password_min_age</label>
|
48
|
-
<%= f.text_field :password_min_age, :size => "col-md-6", placeholder: "填写用户名", class: "form-control"%>
|
49
|
-
</div>
|
37
|
+
<div class="form-group col-md-3">
|
38
|
+
<label>password_max_age</label>
|
39
|
+
<%= f.text_field :password_max_age, :size => "col-md-3", placeholder: "填写用户名" , class: "form-control"%>
|
40
|
+
</div>
|
41
|
+
<div class="form-group col-md-3">
|
42
|
+
<label>password_min_age</label>
|
43
|
+
<%= f.text_field :password_min_age, :size => "col-md-3", placeholder: "填写用户名", class: "form-control"%>
|
50
44
|
</div>
|
45
|
+
</div>
|
51
46
|
|
52
47
|
<div class="row">
|
53
48
|
<div class="form-group col-md-6">
|
@@ -59,36 +54,20 @@
|
|
59
54
|
<%= f.text_field :uid, :size => "col-md-6", placeholder: "填写uid,例如:609", class: "form-control"%>
|
60
55
|
</div>
|
61
56
|
</div>
|
62
|
-
<p><span style="color:red">以下为group信息</span>
|
63
|
-
</p>
|
64
|
-
|
57
|
+
<p><span style="color:red">以下为group信息</span></p>
|
65
58
|
<div class="row">
|
66
|
-
<
|
67
|
-
|
68
|
-
<%= f.fields_for :sygroups do |sygroups_form| %>
|
69
|
-
|
70
|
-
<div class="row">
|
71
|
-
<div class=" form-group col-md-4">
|
72
|
-
<%= sygroups_form.text_field :name, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
|
73
|
-
</div>
|
74
|
-
<div class=" form-group col-md-4">
|
75
|
-
<%= sygroups_form.text_field :ensure, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
|
76
|
-
</div>
|
77
|
-
<div class=" form-group col-md-4">
|
78
|
-
<%= sygroups_form.text_field :gid, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
|
79
|
-
</div>
|
59
|
+
<div class="col-md-12 column">
|
60
|
+
<%= render partial: "foreman_users/syusers/sub", locals: { f: f, object: @syuser } %>
|
80
61
|
</div>
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
<%= link_to '返回', foreman_users_syusers_path, class: "btn btn-primary" %>
|
62
|
+
</div>
|
63
|
+
<div class="row">
|
64
|
+
<br /><br />
|
65
|
+
</div>
|
66
|
+
<div class="row">
|
67
|
+
<div class="actions">
|
68
|
+
<%= f.submit "提交", class: "btn btn-success" %>
|
69
|
+
<%= link_to '返回', foreman_users_syusers_path, class: "btn btn-primary" %>
|
70
|
+
</div>
|
71
|
+
</div>
|
92
72
|
</div>
|
93
|
-
<% end %>
|
94
|
-
|
73
|
+
<% end %>
|
@@ -1,19 +1,34 @@
|
|
1
1
|
<div id="sygroups">
|
2
2
|
<%= f.fields_for :sygroups do |f| %>
|
3
3
|
<div class="row">
|
4
|
-
<div class="col-md-
|
5
|
-
|
4
|
+
<div class="col-md-3 column form-group">
|
5
|
+
<label>name</label>
|
6
|
+
<%= f.text_field :name, class: "form_datetime form-control" %>
|
6
7
|
</div>
|
7
|
-
<div class="col-md-
|
8
|
-
|
8
|
+
<div class="col-md-3 column form-group">
|
9
|
+
<label>ensure</label>
|
10
|
+
<%= f.text_field :ensure, class: "form_datetime form-control" %>
|
11
|
+
|
12
|
+
</div>
|
13
|
+
<div class="col-md-3 column form-group">
|
14
|
+
<label>gid</label>
|
15
|
+
<%= f.text_field :gid, class: "form_datetime form-control" %>
|
9
16
|
</div>
|
10
|
-
<div class="col-md-
|
11
|
-
|
17
|
+
<div class="col-md-1 column form-group">
|
18
|
+
<label>delete</label>
|
19
|
+
<%= f.link_to_remove "删除", class: "btn btn-danger" %>
|
12
20
|
</div>
|
13
21
|
</div>
|
14
22
|
<%= f.hidden_field :groupable_id, value: object.id %>
|
15
23
|
<%= f.hidden_field :groupable_type, value: object.class.to_s %>
|
16
24
|
<% end %>
|
17
25
|
</div>
|
26
|
+
<div class="row">
|
27
|
+
<div class="col-md-9 column form-group">
|
18
28
|
|
19
|
-
|
29
|
+
</div>
|
30
|
+
<div class="col-md-1 column form-group">
|
31
|
+
<label></label>
|
32
|
+
<%= f.link_to_add "新增", :sygroups, :data => { :target => "#sygroups" }, class: "btn btn-primary" %>
|
33
|
+
</div>
|
34
|
+
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_users
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,24 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nested_form
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
14
30
|
- !ruby/object:Gem::Dependency
|
15
31
|
name: rubocop
|
16
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,48 +66,49 @@ executables: []
|
|
50
66
|
extensions: []
|
51
67
|
extra_rdoc_files: []
|
52
68
|
files:
|
69
|
+
- app/assets/javascripts/application.js
|
70
|
+
- app/models/foreman_users/sygroup.rb
|
71
|
+
- app/models/foreman_users/syuser.rb
|
72
|
+
- app/overrides/dashboard/index/sample_override.html.erb.deface
|
73
|
+
- app/helpers/foreman_users/syusers_helper.rb
|
53
74
|
- app/views/dashboard/_foreman_users_widget.html.erb
|
54
75
|
- app/views/foreman_users/layouts/layouts/new_layout.html.erb
|
55
76
|
- app/views/foreman_users/layouts/new_layout.html.erb
|
56
|
-
- app/views/foreman_users/syusers/edit.html.erb
|
57
77
|
- app/views/foreman_users/syusers/new.html.erb
|
58
78
|
- app/views/foreman_users/syusers/show.html.erb
|
79
|
+
- app/views/foreman_users/syusers/_sub.html.erb
|
59
80
|
- app/views/foreman_users/syusers/index.html.erb
|
60
|
-
- app/views/foreman_users/syusers/_list.html.erb
|
61
81
|
- app/views/foreman_users/syusers/_form.html.erb
|
62
|
-
- app/views/foreman_users/syusers/
|
63
|
-
- app/views/foreman_users/
|
82
|
+
- app/views/foreman_users/syusers/edit.html.erb
|
83
|
+
- app/views/foreman_users/syusers/_list.html.erb
|
64
84
|
- app/views/foreman_users/hosts/new_action.html.erb
|
65
|
-
- app/
|
85
|
+
- app/views/foreman_users/hosts/hosts/new_action.html.erb
|
66
86
|
- app/controllers/foreman_users/syusers_controller.rb
|
67
|
-
- app/helpers/foreman_users/syusers_helper.rb
|
68
|
-
- app/models/foreman_users/syuser.rb
|
69
|
-
- app/models/foreman_users/sygroup.rb
|
70
87
|
- config/routes.rb
|
71
|
-
- db/migrate/20150918055455_add_syuser_id_to_sygroup.rb
|
72
88
|
- db/migrate/20150918050239_create_sygroups.rb
|
73
|
-
- db/migrate/
|
89
|
+
- db/migrate/20150918055455_add_syuser_id_to_sygroup.rb
|
90
|
+
- db/migrate/20150918022411_create_syusers.rb
|
74
91
|
- db/migrate/syusers/new.html.erb
|
75
92
|
- db/migrate/syusers/show.html.erb
|
93
|
+
- db/migrate/syusers/_sub.html.erb
|
76
94
|
- db/migrate/syusers/index.html.erb
|
77
|
-
- db/migrate/syusers/_list.html.erb
|
78
95
|
- db/migrate/syusers/_form.html.erb
|
79
|
-
- db/migrate/syusers/
|
80
|
-
- db/migrate/
|
81
|
-
- lib/tasks/foreman_users_tasks.rake
|
96
|
+
- db/migrate/syusers/edit.html.erb
|
97
|
+
- db/migrate/syusers/_list.html.erb
|
82
98
|
- lib/foreman_users.rb
|
83
|
-
- lib/foreman_users/version.rb
|
84
99
|
- lib/foreman_users/engine.rb
|
100
|
+
- lib/foreman_users/version.rb
|
101
|
+
- lib/tasks/foreman_users_tasks.rake
|
85
102
|
- locale/gemspec.rb
|
86
103
|
- locale/en/foreman_users.po
|
87
|
-
- locale/Makefile
|
88
104
|
- locale/foreman_users.pot
|
105
|
+
- locale/Makefile
|
89
106
|
- LICENSE
|
90
107
|
- Rakefile
|
91
108
|
- README.md
|
92
|
-
- test/test_plugin_helper.rb
|
93
|
-
- test/unit/foreman_users_test.rb
|
94
109
|
- test/factories/foreman_users_factories.rb
|
110
|
+
- test/unit/foreman_users_test.rb
|
111
|
+
- test/test_plugin_helper.rb
|
95
112
|
homepage: https://github.com/stdtnt/foreman-users
|
96
113
|
licenses: []
|
97
114
|
post_install_message:
|
@@ -117,6 +134,6 @@ signing_key:
|
|
117
134
|
specification_version: 3
|
118
135
|
summary: 创建用户,/etc/puppet/environments/production/modules/users
|
119
136
|
test_files:
|
120
|
-
- test/test_plugin_helper.rb
|
121
|
-
- test/unit/foreman_users_test.rb
|
122
137
|
- test/factories/foreman_users_factories.rb
|
138
|
+
- test/unit/foreman_users_test.rb
|
139
|
+
- test/test_plugin_helper.rb
|