spree_core 4.2.0.rc3 → 4.2.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/spree/ability.rb +45 -30
- data/app/models/spree/app_configuration.rb +2 -2
- data/app/models/spree/line_item.rb +6 -9
- data/app/models/spree/store.rb +1 -1
- data/config/locales/en.yml +1 -1
- data/db/default/spree/zones.rb +4 -1
- data/lib/spree/core/controller_helpers/store.rb +4 -0
- data/lib/spree/core/version.rb +1 -1
- data/spree_core.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 661697daa0303090a2d39f0b439929bf8b54e59722ad738cee547487ba27aaf2
|
4
|
+
data.tar.gz: 8de83da0c8c3aa629f8389e40c63c178391d5a51a370da3595f0e1ce6edf431f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b2cffe1a5872d559bb2ff7b0361e99c3d2cf6436a57e6ba1779550fb587651316c6c031c019b8e2150feae8df15f5d04ec500ae245585b9886f5584cb89ae2c
|
7
|
+
data.tar.gz: 83bba2eb568b84622dd523b4b943bcfee3cba206bce126ba9cf2a094b671e53d6094e8129edc4b8d620630fccf0783f962e3311fa1d41baf149575155bd7cf4e
|
data/app/models/spree/ability.rb
CHANGED
@@ -23,55 +23,70 @@ module Spree
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def initialize(user)
|
26
|
-
|
27
|
-
alias_action :delete, to: :destroy
|
28
|
-
alias_action :create, :update, :destroy, to: :modify
|
26
|
+
alias_cancan_delete_action
|
29
27
|
|
30
28
|
user ||= Spree.user_class.new
|
31
29
|
|
32
30
|
if user.respond_to?(:has_spree_role?) && user.has_spree_role?('admin')
|
33
|
-
|
31
|
+
apply_admin_permissions(user)
|
34
32
|
else
|
35
|
-
|
36
|
-
can :read, OptionType
|
37
|
-
can :read, OptionValue
|
38
|
-
can :create, Order
|
39
|
-
can :show, Order do |order, token|
|
40
|
-
order.user == user || order.token && token == order.token
|
41
|
-
end
|
42
|
-
can :update, Order do |order, token|
|
43
|
-
!order.completed? && (order.user == user || order.token && token == order.token)
|
44
|
-
end
|
45
|
-
can :manage, Address, user_id: user.id
|
46
|
-
can :read, CreditCard, user_id: user.id
|
47
|
-
can :read, Product
|
48
|
-
can :read, ProductProperty
|
49
|
-
can :read, Property
|
50
|
-
can :create, Spree.user_class
|
51
|
-
can [:show, :update, :destroy], Spree.user_class, id: user.id
|
52
|
-
can :read, State
|
53
|
-
can :read, Store
|
54
|
-
can :read, Taxon
|
55
|
-
can :read, Taxonomy
|
56
|
-
can :read, Variant
|
57
|
-
can :read, Zone
|
33
|
+
apply_user_permissions(user)
|
58
34
|
end
|
59
35
|
|
60
36
|
# Include any abilities registered by extensions, etc.
|
37
|
+
# this is legacy behaviour and should be removed in Spree 5.0
|
61
38
|
Ability.abilities.merge(abilities_to_register).each do |clazz|
|
62
39
|
merge clazz.new(user)
|
63
40
|
end
|
64
41
|
|
65
|
-
|
66
|
-
cannot [:update, :destroy], Role, name: ['admin']
|
42
|
+
protect_admin_role
|
67
43
|
end
|
68
44
|
|
69
|
-
|
45
|
+
protected
|
70
46
|
|
71
47
|
# you can override this method to register your abilities
|
72
48
|
# this method has to return array of classes
|
73
49
|
def abilities_to_register
|
74
50
|
[]
|
75
51
|
end
|
52
|
+
|
53
|
+
def alias_cancan_delete_action
|
54
|
+
alias_action :delete, to: :destroy
|
55
|
+
alias_action :create, :update, :destroy, to: :modify
|
56
|
+
end
|
57
|
+
|
58
|
+
def apply_admin_permissions(user)
|
59
|
+
can :manage, :all
|
60
|
+
end
|
61
|
+
|
62
|
+
def apply_user_permissions(user)
|
63
|
+
can :read, ::Spree::Country
|
64
|
+
can :read, ::Spree::OptionType
|
65
|
+
can :read, ::Spree::OptionValue
|
66
|
+
can :create, ::Spree::Order
|
67
|
+
can :show, ::Spree::Order do |order, token|
|
68
|
+
order.user == user || order.token && token == order.token
|
69
|
+
end
|
70
|
+
can :update, ::Spree::Order do |order, token|
|
71
|
+
!order.completed? && (order.user == user || order.token && token == order.token)
|
72
|
+
end
|
73
|
+
can :manage, ::Spree::Address, user_id: user.id
|
74
|
+
can :read, ::Spree::CreditCard, user_id: user.id
|
75
|
+
can :read, ::Spree::Product
|
76
|
+
can :read, ::Spree::ProductProperty
|
77
|
+
can :read, ::Spree::Property
|
78
|
+
can :create, ::Spree.user_class
|
79
|
+
can [:show, :update, :destroy], ::Spree.user_class, id: user.id
|
80
|
+
can :read, ::Spree::State
|
81
|
+
can :read, ::Spree::Store
|
82
|
+
can :read, ::Spree::Taxon
|
83
|
+
can :read, ::Spree::Taxonomy
|
84
|
+
can :read, ::Spree::Variant
|
85
|
+
can :read, ::Spree::Zone
|
86
|
+
end
|
87
|
+
|
88
|
+
def protect_admin_role
|
89
|
+
cannot [:update, :destroy], ::Spree::Role, name: ['admin']
|
90
|
+
end
|
76
91
|
end
|
77
92
|
end
|
@@ -68,8 +68,8 @@ module Spree
|
|
68
68
|
preference :non_expiring_credit_types, :array, default: []
|
69
69
|
preference :credit_to_new_allocation, :boolean, default: false
|
70
70
|
|
71
|
-
# Multi
|
72
|
-
preference :
|
71
|
+
# Multi store configurations
|
72
|
+
preference :show_store_selector, :boolean, default: false
|
73
73
|
|
74
74
|
# searcher_class allows spree extension writers to provide their own Search class
|
75
75
|
def searcher_class
|
@@ -57,16 +57,13 @@ module Spree
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def update_price
|
60
|
-
|
61
|
-
currency_price = Spree::Price.where(
|
62
|
-
currency: order.currency,
|
63
|
-
variant_id: variant_id
|
64
|
-
).first
|
60
|
+
currency_price = variant.price_in(order.currency)
|
65
61
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
62
|
+
self.price = if currency_price.amount.present?
|
63
|
+
currency_price.price_including_vat_for(tax_zone: tax_zone)
|
64
|
+
else
|
65
|
+
0
|
66
|
+
end
|
70
67
|
end
|
71
68
|
|
72
69
|
def copy_tax_category
|
data/app/models/spree/store.rb
CHANGED
data/config/locales/en.yml
CHANGED
@@ -1582,7 +1582,7 @@ en:
|
|
1582
1582
|
show_only_considered_risky: Only show risky orders
|
1583
1583
|
show_property: Show Property
|
1584
1584
|
show_rate_in_label: Show rate in label
|
1585
|
-
|
1585
|
+
show_store_selector:
|
1586
1586
|
short: Show Store selector
|
1587
1587
|
long: Display the Store selector in the main nav bar of Storefront and allow users to change Store and Currency
|
1588
1588
|
sign_up: Sign Up
|
data/db/default/spree/zones.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
eu_vat = Spree::Zone.where(name: 'EU_VAT', description: 'Countries that make up the EU VAT zone.', kind: 'country').first_or_create!
|
2
|
+
uk_vat = Spree::Zone.where(name: 'UK_VAT', kind: 'country').first_or_create!
|
2
3
|
north_america = Spree::Zone.where(name: 'North America', description: 'USA + Canada', kind: 'country').first_or_create!
|
3
4
|
south_america = Spree::Zone.where(name: 'South America', description: 'South America', kind: 'country').first_or_create!
|
4
5
|
middle_east = Spree::Zone.where(name: 'Middle East', description: 'Middle East', kind: 'country').first_or_create!
|
5
6
|
asia = Spree::Zone.where(name: 'Asia', description: 'Asia', kind: 'country').first_or_create!
|
6
7
|
|
7
|
-
%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG
|
8
|
+
%w(PL FI PT RO DE FR SK HU SI IE AT ES IT BE SE LV BG LT CY LU MT DK NL EE HR CZ GR).each do |name|
|
8
9
|
eu_vat.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
9
10
|
end
|
10
11
|
|
12
|
+
uk_vat.zone_members.where(zoneable: Spree::Country.find_by(iso: 'GB')).first_or_create!
|
13
|
+
|
11
14
|
%w(US CA).each do |name|
|
12
15
|
north_america.zone_members.where(zoneable: Spree::Country.find_by!(iso: name)).first_or_create!
|
13
16
|
end
|
@@ -29,6 +29,10 @@ module Spree
|
|
29
29
|
@current_store ||= Spree::Store.current(request.env['SERVER_NAME'])
|
30
30
|
end
|
31
31
|
|
32
|
+
def store_locale
|
33
|
+
current_store.default_locale
|
34
|
+
end
|
35
|
+
|
32
36
|
# Return a Hash of things that influence the prices displayed in your shop.
|
33
37
|
#
|
34
38
|
# By default, the only thing that influences prices that is the current order's +tax_zone+
|
data/lib/spree/core/version.rb
CHANGED
data/spree_core.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_dependency 'acts_as_list', '~> 0.8'
|
31
31
|
s.add_dependency 'awesome_nested_set', '>= 3.3.1', '< 4.0'
|
32
32
|
s.add_dependency 'carmen', '>= 1.0', '< 1.2'
|
33
|
-
s.add_dependency 'cancancan', '~> 3.
|
33
|
+
s.add_dependency 'cancancan', '~> 3.2'
|
34
34
|
s.add_dependency 'ffaker', '~> 2.9'
|
35
35
|
s.add_dependency 'friendly_id', '>= 5.2.1', '< 5.5.0'
|
36
36
|
s.add_dependency 'highline', '~> 2.0.0' # Necessary for the install generator
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.0.
|
4
|
+
version: 4.2.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Schofield
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-01-
|
12
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemerchant
|
@@ -85,14 +85,14 @@ dependencies:
|
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: '3.
|
88
|
+
version: '3.2'
|
89
89
|
type: :runtime
|
90
90
|
prerelease: false
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
93
|
- - "~>"
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '3.
|
95
|
+
version: '3.2'
|
96
96
|
- !ruby/object:Gem::Dependency
|
97
97
|
name: ffaker
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1164,9 +1164,9 @@ licenses:
|
|
1164
1164
|
- BSD-3-Clause
|
1165
1165
|
metadata:
|
1166
1166
|
bug_tracker_uri: https://github.com/spree/spree/issues
|
1167
|
-
changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.
|
1167
|
+
changelog_uri: https://github.com/spree/spree/releases/tag/v4.2.0.rc4
|
1168
1168
|
documentation_uri: https://guides.spreecommerce.org/
|
1169
|
-
source_code_uri: https://github.com/spree/spree/tree/v4.2.0.
|
1169
|
+
source_code_uri: https://github.com/spree/spree/tree/v4.2.0.rc4
|
1170
1170
|
post_install_message:
|
1171
1171
|
rdoc_options: []
|
1172
1172
|
require_paths:
|