foreman_users 0.0.18.3 → 0.0.18.4

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.
@@ -1,5 +1,4 @@
1
- module ForemanUsers
2
- class UsersController < ApplicationController
1
+ class ForemanUsers::UsersController < ApplicationController
3
2
  # GET /foreman_users
4
3
  # GET /foreman_users.json
5
4
  def index
@@ -26,7 +25,7 @@ module ForemanUsers
26
25
  # GET /foreman_users/new.json
27
26
  def new
28
27
  @foreman_users_user = ForemanUsers::User.new
29
- 5.times { @foreman_users_user.groups.build}
28
+ 5.times { @foreman_users_user.foreman_users_groups.build}
30
29
  respond_to do |format|
31
30
  format.html # new.html.erb
32
31
  format.json { render json: @foreman_users_user }
@@ -36,11 +35,11 @@ module ForemanUsers
36
35
  # GET /foreman_users/1/edit
37
36
  def edit
38
37
  @foreman_users_user = ForemanUsers::User.find(params[:id])
39
- group_time = @foreman_users_user.groups.size
38
+ group_time = @foreman_users_user.foreman_users_groups.size
40
39
  if group_time == 0
41
- 5.times { @foreman_users_user.groups.build}
40
+ 5.times { @foreman_users_user.foreman_users_groups.build}
42
41
  else
43
- 5.times { @foreman_users_user.groups.build}
42
+ 5.times { @foreman_users_user.foreman_users_groups.build}
44
43
  end
45
44
  end
46
45
 
@@ -89,5 +88,4 @@ module ForemanUsers
89
88
 
90
89
 
91
90
  end
92
- end
93
- end
91
+ end
@@ -1,6 +1,4 @@
1
- module ForemanUsers
2
- class Group < ActiveRecord::Base
3
- attr_accessible :groupname, :ensure, :gid, :groupable_type, :groupable_id, :user_id
4
- belongs_to :user, class_name: "ForemanUsers::User"
5
- end
6
- end
1
+ class ForemanUsers::Group < ActiveRecord::Base
2
+ attr_accessible :groupname, :ensure, :gid, :groupable_type, :groupable_id, :user_id
3
+ belongs_to :user, class_name: "ForemanUsers::User"
4
+ end
@@ -1,11 +1,10 @@
1
1
  require "fileutils"
2
- module ForemanUsers
3
- class User < ActiveRecord::Base
2
+ class ForemanUsers::User < ActiveRecord::Base
4
3
 
5
4
  attr_accessible :title, :body, :username, :ensure , :gid, :groups, :home , :password, :password_max_age, :password_min_age, :shell, :uid, :groups_attributes
6
5
 
7
6
 
8
- has_many :groups, :class_name => 'ForemanUsers::ForemanUsers::Group', :foreign_key => :user_id
7
+ has_many :foreman_users_groups, :class_name => 'ForemanUsers::ForemanUsers::Group', :foreign_key => :user_id
9
8
  accepts_nested_attributes_for :groups, reject_if: proc { |attributes| attributes['gid'].blank?| attributes['name'].blank? | attributes['ensure'].blank? } , allow_destroy: true
10
9
 
11
10
  after_create :create_dir
@@ -64,5 +63,4 @@ module ForemanUsers
64
63
  rs = user_content + group_content + "\n" + "}"
65
64
  return rs
66
65
  end
67
- end
68
- end
66
+ end
@@ -65,7 +65,7 @@
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 :groups do |groups_form| %>
68
+ <%= f.fields_for :foreman_users_groups do |groups_form| %>
69
69
 
70
70
  <div class="row">
71
71
  <div class=" form-group col-md-4">
@@ -63,7 +63,7 @@
63
63
  <th>gid</th>
64
64
  </thead>
65
65
  <tbody>
66
- <% @foreman_users_user.groups.each do |group|%>
66
+ <% @foreman_users_user.foreman_users_groups.each do |group|%>
67
67
  <tr class="success">
68
68
  <td><%= group.groupname %></td>
69
69
  <td><%= group.ensure %></td>
@@ -1,3 +1,3 @@
1
1
  module ForemanUsers
2
- VERSION = '0.0.18.3'
2
+ VERSION = '0.0.18.4'
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.18.3
4
+ version: 0.0.18.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: