user_stamp 3.0.2 → 4.0.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.
- checksums.yaml +4 -4
- data/MIT-LICENSE +2 -2
- data/README.rdoc +3 -3
- data/Rakefile +6 -9
- data/config/routes.rb +22 -21
- data/lib/generators/user_stamp/USAGE +5 -6
- data/lib/generators/user_stamp/templates/user_stamp.template +16 -21
- data/lib/generators/user_stamp/user_stamp_generator.rb +23 -23
- data/lib/user_stamp.rb +23 -22
- data/lib/user_stamp/app_controller.rb +22 -24
- data/lib/user_stamp/config.rb +29 -33
- data/lib/user_stamp/engine.rb +27 -28
- data/lib/user_stamp/user.rb +23 -24
- data/lib/user_stamp/user_stamp.rb +33 -35
- data/lib/user_stamp/version.rb +23 -22
- data/test/dummy/README.rdoc +15 -248
- data/test/dummy/Rakefile +1 -2
- data/test/dummy/app/assets/javascripts/application.js +4 -6
- data/test/dummy/app/assets/stylesheets/application.css +6 -4
- data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -30
- data/test/dummy/app/controllers/materials_controller.rb +27 -51
- data/test/dummy/app/controllers/products_controller.rb +27 -51
- data/test/dummy/app/helpers/application_helper.rb +0 -26
- data/test/dummy/app/helpers/materials_helper.rb +0 -26
- data/test/dummy/app/helpers/products_helper.rb +0 -26
- data/test/dummy/app/models/material.rb +2 -33
- data/test/dummy/app/models/product.rb +3 -30
- data/test/dummy/app/models/user.rb +0 -30
- data/test/dummy/app/views/layouts/application.html.erb +2 -2
- data/test/dummy/app/views/materials/_form.html.erb +9 -9
- data/test/dummy/app/views/materials/edit.html.erb +2 -2
- data/test/dummy/app/views/materials/index.html.erb +27 -23
- data/test/dummy/app/views/materials/new.html.erb +1 -2
- data/test/dummy/app/views/materials/show.html.erb +4 -8
- data/test/dummy/app/views/products/_form.html.erb +6 -6
- data/test/dummy/app/views/products/edit.html.erb +1 -1
- data/test/dummy/app/views/products/index.html.erb +26 -22
- data/test/dummy/app/views/products/new.html.erb +1 -1
- data/test/dummy/app/views/products/show.html.erb +4 -5
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config.ru +2 -2
- data/test/dummy/config/application.rb +2 -35
- data/test/dummy/config/boot.rb +4 -9
- data/test/dummy/config/database.yml +8 -8
- data/test/dummy/config/environment.rb +3 -3
- data/test/dummy/config/environments/development.rb +22 -18
- data/test/dummy/config/environments/production.rb +46 -34
- data/test/dummy/config/environments/test.rb +19 -14
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/devise.rb +5 -5
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +6 -5
- data/test/dummy/config/initializers/mime_types.rb +0 -1
- data/test/dummy/config/initializers/session_store.rb +1 -6
- data/test/dummy/config/initializers/user_stamp.rb +16 -21
- data/test/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/test/dummy/config/locales/en.yml +20 -2
- data/test/dummy/config/routes.rb +56 -4
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/{20150418012302_devise_create_users.rb → 20150427152452_devise_create_users.rb} +1 -1
- data/test/dummy/db/migrate/{20150420023321_create_materials.rb → 20150427153058_create_materials.rb} +2 -2
- data/test/dummy/db/migrate/{20150418013334_create_products.rb → 20150427153126_create_products.rb} +5 -5
- data/test/dummy/db/schema.rb +19 -19
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/public/404.html +54 -13
- data/test/dummy/public/422.html +54 -13
- data/test/dummy/public/500.html +53 -12
- data/test/dummy/test/{functional → controllers}/materials_controller_test.rb +6 -36
- data/test/dummy/test/{functional → controllers}/products_controller_test.rb +9 -39
- data/test/dummy/test/models/material_test.rb +7 -0
- data/test/dummy/test/models/product_test.rb +7 -0
- data/test/dummy/test/models/user_test.rb +7 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/-uBri7P4oa8-cPDbuxBzrBh6f_6YgmRETeF1cPQ98BI.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/0HaE6Po_aJLoGCREH2pm0GVz0rQO2AnHYN5WxfxRAdk.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/4WkO5ZKNyqFfwe0aMDO40zL7WuG01_LUMIo_Z1VIwIM.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/6sjvyZUWlu55-3XP-5yZfxjfXvbrvxsg-E3Q7B_t8pk.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/8Z_hEjtyPSQN4opQbT6RkcCNBCF-CFQybzoSs5Aq6KI.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/9-HUlJkF3jRyupEtKfWn1dlmpPkguFR6iptppjOucgg.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/A7WZdZGirgPer7eGsq2mJfHio6N9R9HJJxM4hkuItJo.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DzCB5KQSlVUBNf_tlBgnzTbS3b_pMkzkuqihSfNHe4s.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/GIw-liLL0pp9xX_VtZkZToKgqPr4koaqbpG9bROGWQQ.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/IgADW9PKfRr6TSWEm1ipKSMaJ4DwdbJMYiKMXWP2qvw.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/MEs_AIdrjZ9MYzLES9uOroxBGNjY9Stpe19ohy0z1lA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/SDZR43ZDx01ZzCRNeIhjSx_9kJO78HCK8YMJAKnWIaI.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/U2SInYmDs_pipNOzdogCHPXzyUyc1h5jAls6xbWSGs4.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/UL1xczCpSxV6CONGlfaMEdE5KwKA9o56RLp2QZxGstA.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/UReuCl2zv3Z3nGvte7lUGu7979JxkuCRbDNv6-HtTZU.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/WT1n2kS2FLNKA6DHRX7THVlGIGzgTC8je4MMzBQtSmg.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/XgTwbFt01e5bfNNba5Gr83GNRea9MoFlqP2rJGW_rjk.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZAc9zFuIs2cKSfQZVtEkV3u4_RLFxLSP55C0RqqhZ1w.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Zea97tHycA5aXYbZ9DHtFHTu4bhAZcIhb0RlckVvzXI.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ZwP9zS5ft5ww816BPhmhQPqMPKbbgPdjBrz5VnSZ5oo.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hwZcJkZ_YQ4hjBA1FzHIvGWudWHtQDZW7h8zUJslBQM.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/iqtLgHvtAikgr0-aW1Vqy4KeUsVmzgOz9YVG2_2RVeY.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/jpKzE4ZVMG4ynSLgDB76TOPEZbHNqYF8BQRy94ioeQE.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/kM0liVKuJ_BZI9HenUEa6OO9pOnT4KuC-zzXot34reU.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/nGfH8igMEHxuQWcDKD23EjWqmSvgxI2sVXhNOC5wE8I.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ni5fBgQoTXajLTgoWS8nd8LoiucG5krt3YIpbrx1mIY.cache +2 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/oVvP3smTURXlapOzr_iUN4Ew_m3EEy3CQ4M0cOkTsm0.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/oX6WZjQtAOkKXBohDgfcjs0cda8wFDGnkwJDGkJoytI.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/oeTdUtI5qsh1Nn2Hy6_wmjtPV25O-RCQPcNjCwoSCKA.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ov953wmqzp_9OaWCaoMLlOSWzHeF9kLApt4aCcW-Bgk.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/sg6mpEMI9L65gEc7QFaXG534feyjIGE29SE7B_RTQNY.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uJ8m6b9jypIn4pSuuaKkFBW9E2Ifcx2ulcERIa1q1dA.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uYPgal6XAaVE9q7oz6jQS5nmQKM3IwZ8tnsE-__Oweo.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/vXJI-yUwt8d552Mj63nmnTx46YY7-GUrYuFzLUT9hMI.cache +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/xs2cSdXmo8vitmiaAo7fhDSGbrVPUKN17Ue3aTCUseE.cache +1 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/yCPG4xJ4TDzj7Mbcm2B0wDN_Jqlu2dKg8bFLKqW-pBI.cache +0 -0
- data/test/fixtures/materials.yml +1 -1
- data/test/fixtures/products.yml +1 -1
- data/test/fixtures/users.yml +5 -26
- data/test/test_helper.rb +7 -33
- data/test/user_stamp_test.rb +0 -26
- metadata +124 -40
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/log/test.log +0 -414
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/unit/helpers/materials_helper_test.rb +0 -30
- data/test/dummy/test/unit/helpers/products_helper_test.rb +0 -30
- data/test/dummy/test/unit/material_test.rb +0 -33
- data/test/dummy/test/unit/product_test.rb +0 -33
- data/test/dummy/test/unit/user_test.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a9333dcb335bcb6890cd97b9c5c8eee6d191076
|
4
|
+
data.tar.gz: ed2eab33cfd66e2d2d7aade2d561828cb9c6506b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce7514af8b34af8754240a417d859caf7ad821553c099414011d544e7f962bfdda855148729bf685ea7c27a5d5ef95d8bbf92018eba68ba7c9b485ea5706156b
|
7
|
+
data.tar.gz: c0d2a30e55a1eb8a1527e189b017ea0c36d4295c36d4b79cd314d7a4e46be5e71860730c4f54f4beffab195c536a62cf97d5264eee5716869f948a61e1ebacb6
|
data/MIT-LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright 2015 PD Technology Solutions, LLC
|
1
|
+
Copyright 2015 PD Technology Solutions, LLC
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
18
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= UserStamp - Rails
|
1
|
+
= UserStamp - Rails 4.x Branch
|
2
2
|
Provides the functionality to automatically update records in the database with the logged in users identity. Alleviates the need to update the identify of the user for every save, update or destroy.
|
3
3
|
|
4
4
|
There are two different gems, one of Rails 3.2.x and secodn for Rails 4.x. The two gems were setup to ensure testing was complete.
|
@@ -12,8 +12,8 @@ By default the identify field is called login_name. The login_name field is a s
|
|
12
12
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
For Rails 3.2.x: gem 'user_stamp', '~> 3.0.0'
|
16
|
+
For Rails 4.x: gem 'user_stamp', '~> 4.0.0'
|
17
17
|
|
18
18
|
And then execute:
|
19
19
|
|
data/Rakefile
CHANGED
@@ -1,16 +1,10 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
1
|
begin
|
3
2
|
require 'bundler/setup'
|
4
3
|
rescue LoadError
|
5
4
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
5
|
end
|
7
|
-
|
8
|
-
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
14
8
|
|
15
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
16
10
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -24,6 +18,9 @@ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
|
24
18
|
load 'rails/tasks/engine.rake'
|
25
19
|
|
26
20
|
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
27
24
|
|
28
25
|
Bundler::GemHelper.install_tasks
|
29
26
|
|
@@ -37,4 +34,4 @@ Rake::TestTask.new(:test) do |t|
|
|
37
34
|
end
|
38
35
|
|
39
36
|
|
40
|
-
task :
|
37
|
+
task default: :test
|
data/config/routes.rb
CHANGED
@@ -1,28 +1,29 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This file is part of the UserStamp library that provides tools to
|
2
|
+
# track who created, updated, or destroyed a record in the database.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Copyright (C) 2015 PD Technology Solutions, LLC
|
4
|
+
# https://github.com/mjpete3/user_stamp
|
7
5
|
#
|
8
|
-
#
|
9
|
-
# a copy of this software and associated documentation files (the
|
10
|
-
# "Software"), to deal in the Software without restriction, including
|
11
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
# the following conditions:
|
6
|
+
# Copyright (C) 2015 PD Technology Solutions, LLC
|
15
7
|
#
|
16
|
-
#
|
17
|
-
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
# the following conditions:
|
18
15
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
|
+
|
26
27
|
|
27
28
|
Rails.application.routes.draw do
|
28
29
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
Description:
|
2
|
-
|
2
|
+
Copies the default user_stamp initilizer file in config/initializer
|
3
3
|
|
4
4
|
Example:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
rails generate user_stamp install
|
6
|
+
|
7
|
+
This will create:
|
8
|
+
config/initializer/user_stamp.rb
|
@@ -3,24 +3,19 @@
|
|
3
3
|
# Initilization file for UserStamp gem
|
4
4
|
#
|
5
5
|
UserStamp.configure do |config|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
# Default
|
24
|
-
# config.user_field = :login_name
|
25
|
-
|
26
|
-
end
|
6
|
+
# ===== Config.current_user =====
|
7
|
+
# Set the name of the user object created when checking authentication
|
8
|
+
# By default uses the current_user object that devise creates
|
9
|
+
# need to make sure that the user_field is defined within the user object
|
10
|
+
# Default
|
11
|
+
# config.current_user = :current_user
|
12
|
+
|
13
|
+
# ===== Config.user_field ======
|
14
|
+
# The field within the user object / user database that is stored for each record in the database
|
15
|
+
# To change the behavior to store the user.id field use the following config:
|
16
|
+
# config.user_field = :id
|
17
|
+
# To store the user's email use the following config:
|
18
|
+
# config.user_field = :email
|
19
|
+
# Default
|
20
|
+
# config.user_field = :login_name
|
21
|
+
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This file is part of the UserStamp library that provides tools to
|
2
|
+
# track who created, updated, or destroyed a record in the database.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Copyright (C) 2015 PD Technology Solutions, LLC
|
4
|
+
# https://github.com/mjpete3/user_stamp
|
7
5
|
#
|
8
|
-
#
|
9
|
-
# a copy of this software and associated documentation files (the
|
10
|
-
# "Software"), to deal in the Software without restriction, including
|
11
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
# the following conditions:
|
6
|
+
# Copyright (C) 2015 PD Technology Solutions, LLC
|
15
7
|
#
|
16
|
-
#
|
17
|
-
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
# the following conditions:
|
18
15
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
26
|
|
27
27
|
class UserStampGenerator < Rails::Generators::NamedBase
|
28
28
|
source_root File.expand_path('../templates', __FILE__)
|
29
|
-
|
29
|
+
|
30
30
|
# copies the user_stamp template to the initializer directory
|
31
31
|
def copy_initializer_file
|
32
32
|
copy_file "user_stamp.template", "config/initializers/user_stamp.rb"
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
data/lib/user_stamp.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This file is part of the UserStamp library that provides tools to
|
2
|
+
# track who created, updated, or destroyed a record in the database.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Copyright (C) 2015 PD Technology Solutions, LLC
|
4
|
+
# https://github.com/mjpete3/user_stamp
|
7
5
|
#
|
8
|
-
#
|
9
|
-
# a copy of this software and associated documentation files (the
|
10
|
-
# "Software"), to deal in the Software without restriction, including
|
11
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
# the following conditions:
|
6
|
+
# Copyright (C) 2015 PD Technology Solutions, LLC
|
15
7
|
#
|
16
|
-
#
|
17
|
-
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
# the following conditions:
|
18
15
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
26
|
|
27
27
|
require 'devise'
|
28
28
|
|
@@ -33,4 +33,5 @@ require "user_stamp/app_controller"
|
|
33
33
|
require "user_stamp/user"
|
34
34
|
|
35
35
|
module UserStamp
|
36
|
-
|
36
|
+
|
37
|
+
end
|
@@ -1,33 +1,32 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This file is part of the UserStamp library that provides tools to
|
2
|
+
# track who created, updated, or destroyed a record in the database.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Copyright (C) 2015 PD Technology Solutions, LLC
|
4
|
+
# https://github.com/mjpete3/user_stamp
|
7
5
|
#
|
8
|
-
#
|
9
|
-
# a copy of this software and associated documentation files (the
|
10
|
-
# "Software"), to deal in the Software without restriction, including
|
11
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
# the following conditions:
|
6
|
+
# Copyright (C) 2015 PD Technology Solutions, LLC
|
15
7
|
#
|
16
|
-
#
|
17
|
-
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
# the following conditions:
|
18
15
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
26
|
|
27
27
|
|
28
28
|
module UserStamp
|
29
29
|
module AppController
|
30
|
-
|
31
30
|
#
|
32
31
|
# Called by the main application using a :before_filter
|
33
32
|
#
|
@@ -35,6 +34,5 @@ module UserStamp
|
|
35
34
|
# use the current_user configuration as an object within the main app
|
36
35
|
User.current = self.send(UserStamp.configuration.current_user)
|
37
36
|
end
|
38
|
-
|
39
37
|
end
|
40
|
-
end
|
38
|
+
end
|
data/lib/user_stamp/config.rb
CHANGED
@@ -1,50 +1,47 @@
|
|
1
|
-
#
|
2
|
-
#
|
1
|
+
# This file is part of the UserStamp library that provides tools to
|
2
|
+
# track who created, updated, or destroyed a record in the database.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# Copyright (C) 2015 PD Technology Solutions, LLC
|
4
|
+
# https://github.com/mjpete3/user_stamp
|
7
5
|
#
|
8
|
-
#
|
9
|
-
# a copy of this software and associated documentation files (the
|
10
|
-
# "Software"), to deal in the Software without restriction, including
|
11
|
-
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
-
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
-
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
-
# the following conditions:
|
6
|
+
# Copyright (C) 2015 PD Technology Solutions, LLC
|
15
7
|
#
|
16
|
-
#
|
17
|
-
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
9
|
+
# a copy of this software and associated documentation files (the
|
10
|
+
# "Software"), to deal in the Software without restriction, including
|
11
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
12
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
13
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
14
|
+
# the following conditions:
|
18
15
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
23
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
24
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
26
|
|
27
27
|
require 'active_support/configurable'
|
28
28
|
|
29
29
|
module UserStamp
|
30
|
+
|
30
31
|
#
|
31
32
|
# Configures global settings for UserStamp
|
32
33
|
# UserStamp.configure do |config|
|
33
|
-
#
|
34
|
-
# end
|
35
|
-
|
36
|
-
|
34
|
+
# config.user_field = [:login_name]
|
35
|
+
# end
|
37
36
|
def self.configuration
|
38
37
|
@config ||= Configuration.new
|
39
38
|
end
|
40
|
-
|
41
|
-
|
39
|
+
|
42
40
|
# Global settings for UserStamp
|
43
41
|
def self.configure
|
44
42
|
yield configuration
|
45
43
|
end
|
46
|
-
|
47
|
-
|
44
|
+
|
48
45
|
class Configuration
|
49
46
|
include ActiveSupport::Configurable
|
50
47
|
config_accessor :current_user
|
@@ -53,8 +50,7 @@ module UserStamp
|
|
53
50
|
# set the defaults
|
54
51
|
def initialize
|
55
52
|
self.current_user = :current_user
|
56
|
-
self.user_field
|
57
|
-
end
|
53
|
+
self.user_field = :login_name
|
54
|
+
end
|
58
55
|
end
|
59
|
-
|
60
|
-
end
|
56
|
+
end
|