foreman_users 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,8 +26,7 @@ module ForemanUsers
26
26
  # GET /foreman_users/new.json
27
27
  def new
28
28
  @user = foreman_user.new
29
- 5.times { @user.sygroups.build}
30
- #sygroups = @user.sygroups.new
29
+ 5.times { @user.groups.build}
31
30
  respond_to do |format|
32
31
  format.html # new.html.erb
33
32
  format.json { render json: @user }
@@ -37,11 +36,11 @@ module ForemanUsers
37
36
  # GET /foreman_users/1/edit
38
37
  def edit
39
38
  @user = foreman_user.find(params[:id])
40
- sygroup_time = @user.sygroups.size
41
- if sygroup_time == 0
42
- 5.times { @user.sygroups.build}
39
+ group_time = @user.groups.size
40
+ if group_time == 0
41
+ 5.times { @user.groups.build}
43
42
  else
44
- 5.times { @user.sygroups.build}
43
+ 5.times { @user.groups.build}
45
44
  end
46
45
  end
47
46
 
@@ -1,4 +1,4 @@
1
- module ForemanHosts
1
+ module ForemanUsers
2
2
  module UsersHelper
3
3
  end
4
4
  end
@@ -1,5 +1,5 @@
1
1
  module ForemanUsers
2
- class Sygroup < ActiveRecord::Base
2
+ class Group < ActiveRecord::Base
3
3
  attr_accessible :name, :ensure, :gid, :groupable_type, :groupable_id, :user_id
4
4
  belongs_to :user, class_name: "ForemanUsers::User"
5
5
  end
@@ -1,7 +1,7 @@
1
1
  module ForemanUsers
2
- class Syuser < ActiveRecord::Base
2
+ class User < ActiveRecord::Base
3
3
  require "fileutils"
4
- attr_accessible :title, :body, :name, :ensure , :gid, :groups, :home , :password, :password_max_age, :password_min_age, :shell, :uid, :sygroups_attributes
4
+ attr_accessible :title, :body, :name, :ensure , :gid, :groups, :home , :password, :password_max_age, :password_min_age, :shell, :uid, :groups_attributes
5
5
 
6
6
 
7
7
  has_many :groups, :class_name => 'ForemanTasks::Group', :foreign_key => :user_id
@@ -55,9 +55,9 @@ module ForemanUsers
55
55
  user_content = "class users {" + "\n" + "\s\s" + "user { '" + self.name + "':" + "\n\s\s\s\s" + "ensure => '" + self.ensure + "'," + "\n\s\s\s\s" + "gid => '" + self.gid + "'," + "\n\s\s\s\s" + "groups => [" + self.groups + "]," + "\n\s\s\s\s" + "home => '" + self.home + "'," + "\n\s\s\s\s" + "password => '" + self.password + "'," + "\n\s\s\s\s" + "password_max_age => '" + self.password_max_age + "'," + "\n\s\s\s\s" + "password_min_age => '" + self.password_min_age + "'," + "\n\s\s\s\s" + "shell => '" + self.shell + "'," + "\n\s\s\s\s" + "uid => '" + self.uid + "'," + "\n\s\s" +"}" + "\n"
56
56
 
57
57
  group_content = "\s\s"
58
- if self.sygroups.size > 0
59
- self.sygroups.each do |sygroup|
60
- group_content += "group {'"+ sygroup.name + "':" + "\n\s\s\s\s" + "ensure => '" + sygroup.ensure + "'," + "\n\s\s\s\s" + "gid => '" + sygroup.gid + "'," + "\n\s\s" +"}" + "\n\s\s"
58
+ if self.groups.size > 0
59
+ self.groups.each do |group|
60
+ group_content += "group {'"+ group.name + "':" + "\n\s\s\s\s" + "ensure => '" + group.ensure + "'," + "\n\s\s\s\s" + "gid => '" + group.gid + "'," + "\n\s\s" +"}" + "\n\s\s"
61
61
  end
62
62
  end
63
63
  rs = user_content + group_content + "\n" + "}"
@@ -65,17 +65,17 @@
65
65
  <div class="row">
66
66
  <label class=" col-md-4">name</label><label class=" col-md-4">ensure</label><label class=" col-md-4">gid</label>
67
67
  </div>
68
- <%= f.fields_for :sygroups do |sygroups_form| %>
68
+ <%= f.fields_for :groups do |groups_form| %>
69
69
 
70
70
  <div class="row">
71
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"%>
72
+ <%= groups_form.text_field :name, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
73
73
  </div>
74
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"%>
75
+ <%= groups_form.text_field :ensure, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
76
76
  </div>
77
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"%>
78
+ <%= groups_form.text_field :gid, :size => "col-md-4", placeholder: "填写shell,例如: /bin/bash" , class: "form-control"%>
79
79
  </div>
80
80
  </div>
81
81
 
@@ -63,11 +63,11 @@
63
63
  <th>gid</th>
64
64
  </thead>
65
65
  <tbody>
66
- <% @user.sygroups.each do |sygroup|%>
66
+ <% @user.groups.each do |group|%>
67
67
  <tr class="success">
68
- <td><%= sygroup.name %></td>
69
- <td><%= sygroup.ensure %></td>
70
- <td><%= sygroup.gid %></td>
68
+ <td><%= group.name %></td>
69
+ <td><%= group.ensure %></td>
70
+ <td><%= group.gid %></td>
71
71
  </tr>
72
72
  <% end %>
73
73
  </tbody>
@@ -1,3 +1,3 @@
1
1
  module ForemanUsers
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
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: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: