fine_print 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/fine_print/application_controller.rb +1 -1
- data/app/controllers/fine_print/application_controller.rb~ +4 -4
- data/config/initializers/fine_print.rb +7 -7
- data/config/initializers/fine_print.rb~ +14 -14
- data/lib/fine_print/controller_additions.rb +1 -1
- data/lib/fine_print/controller_additions.rb~ +3 -1
- data/lib/fine_print/version.rb +1 -1
- data/lib/fine_print/version.rb~ +1 -1
- data/lib/fine_print.rb +1 -1
- data/lib/fine_print.rb~ +1 -1
- data/spec/dummy/config/initializers/fine_print.rb +7 -7
- data/spec/dummy/config/initializers/fine_print.rb~ +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +14 -0
- data/spec/dummy/log/test.log +846 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ad3cdb6cc83d91c8ad70a79abd35a43159d3f99
|
4
|
+
data.tar.gz: 1aa4cc47c9501d5fd816b6d5eddee4d71a4dbd52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52bc3cdc2a6f0250b716f2401171ad06afc52dc6c34b8e0873037b71d60deb757b976d60310cdd95d9bf8c3be462a7fde7edfea24be698c8dc4372304950a2fe
|
7
|
+
data.tar.gz: 54bbdde67d20c2795eac3679f43a00af2d3aad288add521ea908da2924a1c7a147b34674fb344171a75d1e761ce9dc7fd292b0efdefe201de805da8f06f62762
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module FinePrint
|
2
2
|
class ApplicationController < ActionController::Base
|
3
|
-
before_filter :verify_admin
|
3
|
+
before_filter :verify_admin
|
4
4
|
|
5
5
|
rescue_from FinePrint::SecurityTransgression,
|
6
6
|
:with => lambda { redirect_to FinePrint.redirect_path }
|
7
7
|
|
8
8
|
protected
|
9
9
|
|
10
|
-
def verify_admin
|
11
|
-
user = send FinePrint.
|
12
|
-
FinePrint.raise_unless_admin
|
10
|
+
def verify_admin
|
11
|
+
user = send FinePrint.current_user_proc.call(self)
|
12
|
+
FinePrint.raise_unless_admin(user)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -3,22 +3,22 @@
|
|
3
3
|
FinePrint.configure do |config|
|
4
4
|
# Engine Configuration
|
5
5
|
|
6
|
-
#
|
7
|
-
# Default:
|
8
|
-
config.
|
6
|
+
# Proc called with controller as argument that returns the current user.
|
7
|
+
# Default: lambda { |controller| controller.current_user }
|
8
|
+
config.current_user_proc = lambda { |controller| controller.current_user }
|
9
9
|
|
10
|
-
# Proc called with user as argument that
|
10
|
+
# Proc called with user as argument that returns true iif the user is an admin.
|
11
11
|
# Admins can create and edit agreements and terminate accepted agreements.
|
12
12
|
# Default: lambda { |user| false } (no admins)
|
13
13
|
config.user_admin_proc = lambda { |user| false }
|
14
14
|
|
15
|
-
# Proc that returns true
|
15
|
+
# Proc called with user as argument that returns true iif the user is logged in.
|
16
16
|
# In many systems, a non-logged-in user is represented by nil.
|
17
17
|
# However, some systems use something like an AnonymousUser class to represent this state.
|
18
18
|
# This proc is mostly used to help the developer realize that they should only be asking
|
19
19
|
# signed in users to sign contracts; without this, developers would get a cryptic SQL error.
|
20
|
-
# Default: lambda { |user|
|
21
|
-
config.user_signed_in_proc = lambda { |user|
|
20
|
+
# Default: lambda { |user| user }
|
21
|
+
config.user_signed_in_proc = lambda { |user| user }
|
22
22
|
|
23
23
|
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages).
|
24
24
|
# Default: '/'
|
@@ -3,34 +3,34 @@
|
|
3
3
|
FinePrint.configure do |config|
|
4
4
|
# Engine Configuration
|
5
5
|
|
6
|
-
#
|
6
|
+
# Proc called with controller as argument that returns the current user.
|
7
7
|
# Default: 'current_user'
|
8
|
-
config.
|
8
|
+
config.current_user_proc = lambda { |controller| controller.current_user }
|
9
9
|
|
10
|
-
# Proc called with user as argument that
|
11
|
-
# Admins can create and edit agreements and terminate accepted agreements
|
10
|
+
# Proc called with user as argument that returns true iif the user is an admin.
|
11
|
+
# Admins can create and edit agreements and terminate accepted agreements.
|
12
12
|
# Default: lambda { |user| false } (no admins)
|
13
13
|
config.user_admin_proc = lambda { |user| false }
|
14
14
|
|
15
|
-
# Proc that returns true
|
16
|
-
# In many systems, a non-logged-in user is represented by nil
|
17
|
-
# However, some systems use something like an AnonymousUser class to represent this state
|
15
|
+
# Proc called with user as argument that returns true iif the user is logged in.
|
16
|
+
# In many systems, a non-logged-in user is represented by nil.
|
17
|
+
# However, some systems use something like an AnonymousUser class to represent this state.
|
18
18
|
# This proc is mostly used to help the developer realize that they should only be asking
|
19
|
-
# signed in users to sign contracts; without this, developers would get a cryptic SQL error
|
20
|
-
# Default: lambda { |user|
|
21
|
-
config.user_signed_in_proc = lambda { |user|
|
19
|
+
# signed in users to sign contracts; without this, developers would get a cryptic SQL error.
|
20
|
+
# Default: lambda { |user| user }
|
21
|
+
config.user_signed_in_proc = lambda { |user| user }
|
22
22
|
|
23
|
-
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages)
|
23
|
+
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages).
|
24
24
|
# Default: '/'
|
25
25
|
config.redirect_path = '/'
|
26
26
|
|
27
27
|
# Signature (fine_print_get_signatures) Configuration
|
28
28
|
|
29
|
-
# Path to redirect users to when they need to agree to contract(s)
|
30
|
-
# A list of contract names that must be agreed to will be available in the 'contracts' parameter
|
29
|
+
# Path to redirect users to when they need to agree to contract(s).
|
30
|
+
# A list of contract names that must be agreed to will be available in the 'contracts' parameter.
|
31
31
|
# Your code doesn't have to deal with all of them at once, e.g. you can get
|
32
32
|
# the user to agree to the first one and then they'll just eventually be
|
33
|
-
# redirected back to this page with the remaining contract names
|
33
|
+
# redirected back to this page with the remaining contract names.
|
34
34
|
# Default: '/'
|
35
35
|
config.pose_contracts_path = '/'
|
36
36
|
end
|
@@ -35,7 +35,7 @@ module FinePrint
|
|
35
35
|
# Bail if nothing to do
|
36
36
|
return true if contract_names.blank?
|
37
37
|
|
38
|
-
user = send FinePrint.
|
38
|
+
user = send FinePrint.current_user_proc.call(self)
|
39
39
|
FinePrint.raise_unless_signed_in(user)
|
40
40
|
|
41
41
|
unsigned_contract_names =
|
@@ -54,6 +54,8 @@ module FinePrint
|
|
54
54
|
# See the README
|
55
55
|
def fine_print_skip_signatures(*args)
|
56
56
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
57
|
+
|
58
|
+
# Convert all names to string
|
57
59
|
names = args.flatten.collect{|n| n.to_s}
|
58
60
|
|
59
61
|
class_eval do
|
data/lib/fine_print/version.rb
CHANGED
data/lib/fine_print/version.rb~
CHANGED
data/lib/fine_print.rb
CHANGED
data/lib/fine_print.rb~
CHANGED
@@ -3,22 +3,22 @@
|
|
3
3
|
FinePrint.configure do |config|
|
4
4
|
# Engine Configuration
|
5
5
|
|
6
|
-
#
|
7
|
-
# Default:
|
8
|
-
config.
|
6
|
+
# Proc called with controller as argument that returns the current user.
|
7
|
+
# Default: lambda { |controller| controller.current_user }
|
8
|
+
config.current_user_proc = lambda { |controller| controller.current_user }
|
9
9
|
|
10
|
-
# Proc called with user as argument that
|
10
|
+
# Proc called with user as argument that returns true iif the user is an admin.
|
11
11
|
# Admins can create and edit agreements and terminate accepted agreements.
|
12
12
|
# Default: lambda { |user| false } (no admins)
|
13
13
|
config.user_admin_proc = lambda { |user| user.is_admin }
|
14
14
|
|
15
|
-
# Proc that returns true
|
15
|
+
# Proc called with user as argument that returns true iif the user is logged in.
|
16
16
|
# In many systems, a non-logged-in user is represented by nil.
|
17
17
|
# However, some systems use something like an AnonymousUser class to represent this state.
|
18
18
|
# This proc is mostly used to help the developer realize that they should only be asking
|
19
19
|
# signed in users to sign contracts; without this, developers would get a cryptic SQL error.
|
20
|
-
# Default: lambda { |user|
|
21
|
-
config.user_signed_in_proc = lambda { |user|
|
20
|
+
# Default: lambda { |user| user }
|
21
|
+
config.user_signed_in_proc = lambda { |user| user }
|
22
22
|
|
23
23
|
# Path to redirect users to when an error occurs (e.g. permission denied on admin pages).
|
24
24
|
# Default: '/'
|
@@ -10,7 +10,7 @@ FinePrint.configure do |config|
|
|
10
10
|
# Proc called with user as argument that should return true if and only if the user is an admin.
|
11
11
|
# Admins can create and edit agreements and terminate accepted agreements.
|
12
12
|
# Default: lambda { |user| false } (no admins)
|
13
|
-
config.user_admin_proc = lambda { |user|
|
13
|
+
config.user_admin_proc = lambda { |user| user.is_admin }
|
14
14
|
|
15
15
|
# Proc that returns true if and only if the provided user is logged in.
|
16
16
|
# In many systems, a non-logged-in user is represented by nil.
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1771,3 +1771,17 @@ Connecting to database specified by database.yml
|
|
1771
1771
|
[1m[35m (4.2ms)[0m CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
|
1772
1772
|
[1m[36m (4.2ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_s_on_u_id_and_u_type_and_c_id" ON "fine_print_signatures" ("user_id", "user_type", "contract_id")[0m
|
1773
1773
|
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
1774
|
+
Connecting to database specified by database.yml
|
1775
|
+
Connecting to database specified by database.yml
|
1776
|
+
[1m[36m (0.0ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
1777
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
1778
|
+
[1m[36m (13.4ms)[0m [1mDROP TABLE "dummy_users"[0m
|
1779
|
+
[1m[35m (5.7ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 'f' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1780
|
+
[1m[36m (4.6ms)[0m [1mDROP TABLE "fine_print_contracts"[0m
|
1781
|
+
[1m[35m (4.4ms)[0m CREATE TABLE "fine_print_contracts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "version" integer, "title" varchar(255) NOT NULL, "content" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1782
|
+
[1m[36m (4.3ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_contracts_on_name_and_version" ON "fine_print_contracts" ("name", "version")[0m
|
1783
|
+
[1m[35m (4.5ms)[0m DROP TABLE "fine_print_signatures"
|
1784
|
+
[1m[36m (4.5ms)[0m [1mCREATE TABLE "fine_print_signatures" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "contract_id" integer NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255) NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
1785
|
+
[1m[35m (4.4ms)[0m CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
|
1786
|
+
[1m[36m (3.8ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_s_on_u_id_and_u_type_and_c_id" ON "fine_print_signatures" ("user_id", "user_type", "contract_id")[0m
|
1787
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|