ums 0.1.2 → 0.3.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5101be15cbdf7965aaee189cb36a08c9562daec7
4
- data.tar.gz: e8a1c75f9569e1a5eb75c6f912995b40199decde
2
+ SHA256:
3
+ metadata.gz: 168c81adc44f02cbff580af61a72f4326c8f9b5da643c0b2b7f86f89e80f2291
4
+ data.tar.gz: 42314bb532ee6006e7ff7cfdb6683cadb572b7a01a756a12768deb6a7f8ad1e1
5
5
  SHA512:
6
- metadata.gz: 7a17f81f6c8d738582086e90a32b2beaa83e9eab64b762a0fcc7f513a945d123b6fe59b475baa28bf7e04cb8e3513128267eedfbe0fe560cf87b3eacb9fa33b0
7
- data.tar.gz: c023ec6279fc0492952656e8dc1075455daf956152c4372436b6ce2295261a407890aa5aeee510fcd01a37e7f120bc8a2395b9e0c4997468572b5b9050033ee8
6
+ metadata.gz: a29d6eae1d8e5506febf29f05efc55f85bd5ea9ea44accd1a46814ec75ca3ea8bdc08bf2d969d9b209739d013243dc74eb652c74d81abc70b68ab1b0e431e07d
7
+ data.tar.gz: aaed192e3ee9eb00cdce7751c398587f4a68144702fca5024089b599fc81f751310368cde785712c4699c86a53df8c2abfb2839a04f9201b8005ac39c9d46409
@@ -0,0 +1,16 @@
1
+ /*
2
+ CryptoJS v3.1.2
3
+ code.google.com/p/crypto-js
4
+ (c) 2009-2013 by Jeff Mott. All rights reserved.
5
+ code.google.com/p/crypto-js/wiki/License
6
+ */
7
+ var CryptoJS=CryptoJS||function(h,s){var f={},t=f.lib={},g=function(){},j=t.Base={extend:function(a){g.prototype=this;var c=new g;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
8
+ q=t.WordArray=j.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||u).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
9
+ 32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=j.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new q.init(c,a)}}),v=f.enc={},u=v.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b,
10
+ 2),16)<<24-4*(b%8);return new q.init(d,c/2)}},k=v.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},l=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}},
11
+ x=t.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=l.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var m=0;m<a;m+=e)this._doProcessBlock(d,m);m=d.splice(0,a);c.sigBytes-=b}return new q.init(m,b)},clone:function(){var a=j.clone.call(this);
12
+ a._data=this._data.clone();return a},_minBufferSize:0});t.Hasher=x.extend({cfg:j.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){x.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return(new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return(new w.HMAC.init(a,
13
+ d)).finalize(c)}}});var w=f.algo={};return f}(Math);
14
+ (function(h){for(var s=CryptoJS,f=s.lib,t=f.WordArray,g=f.Hasher,f=s.algo,j=[],q=[],v=function(a){return 4294967296*(a-(a|0))|0},u=2,k=0;64>k;){var l;a:{l=u;for(var x=h.sqrt(l),w=2;w<=x;w++)if(!(l%w)){l=!1;break a}l=!0}l&&(8>k&&(j[k]=v(h.pow(u,0.5))),q[k]=v(h.pow(u,1/3)),k++);u++}var a=[],f=f.SHA256=g.extend({_doReset:function(){this._hash=new t.init(j.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],m=b[2],h=b[3],p=b[4],j=b[5],k=b[6],l=b[7],n=0;64>n;n++){if(16>n)a[n]=
15
+ c[d+n]|0;else{var r=a[n-15],g=a[n-2];a[n]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+a[n-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+a[n-16]}r=l+((p<<26|p>>>6)^(p<<21|p>>>11)^(p<<7|p>>>25))+(p&j^~p&k)+q[n]+a[n];g=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&m^f&m);l=k;k=j;j=p;p=h+r|0;h=m;m=f;f=e;e=r+g|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+m|0;b[3]=b[3]+h|0;b[4]=b[4]+p|0;b[5]=b[5]+j|0;b[6]=b[6]+k|0;b[7]=b[7]+l|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;
16
+ d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=g.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=g._createHelper(f);s.HmacSHA256=g._createHmacHelper(f)})(Math);
@@ -1,4 +1,7 @@
1
1
  module Ums
2
2
  class ApplicationController < ActionController::Base
3
+
4
+ before_action :set_current_session
5
+ after_action :operate_log
3
6
  end
4
7
  end
@@ -31,7 +31,7 @@ class Ums::FunctionsController < ApplicationController
31
31
  format.html { redirect_to ums.functions_url, notice: '功能创建创建成功.' }
32
32
  format.json { render action: 'show', status: :created, location: @ums_function }
33
33
  else
34
- format.html { render action: 'new' }
34
+ format.html { render action: 'new' , status: :unprocessable_entity}
35
35
  format.json { render json: @ums_function.errors, status: :unprocessable_entity }
36
36
  end
37
37
  end
@@ -45,7 +45,7 @@ class Ums::FunctionsController < ApplicationController
45
45
  format.html { redirect_to ums.functions_url, notice: '功能修改成功' }
46
46
  format.json { head :no_content }
47
47
  else
48
- format.html { render action: 'edit' }
48
+ format.html { render action: 'edit' , status: :unprocessable_entity}
49
49
  format.json { render json: @ums_function.errors, status: :unprocessable_entity }
50
50
  end
51
51
  end
@@ -3,7 +3,15 @@ class Ums::LogsController < ApplicationController
3
3
  # GET /ums/logs
4
4
  # GET /ums/logs.json
5
5
  def index
6
- @ums_logs = Ums::Log.all.page(params[:page]).order("id DESC")
6
+ where = "1"
7
+ where += " AND level = '#{params[:level]}'" unless params[:level].blank?
8
+ where += " AND log_type = '#{params[:log_type]}'" unless params[:log_type].blank?
9
+ where += " AND operator = '#{params[:operator]}'" unless params[:operator].blank?
10
+ where += " AND model_class like '#{params[:model_class]}%'" unless params[:model_class].blank?
11
+ where += " AND model_id = #{params[:model_id]}" unless params[:model_id].blank?
12
+ where += " AND ip like '#{params[:ip]}%'" unless params[:ip].blank?
13
+ where += " AND created_at like '#{params[:created_at]}%'" unless params[:created_at].blank?
14
+ @ums_logs = Ums::Log.where(where).page(params[:page]).order("id DESC")
7
15
  end
8
16
 
9
17
  end
@@ -32,7 +32,7 @@ class Ums::RolesController < ApplicationController
32
32
  format.html { redirect_to ums.roles_url, notice: '角色创建成功.' }
33
33
  format.json { render action: 'show', status: :created, location: @ums_role }
34
34
  else
35
- format.html { render action: 'new' }
35
+ format.html { render action: 'new' , status: :unprocessable_entity}
36
36
  format.json { render json: @ums_role.errors, status: :unprocessable_entity }
37
37
  end
38
38
  end
@@ -46,7 +46,7 @@ class Ums::RolesController < ApplicationController
46
46
  format.html { redirect_to ums.roles_url, notice: '角色修改成功.' }
47
47
  format.json { head :no_content }
48
48
  else
49
- format.html { render action: 'edit' }
49
+ format.html { render action: 'edit' , status: :unprocessable_entity}
50
50
  format.json { render json: @ums_role.errors, status: :unprocessable_entity }
51
51
  end
52
52
  end
@@ -1,7 +1,7 @@
1
1
  class Ums::UsersController < ApplicationController
2
2
 
3
- skip_before_filter :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
4
- skip_before_filter :authorize, :only => [:login,:logout]
3
+ skip_before_action :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
4
+ skip_before_action :authorize, :only => [:login,:logout]
5
5
 
6
6
  before_action :set_ums_user, only: [:show, :edit, :update, :destroy]
7
7
  before_action :set_ums_roles, only: [:new,:edit,:update,:create]
@@ -34,7 +34,7 @@ class Ums::UsersController < ApplicationController
34
34
 
35
35
  uri = session[:original_uri]
36
36
  session[:original_uri] = nil
37
- log_info("login",params[:account] + " login success",request.remote_ip)
37
+ log_info("login",params[:account] + "登录成功")
38
38
 
39
39
  user_permission = '^redactor_rails|welcome|profile|password|' # 上传组件和用户基础操作默认许可
40
40
  user.role.functions.each do |function|
@@ -55,7 +55,7 @@ class Ums::UsersController < ApplicationController
55
55
  end
56
56
 
57
57
  else
58
- log_error("login",params[:account] + " login failed",request.remote_ip)
58
+ log_error("login",params[:account] + "登录失败")
59
59
  respond_to do |format|
60
60
  error_info = "无效的账号或密码"
61
61
  format.html { flash.now[:notice] = error_info }
@@ -67,6 +67,7 @@ class Ums::UsersController < ApplicationController
67
67
  end
68
68
 
69
69
  def logout
70
+ log_info("logout",session[:user_account].to_s + "退出登录")
70
71
  session[:user_id] = nil
71
72
  session[:user_account] = nil
72
73
  session[:user_name] = nil
@@ -74,7 +75,7 @@ class Ums::UsersController < ApplicationController
74
75
  session[:last_login_ip] = nil
75
76
  session[:login_count] = nil
76
77
  #flash[:notice] = "已退出"
77
- redirect_to '/'
78
+ redirect_to root_path
78
79
  end
79
80
 
80
81
  def password
@@ -91,28 +92,33 @@ class Ums::UsersController < ApplicationController
91
92
  flash.now[:error] = "新密码不能为空"
92
93
  return
93
94
  end
94
- user = Ums::User.find_by_id(session[:user_id])
95
+ user = Ums::User.find_by_id(session[:user_id])
95
96
  if user.verify_password(params[:old_password])
96
97
  user.password=params[:new_password]
97
- user.save
98
- flash.now[:notice] = "密码修改成功"
99
- params.delete(:new_password)
100
- params.delete(:old_password)
101
- params.delete(:re_password)
98
+ if user.save
99
+ flash.now[:notice] = "密码修改成功"
100
+ params.delete(:new_password)
101
+ params.delete(:old_password)
102
+ params.delete(:re_password)
103
+ else
104
+ flash.now[:error] = user.errors.full_messages.to_s
105
+ end
102
106
  else
103
107
  flash.now[:error] = "旧密码输入错误"
104
- end
108
+ end
109
+ render status: :unprocessable_entity
105
110
  end
106
111
  end
107
112
 
108
113
  def profile
109
114
  @ums_user = Ums::User.find_by_id(session[:user_id])
110
115
  if request.patch?
111
- if @ums_user.update(params.require(:user).permit(:email))
112
- flash.now[:notice] = "资料修改成功"
113
- else
114
- flash.now[:error] = "资料修改失败"
115
- end
116
+ if @ums_user.update(params.require(:user).permit(:email))
117
+ flash.now[:notice] = "资料修改成功"
118
+ else
119
+ flash.now[:error] = "资料修改失败"
120
+ end
121
+ render status: :unprocessable_entity
116
122
  end
117
123
  end
118
124
 
@@ -141,7 +147,7 @@ class Ums::UsersController < ApplicationController
141
147
  format.html { redirect_to ums.users_url, notice: '用户创建成功.' }
142
148
  format.json { render action: 'show', status: :created, location: @ums_user }
143
149
  else
144
- format.html { render action: 'new' }
150
+ format.html { render action: 'new' , status: :unprocessable_entity }
145
151
  format.json { render json: @ums_user.errors, status: :unprocessable_entity }
146
152
  end
147
153
  end
@@ -155,7 +161,7 @@ class Ums::UsersController < ApplicationController
155
161
  format.html { redirect_to ums.users_url, notice: '用户修改成功.' }
156
162
  format.json { head :no_content }
157
163
  else
158
- format.html { render action: 'edit' }
164
+ format.html { render action: 'edit', status: :unprocessable_entity }
159
165
  format.json { render json: @ums_user.errors, status: :unprocessable_entity }
160
166
  end
161
167
  end
@@ -1,7 +1,46 @@
1
1
  module Ums
2
2
  module ApplicationHelper
3
3
 
4
- def authorize
4
+ #为ActiveRecord类设置session变量
5
+ def set_current_session
6
+ # Define an accessor. The session is always in the current controller
7
+ # instance in @_request.session. So we need a way to access this in
8
+ # our model
9
+ accessor = instance_variable_get(:@_request)
10
+
11
+ # This defines a method session in ActiveRecord::Base. If your model
12
+ # inherits from another Base Class (when using MongoMapper or similar),
13
+ # insert the class here.
14
+ ActiveRecord::Base.send(:define_method, "session", proc {accessor.session})
15
+ end
16
+
17
+ #操作日志,主要针对model的增删改
18
+ def operate_log
19
+ log = Ums::Log.new
20
+ log.level="info"
21
+ log.log_type= action_name
22
+ log.ip= request.remote_ip
23
+ log.operator = session[:user_account] unless session[:user_account].blank?
24
+ model_class = self.class.name.sub("Controller", "")
25
+ #logger.debug("model_class:"+ model_class)
26
+ log.model_class = model_class
27
+ model_var_name = model_class.singularize.sub("::", "_").downcase
28
+ model_var = instance_variable_get("@"+model_var_name)
29
+ if model_var && model_var.kind_of?(ActiveRecord::Base)
30
+ log.model_id = model_var.id
31
+ log.data = ""
32
+ log.data = model_var.name if model_var.has_attribute?(:name) && model_var.name
33
+ log.data = model_var.title if model_var.has_attribute?(:title) && model_var.title
34
+ if !model_var.errors.blank?
35
+ log.level="error"
36
+ log.data += model_var.errors.full_messages.to_s
37
+ end
38
+ end
39
+ log.save
40
+ end
41
+
42
+ #用户访问权限检查
43
+ def authorize
5
44
  #unless Account.find_by_id(session[:account_id])
6
45
  if session[:user_id].nil?
7
46
  session[:original_uri] = request.url
@@ -12,35 +51,44 @@ module Ums
12
51
 
13
52
  path = params[:controller] + "/" + params[:action]
14
53
  unless validate_permission(path)
15
- render status: :forbidden, text: "对不起,您没有访问该地址的权限"
54
+ render status: :forbidden,plain: "对不起,您没有访问该地址的权限"
16
55
  end
17
- end
18
-
19
- def log_info(log_type,log_content,log_ip)
20
- log = Ums::Log.new
21
- log.level="info"
22
- log.log_type=log_type
23
- log.data=log_content
24
- log.ip=log_ip
25
- log.save
26
- end
56
+ end
57
+
58
+ #根据访问路径判断访问权限
59
+ def validate_permission(path)
60
+ permission = session[:user_permission]
27
61
 
28
- def log_error(log_type,log_content,log_ip)
29
- log = Ums::Log.new
30
- log.level="error"
31
- log.log_type=log_type
32
- log.data=log_content
33
- log.ip=log_ip
34
- log.save
35
- end
62
+ logger.debug("user_permission:" + permission.to_s)
63
+ logger.debug("user_path:" + path.to_s)
64
+ return false if permission.nil? || path.nil?
65
+ is_validated = path.match(permission)
66
+ is_validated = (path + "/index").match(permission) unless is_validated #增加模块默认地址检测
36
67
 
37
- def validate_permission(path)
38
- permission = session[:user_permission]
68
+ return is_validated
69
+ end
70
+
71
+ #记录信息日志
72
+ def log_info(log_type,log_content)
73
+ log = Ums::Log.new
74
+ log.level="info"
75
+ log.log_type=log_type
76
+ log.data=log_content
77
+ log.ip=request.remote_ip
78
+ log.operator = session[:user_account] unless session[:user_account].blank?
79
+ log.save
80
+ end
81
+
82
+ #记录错误日志
83
+ def log_error(log_type,log_content)
84
+ log = Ums::Log.new
85
+ log.level="error"
86
+ log.log_type=log_type
87
+ log.data=log_content
88
+ log.ip=request.remote_ip
89
+ log.operator = session[:user_account] unless session[:user_account].blank?
90
+ log.save
91
+ end
39
92
 
40
- logger.debug("user_permission:" + permission) unless permission.nil?
41
- logger.debug("user_path:" + path) unless path.nil?
42
- return false if permission.nil? || path.nil?
43
- return path.match(permission)
44
- end
45
93
  end
46
94
  end
@@ -3,4 +3,18 @@ class Ums::Function < ActiveRecord::Base
3
3
  validates_presence_of :name
4
4
  validates_presence_of :controller
5
5
  validates_uniqueness_of :name
6
+
7
+ belongs_to :created_by, class_name: "Ums::User"
8
+ belongs_to :updated_by, class_name: "Ums::User"
9
+
10
+ before_validation :record_operator
11
+
12
+ #记录操作人员
13
+ def record_operator
14
+
15
+ if self.respond_to?(:session) && session[:user_id]
16
+ self.created_by_id = session[:user_id] if new_record?
17
+ self.updated_by_id = session[:user_id]
18
+ end
19
+ end
6
20
  end
@@ -1,2 +1,26 @@
1
1
  class Ums::Log < ActiveRecord::Base
2
+
3
+ def level_name
4
+ name = level
5
+ name = '错误' if self.level == 'error'
6
+ name = '信息' if self.level == 'info'
7
+ name
8
+ end
9
+ def self.level_options
10
+ [['错误', 'error'], ['信息', 'info']]
11
+ end
12
+
13
+ def log_type_name
14
+ name = log_type
15
+ name = '登录' if self.log_type == 'login'
16
+ name = '退出' if self.log_type == 'logout'
17
+ name = '新建' if self.log_type == 'create'
18
+ name = '修改' if self.log_type == 'update'
19
+ name = '删除' if self.log_type == 'destroy'
20
+ name
21
+ end
22
+ def self.log_type_options
23
+ [['登录', 'login'], ['退出', 'logout'], ['新建', 'create'], ['修改', 'update'],
24
+ ['删除', 'destroy']]
25
+ end
2
26
  end
@@ -2,4 +2,17 @@ class Ums::Role < ActiveRecord::Base
2
2
  has_and_belongs_to_many :functions
3
3
  validates_presence_of :name
4
4
  validates_uniqueness_of :name
5
+
6
+ belongs_to :created_by, class_name: "Ums::User"
7
+ belongs_to :updated_by, class_name: "Ums::User"
8
+
9
+ before_validation :record_operator
10
+
11
+ #记录操作人员
12
+ def record_operator
13
+ if self.respond_to?(:session) && session[:user_id]
14
+ self.created_by_id = session[:user_id] if new_record?
15
+ self.updated_by_id = session[:user_id]
16
+ end
17
+ end
5
18
  end
@@ -6,6 +6,18 @@ class Ums::User < ActiveRecord::Base
6
6
 
7
7
  validate :password_non_blank
8
8
 
9
+ belongs_to :created_by, class_name: "Ums::User"
10
+ belongs_to :updated_by, class_name: "Ums::User"
11
+
12
+ before_validation :record_operator
13
+
14
+ #记录操作人员
15
+ def record_operator
16
+ if self.respond_to?(:session) && session[:user_id]
17
+ self.created_by_id = session[:user_id] if new_record?
18
+ self.updated_by_id = session[:user_id]
19
+ end
20
+ end
9
21
 
10
22
  def self.authenticate(account,password)
11
23
  user = self.find_by_account(account)
@@ -48,11 +60,10 @@ class Ums::User < ActiveRecord::Base
48
60
 
49
61
  private
50
62
  def password_non_blank
51
- errors.add(:password,"missing password") if hashed_password.blank?
52
-
63
+ errors.add(:password,"missing password") if hashed_password.blank?
53
64
  end
54
- def self.encrypted_password(password,slat)
55
- Digest::SHA1.hexdigest(password+slat)
65
+ def self.encrypted_password(password,slat)
66
+ Digest::SHA2.hexdigest(password.to_s + slat.to_s)
56
67
  end
57
68
  def create_salt
58
69
  self.salt = rand.to_s
@@ -13,6 +13,9 @@
13
13
  <th>功能名称</th>
14
14
  <th>模块名称</th>
15
15
  <th>操作名称</th>
16
+ <th>创建人</th>
17
+ <th>修改人</th>
18
+ <th>修改时间</th>
16
19
  <th></th>
17
20
  <th></th>
18
21
  </tr>
@@ -24,8 +27,11 @@
24
27
  <td><%= ums_function.name %></td>
25
28
  <td><%= ums_function.controller %></td>
26
29
  <td><%= ums_function.action %></td>
30
+ <td><%= ums_function.created_by.account if ums_function.created_by %></td>
31
+ <td><%= ums_function.updated_by.account if ums_function.updated_by %></td>
32
+ <td><%= ums_function.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
27
33
  <td><%= link_to '修改', ums.edit_function_path(ums_function) %></td>
28
- <td><%= link_to '删除', ums_function, method: :delete, data: { confirm: 'Are you sure?' } %></td>
34
+ <td><%= link_to '删除', ums_function, method: :delete, data: { confirm: '您确定要删除?' } %></td>
29
35
  </tr>
30
36
  <% end %>
31
37
  </tbody>
@@ -1,11 +1,36 @@
1
+ <%= form_tag nil,method: :get,id:"search_form" do %>
2
+ <div class="row">
3
+ <div class="col-md-2">
1
4
  <h1>日志列表</h1>
5
+ </div>
6
+ <div class="col-md-1" style="margin-top: 30px;margin-bottom: 0px;line-height:34px;">
7
+ <%= select_tag :level, options_for_select(Ums::Log.level_options,params[:level]), prompt: "日志级别" %>
8
+ </div>
9
+ <div class="col-md-1" style="margin-top: 30px;margin-bottom: 0px;line-height:34px;">
10
+ <%= select_tag :log_type, options_for_select(Ums::Log.log_type_options,params[:log_type]), prompt: "日志类型" %>
11
+ </div>
12
+ <div class="col-md-2" style="margin-top: 30px;margin-bottom: 0px;">
13
+ <%= text_field_tag :operator,params[:operator],class:"form-control",placeholder:"操作人员"%>
14
+ </div>
15
+ <div class="col-md-2" style="margin-top: 30px;margin-bottom: 0px;">
16
+ <%= text_field_tag :ip,params[:ip],class:"form-control",placeholder:"操作IP"%>
17
+ </div>
18
+ <div class="col-md-2" style="margin-top: 30px;margin-bottom: 0px;">
19
+ <%= text_field_tag :created_at,params[:created_at],class:"form-control",placeholder:"操作时间"%>
20
+ </div>
21
+ <div class="col-md-1" style="margin-top: 30px;margin-bottom: 0px; ">
22
+ <%= submit_tag "搜索" ,:class => "btn btn-info" %>
23
+ </div>
24
+ </div>
25
+ <% end %>
2
26
 
3
27
  <table class="table table-striped table-bordered table-condensed">
4
28
  <thead>
5
29
  <tr>
30
+ <th>日志级别</th>
6
31
  <th>日志类型</th>
7
- <th>日志级别</th>
8
32
  <th>日志内容</th>
33
+ <th>操作人员</th>
9
34
  <th>操作IP</th>
10
35
  <th>操作时间</th>
11
36
  </tr>
@@ -14,9 +39,12 @@
14
39
  <tbody>
15
40
  <% @ums_logs.each do |ums_log| %>
16
41
  <tr>
17
- <td><%= ums_log.log_type %></td>
18
- <td><%= ums_log.level %></td>
19
- <td><%= ums_log.data %></td>
42
+ <td><%= ums_log.level_name %></td>
43
+ <td><%= ums_log.log_type_name %></td>
44
+ <td><%= ums_log.model_class + "(" + ums_log.model_id.to_s + ")" +
45
+ ":" unless ums_log.model_class.blank? %>
46
+ <%= ums_log.data %></td>
47
+ <td><%= ums_log.operator %></td>
20
48
  <td><%= ums_log.ip %></td>
21
49
  <td><%= ums_log.created_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
22
50
  </tr>
@@ -12,7 +12,7 @@
12
12
  <% end %>
13
13
 
14
14
  <div class="field">
15
- <%= f.label :name %>
15
+ <%= f.label :name,'角色名称' %>
16
16
  <%= f.text_field :name %>
17
17
  </div>
18
18
  <div class="field">
@@ -12,6 +12,9 @@
12
12
  <tr>
13
13
  <th>角色名称</th>
14
14
  <th>相关功能</th>
15
+ <th>创建人</th>
16
+ <th>修改人</th>
17
+ <th>修改时间</th>
15
18
  <th></th>
16
19
  <th></th>
17
20
  </tr>
@@ -28,8 +31,11 @@
28
31
  end
29
32
  %>
30
33
  </td>
34
+ <td><%= ums_role.created_by.account if ums_role.created_by %></td>
35
+ <td><%= ums_role.updated_by.account if ums_role.updated_by %></td>
36
+ <td><%= ums_role.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
31
37
  <td><%= link_to '修改', ums.edit_role_path(ums_role) %></td>
32
- <td><%= link_to '删除', ums_role, method: :delete, data: { confirm: 'Are you sure?' } %></td>
38
+ <td><%= link_to '删除', ums_role, method: :delete, data: { confirm: '您确定要删除?' } %></td>
33
39
  </tr>
34
40
  <% end %>
35
41
  </tbody>
@@ -1,3 +1,4 @@
1
+ <%= javascript_include_tag "ums/application" %>
1
2
  <%= form_for(@ums_user) do |f| %>
2
3
  <% if @ums_user.errors.any? %>
3
4
  <div id="error_explanation">
@@ -36,9 +37,26 @@
36
37
  <%= f.check_box :is_enabled %>
37
38
  </div>
38
39
  <div class="actions">
39
- <%= f.submit ' 保存 ',:class => 'btn btn-primary',data: { disable_with: '正在保存...' }%>
40
+ <%= f.submit ' 保存 ',:class => 'btn btn-primary',data: { disable_with: '正在保存...' } ,:onclick => "return validate_form();"%>
40
41
  &nbsp;&nbsp;
41
42
  <%= link_to ' 返回 ', ums.users_path,:class => "btn btn-default" %>
42
43
  </div>
43
44
  <% end %>
44
45
 
46
+ <script type="text/javascript">
47
+ function validate_form (){
48
+ var account = $("#user_account").val();
49
+ var password = $("#user_password").val();
50
+ if (account == "") {
51
+ alert("请输入账号");
52
+ $("#user_account").focus();
53
+ return false;
54
+ };
55
+ if (password != "") {
56
+ password = CryptoJS.SHA256(account + CryptoJS.SHA256(password)).toString(CryptoJS.enc.Hex);
57
+ $("#user_password").val(password);
58
+ };
59
+
60
+ return true;
61
+ }
62
+ </script>
@@ -18,6 +18,9 @@
18
18
  <th>登录次数</th>
19
19
  <th>角色</th>
20
20
  <th>是否可用</th>
21
+ <th>创建人</th>
22
+ <th>修改人</th>
23
+ <th>修改时间</th>
21
24
  <th></th>
22
25
  <th></th>
23
26
  </tr>
@@ -36,8 +39,11 @@
36
39
  <td><span class="label <%= ums_user.is_enabled ? 'label-success' : 'label-default' %>">
37
40
  <%= ums_user.is_enabled ? '是' : '否' %>
38
41
  </span></td>
42
+ <td><%= ums_user.created_by.account if ums_user.created_by %></td>
43
+ <td><%= ums_user.updated_by.account if ums_user.updated_by %></td>
44
+ <td><%= ums_user.updated_at.strftime('%Y-%m-%d %H:%M:%S') %></td>
39
45
  <td><%= link_to '修改', ums.edit_user_path(ums_user) %></td>
40
- <td><%= link_to '删除', ums_user, method: :delete, data: { confirm: 'Are you sure?' } %></td>
46
+ <td><%= link_to '删除', ums_user, method: :delete, data: { confirm: '您确定要删除?' } %></td>
41
47
  </tr>
42
48
  <% end %>
43
49
  </tbody>
@@ -1,3 +1,5 @@
1
+ <%= javascript_include_tag "ums/application" %>
2
+
1
3
  <% if flash[:notice] || flash[:error] %>
2
4
  <div class="alert <%= "alert-success" if flash[:notice] %> <%= "alert-error" if flash[:error] %>">
3
5
  <a class="close" data-dismiss="alert">×</a>
@@ -16,7 +18,28 @@
16
18
  <%= password_field_tag :password,params[:password] %>
17
19
  </div>
18
20
  <div>
19
- <%= submit_tag "登录" ,:class => "btn btn-primary" %>
21
+ <%= submit_tag "登录" ,:class => "btn btn-primary" ,:onclick => "return validate_form();"%>
20
22
  </div>
21
23
  </fieldset>
22
- <% end %>
24
+ <% end %>
25
+ <script type="text/javascript">
26
+ function validate_form (){
27
+ var account = $("#account").val();
28
+ var password = $("#password").val();
29
+ if (account == "") {
30
+ alert("请输入账号");
31
+ $("#account").focus();
32
+ return false;
33
+ };
34
+ if (password == "") {
35
+ alert("输入密码");
36
+ $("#password").focus();
37
+ return false;
38
+ };
39
+
40
+ password = CryptoJS.SHA256(account + CryptoJS.SHA256(password)).toString(CryptoJS.enc.Hex);
41
+ $("#password").val(password);
42
+
43
+ return true;
44
+ }
45
+ </script>
@@ -1,3 +1,5 @@
1
+ <%= javascript_include_tag "ums/application" %>
2
+
1
3
  <h1>修改密码</h1>
2
4
  <% if flash[:notice] || flash[:error] %>
3
5
  <div class="alert <%= "alert-success" if flash[:notice] %> <%= "alert-danger" if flash[:error] %>">
@@ -6,21 +8,58 @@
6
8
  </div>
7
9
  <% end %>
8
10
  <%= form_tag do %>
11
+ <%= hidden_field_tag :account,session[:user_account] %>
9
12
  <fieldset>
10
13
  <div>
11
14
  <label for="old_password">输入旧密码:</label>
12
- <%= password_field_tag :old_password,params[:old_password] %>
15
+ <%= password_field_tag :old_password %>
13
16
  </div>
14
17
  <div>
15
18
  <label for="new_password">输入新密码:</label>
16
- <%= password_field_tag :new_password,params[:new_password] %>
19
+ <%= password_field_tag :new_password %>
17
20
  </div>
18
21
  <div>
19
22
  <label for="re_password">重复新密码:</label>
20
- <%= password_field_tag :re_password,params[:re_password] %>
23
+ <%= password_field_tag :re_password %>
21
24
  </div>
22
25
  <div>
23
- <%= submit_tag "修改" ,:class => "btn btn-primary" %>
26
+ <%= button_tag "修改" ,:class => "btn btn-primary",:onclick => "return validate_form();"%>
24
27
  </div>
25
28
  </fieldset>
26
- <% end %>
29
+ <% end %>
30
+
31
+ <script type="text/javascript">
32
+ function validate_form (){
33
+ var account = $("#account").val();
34
+ var old_password = $("#old_password").val();
35
+ var new_password = $("#new_password").val();
36
+ var re_password = $("#re_password").val();
37
+ if (old_password == "") {
38
+ alert("请输入旧密码");
39
+ $("#old_password").focus();
40
+ return false;
41
+ };
42
+ if (new_password == "") {
43
+ alert("输入新密码");
44
+ $("#new_password").focus();
45
+ return false;
46
+ };
47
+ if (new_password != re_password) {
48
+ alert("两次输入的新密码不一致");
49
+ $("#re_password").focus();
50
+ return false;
51
+ };
52
+
53
+ old_password = CryptoJS.SHA256(account + CryptoJS.SHA256(old_password)).toString(CryptoJS.enc.Hex);
54
+ new_password = CryptoJS.SHA256(account + CryptoJS.SHA256(new_password)).toString(CryptoJS.enc.Hex);
55
+ re_password = CryptoJS.SHA256(account + CryptoJS.SHA256(re_password)).toString(CryptoJS.enc.Hex);
56
+
57
+ //alert(old_password);
58
+
59
+ $("#old_password").val(old_password);
60
+ $("#new_password").val(new_password);
61
+ $("#re_password").val(re_password);
62
+
63
+ return true;
64
+ }
65
+ </script>
@@ -4,7 +4,7 @@
4
4
  <div>
5
5
  这是您第<%= session[:login_count]%>次登录.
6
6
  <% if session[:login_count] > 1 %>
7
- 您上次登录时间是: <%= session[:last_login_time].strftime('%Y-%m-%d %H:%M') %>,登录IP为: <%= session[:last_login_ip]%>
7
+ 您上次登录时间是: <%= session[:last_login_time].to_time.strftime('%Y-%m-%d %H:%M') %>,登录IP为: <%= session[:last_login_ip]%>
8
8
  <% end %>
9
9
  </div>
10
10
  </fieldset>
@@ -0,0 +1,10 @@
1
+ class AddOperatorForUmsUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :ums_users , :created_by_id, :integer
4
+ add_column :ums_users , :updated_by_id, :integer
5
+ add_column :ums_functions , :created_by_id, :integer
6
+ add_column :ums_functions , :updated_by_id, :integer
7
+ add_column :ums_roles , :created_by_id, :integer
8
+ add_column :ums_roles , :updated_by_id, :integer
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ class AddOperatorForUmsLogs < ActiveRecord::Migration
2
+ def change
3
+ add_column :ums_logs , :operator, :string
4
+ add_column :ums_logs , :model_class, :string
5
+ add_column :ums_logs , :model_id, :integer
6
+ end
7
+ end
data/db/seeds.rb CHANGED
@@ -8,5 +8,5 @@
8
8
  functions = Ums::Function.create([{name:"用户管理",controller:'ums'}])
9
9
  role = Ums::Role.create(name:'系统管理员',functions:functions)
10
10
  #初始账号:admin 密码:admin
11
- Ums::User.create(account: "admin",name: "系统管理员",hashed_password: "4b1323850c4283da817ef95f32e0b00f2f31a4b2",
11
+ Ums::User.create(account: "admin",name: "系统管理员",hashed_password: "4ef71e780c4381a5c6bae8cad6c88b356f526128ae19d2f1cfacfc4f05c6e14f",
12
12
  salt: "0.8575214227141923",login_count:0,is_enabled:true,role:role)
data/lib/ums/engine.rb CHANGED
@@ -2,7 +2,7 @@ module Ums
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Ums
4
4
  config.to_prepare do
5
- Dir.glob(Rails.root + "app/decorators/**/*_decorator*.rb").each do |c|
5
+ Dir.glob(Rails.root + "app/decorators/**/*.rb").each do |c|
6
6
  require_dependency(c)
7
7
  end
8
8
  end
data/lib/ums/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ums
2
- VERSION = "0.1.2"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ums
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - wangfuhai
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: will_paginate
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: user manage system with rails
@@ -59,7 +59,11 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - MIT-LICENSE
63
+ - README.rdoc
64
+ - Rakefile
62
65
  - app/assets/javascripts/ums/application.js
66
+ - app/assets/javascripts/ums/sha256.min.js
63
67
  - app/assets/stylesheets/ums/application.css
64
68
  - app/controllers/ums/application_controller.rb
65
69
  - app/controllers/ums/functions_controller.rb
@@ -71,11 +75,11 @@ files:
71
75
  - app/helpers/ums/logs_helper.rb
72
76
  - app/helpers/ums/roles_helper.rb
73
77
  - app/helpers/ums/users_helper.rb
78
+ - app/models/ums.rb
74
79
  - app/models/ums/function.rb
75
80
  - app/models/ums/log.rb
76
81
  - app/models/ums/role.rb
77
82
  - app/models/ums/user.rb
78
- - app/models/ums.rb
79
83
  - app/views/layouts/ums/application.html.erb
80
84
  - app/views/ums/functions/_form.html.erb
81
85
  - app/views/ums/functions/edit.html.erb
@@ -101,14 +105,15 @@ files:
101
105
  - db/migrate/20131016015833_create_ums_users.rb
102
106
  - db/migrate/20131016020202_create_ums_logs.rb
103
107
  - db/migrate/20131016020423_create_ums_functions_roles.rb
108
+ - db/migrate/20141113071450_add_operator_for_ums_users.rb
109
+ - db/migrate/20141113071900_add_operator_for_ums_logs.rb
104
110
  - db/seeds.rb
105
111
  - lib/tasks/ums_tasks.rake
112
+ - lib/ums.rb
106
113
  - lib/ums/engine.rb
107
114
  - lib/ums/version.rb
108
- - lib/ums.rb
109
- - MIT-LICENSE
110
- - Rakefile
111
- - README.rdoc
115
+ - test/dummy/README.rdoc
116
+ - test/dummy/Rakefile
112
117
  - test/dummy/app/assets/javascripts/application.js
113
118
  - test/dummy/app/assets/stylesheets/application.css
114
119
  - test/dummy/app/controllers/application_controller.rb
@@ -117,6 +122,7 @@ files:
117
122
  - test/dummy/bin/bundle
118
123
  - test/dummy/bin/rails
119
124
  - test/dummy/bin/rake
125
+ - test/dummy/config.ru
120
126
  - test/dummy/config/application.rb
121
127
  - test/dummy/config/boot.rb
122
128
  - test/dummy/config/database.yml
@@ -133,41 +139,39 @@ files:
133
139
  - test/dummy/config/initializers/wrap_parameters.rb
134
140
  - test/dummy/config/locales/en.yml
135
141
  - test/dummy/config/routes.rb
136
- - test/dummy/config.ru
137
- - test/dummy/log/development.log
138
142
  - test/dummy/public/404.html
139
143
  - test/dummy/public/422.html
140
144
  - test/dummy/public/500.html
141
145
  - test/dummy/public/favicon.ico
142
- - test/dummy/Rakefile
143
- - test/dummy/README.rdoc
144
146
  - test/integration/navigation_test.rb
145
147
  - test/test_helper.rb
146
148
  - test/ums_test.rb
147
149
  homepage: https://github.com/wangfuhai2013/ums-rails
148
- licenses: []
150
+ licenses:
151
+ - MIT
149
152
  metadata: {}
150
- post_install_message:
153
+ post_install_message:
151
154
  rdoc_options: []
152
155
  require_paths:
153
156
  - lib
154
157
  required_ruby_version: !ruby/object:Gem::Requirement
155
158
  requirements:
156
- - - '>='
159
+ - - ">="
157
160
  - !ruby/object:Gem::Version
158
161
  version: '0'
159
162
  required_rubygems_version: !ruby/object:Gem::Requirement
160
163
  requirements:
161
- - - '>='
164
+ - - ">="
162
165
  - !ruby/object:Gem::Version
163
166
  version: '0'
164
167
  requirements: []
165
- rubyforge_project:
166
- rubygems_version: 2.0.5
167
- signing_key:
168
+ rubygems_version: 3.3.7
169
+ signing_key:
168
170
  specification_version: 4
169
171
  summary: user manage system with rails
170
172
  test_files:
173
+ - test/dummy/README.rdoc
174
+ - test/dummy/Rakefile
171
175
  - test/dummy/app/assets/javascripts/application.js
172
176
  - test/dummy/app/assets/stylesheets/application.css
173
177
  - test/dummy/app/controllers/application_controller.rb
@@ -193,13 +197,10 @@ test_files:
193
197
  - test/dummy/config/locales/en.yml
194
198
  - test/dummy/config/routes.rb
195
199
  - test/dummy/config.ru
196
- - test/dummy/log/development.log
197
200
  - test/dummy/public/404.html
198
201
  - test/dummy/public/422.html
199
202
  - test/dummy/public/500.html
200
203
  - test/dummy/public/favicon.ico
201
- - test/dummy/Rakefile
202
- - test/dummy/README.rdoc
203
204
  - test/integration/navigation_test.rb
204
205
  - test/test_helper.rb
205
206
  - test/ums_test.rb
@@ -1,72 +0,0 @@
1
-  (2.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
-  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
- ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
- Migrating to CreateUmsFunctions (20131016015419)
5
-  (0.1ms) begin transaction
6
-  (0.8ms) CREATE TABLE "ums_functions" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "controller" varchar(255), "action" varchar(255), "created_at" datetime, "updated_at" datetime) 
7
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131016015419"]]
8
-  (0.7ms) commit transaction
9
- Migrating to CreateUmsRoles (20131016015456)
10
-  (0.1ms) begin transaction
11
-  (0.4ms) CREATE TABLE "ums_roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime) 
12
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131016015456"]]
13
-  (0.8ms) commit transaction
14
- Migrating to CreateUmsUsers (20131016015833)
15
-  (0.1ms) begin transaction
16
-  (1.0ms) CREATE TABLE "ums_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "hashed_password" varchar(255), "salt" varchar(255), "last_login_time" datetime, "last_login_ip" varchar(255), "login_count" integer, "role_id" integer, "is_enabled" boolean, "created_at" datetime, "updated_at" datetime) 
17
-  (0.2ms) CREATE INDEX "index_ums_users_on_role_id" ON "ums_users" ("role_id")
18
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131016015833"]]
19
-  (1.8ms) commit transaction
20
- Migrating to CreateUmsLogs (20131016020202)
21
-  (0.1ms) begin transaction
22
-  (0.4ms) CREATE TABLE "ums_logs" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "log_type" varchar(255), "level" varchar(255), "data" text, "ip" varchar(255), "created_at" datetime, "updated_at" datetime)
23
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131016020202"]]
24
-  (0.8ms) commit transaction
25
- Migrating to CreateUmsFunctionsRoles (20131016020423)
26
-  (0.1ms) begin transaction
27
-  (0.5ms) CREATE TABLE "ums_functions_roles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "function_id" integer, "role_id" integer)
28
-  (0.2ms) CREATE INDEX "index_ums_functions_roles_on_function_id" ON "ums_functions_roles" ("function_id")
29
-  (0.1ms) CREATE INDEX "index_ums_functions_roles_on_role_id" ON "ums_functions_roles" ("role_id")
30
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131016020423"]]
31
-  (0.8ms) commit transaction
32
- Migrating to CreateUmsProductCategories (20131106063317)
33
-  (0.1ms) begin transaction
34
-  (0.6ms) CREATE TABLE "ums_product_categories" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "code" varchar(255), "picture" varchar(255), "created_at" datetime, "updated_at" datetime)
35
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106063317"]]
36
-  (1.0ms) commit transaction
37
- Migrating to CreateUmsProductColors (20131106063633)
38
-  (0.1ms) begin transaction
39
-  (0.3ms) CREATE TABLE "ums_product_colors" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
40
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106063633"]]
41
-  (0.8ms) commit transaction
42
- Migrating to CreateUmsProductMaterials (20131106063658)
43
-  (0.2ms) begin transaction
44
-  (0.7ms) CREATE TABLE "ums_product_materials" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
45
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106063658"]]
46
-  (1.2ms) commit transaction
47
- Migrating to CreateUmsProductBrands (20131106063719)
48
-  (0.1ms) begin transaction
49
-  (0.7ms) CREATE TABLE "ums_product_brands" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "created_at" datetime, "updated_at" datetime)
50
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106063719"]]
51
-  (0.8ms) commit transaction
52
- Migrating to CreateUmsProductSurfaces (20131106064312)
53
-  (0.1ms) begin transaction
54
-  (0.4ms) CREATE TABLE "ums_product_surfaces" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "code" varchar(255), "material" varchar(255), "color" varchar(255), "created_at" datetime, "updated_at" datetime)
55
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106064312"]]
56
-  (0.6ms) commit transaction
57
- Migrating to CreateUmsProductItems (20131106071449)
58
-  (0.1ms) begin transaction
59
-  (0.7ms) CREATE TABLE "ums_product_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "code" varchar(255), "category_id" integer, "material_id" integer, "length" integer, "width" integer, "height" integer, "depth" integer, "diameter" integer, "brand_id" integer, "stock_price" integer, "sell_price" integer, "description" text, "picture_id" integer, "created_at" datetime, "updated_at" datetime)
60
-  (0.2ms) CREATE INDEX "index_ums_product_items_on_category_id" ON "ums_product_items" ("category_id")
61
-  (0.2ms) CREATE INDEX "index_ums_product_items_on_material_id" ON "ums_product_items" ("material_id")
62
-  (0.2ms) CREATE INDEX "index_ums_product_items_on_brand_id" ON "ums_product_items" ("brand_id")
63
-  (0.3ms) CREATE INDEX "index_ums_product_items_on_picture_id" ON "ums_product_items" ("picture_id")
64
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106071449"]]
65
-  (1.4ms) commit transaction
66
- Migrating to CreateUmsProductPictrues (20131106071729)
67
-  (0.2ms) begin transaction
68
-  (0.8ms) CREATE TABLE "ums_product_pictrues" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "item_id" integer, "path" varchar(255), "description" text, "created_at" datetime, "updated_at" datetime)
69
-  (0.3ms) CREATE INDEX "index_ums_product_pictrues_on_item_id" ON "ums_product_pictrues" ("item_id")
70
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20131106071729"]]
71
-  (0.9ms) commit transaction
72
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"