card 1.17.2 → 1.17.3

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.
@@ -50,7 +50,7 @@ class SharedData
50
50
  #above still necessary? try commenting out above and 'Sign up' below
51
51
  Card::Auth.current_id = Card::WagnBotID # need to reset after creating sign up, which changes current_id for extend phase
52
52
 
53
- no_samples = %( user sign_up set number list listed_by )
53
+ no_samples = %( user sign_up set number list listed_by file image )
54
54
  Card::Auth.createable_types.each do |type|
55
55
  next if no_samples.include? type.to_name.key
56
56
  Card.create! type: type, name: "Sample #{type}"
@@ -97,6 +97,8 @@ class SharedData
97
97
  Card.create! type_code: 'cardtype', name: "Cardtype E", codename: 'cardtype_e'
98
98
  Card.create! type_code: 'cardtype', name: "Cardtype F", codename: 'cardtype_f'
99
99
 
100
+ Card::Codename.reset_cache
101
+
100
102
  Card.create! name: 'basicname', content: 'basiccontent'
101
103
  Card.create! type_code: 'cardtype_a', name: "type-a-card", content: 'type_a_content'
102
104
  Card.create! type_code: 'cardtype_b', name: "type-b-card", content: 'type_b_content'
@@ -2,6 +2,22 @@
2
2
  Card.error_codes.merge! permission_denied: [:denial, 403],
3
3
  captcha: [:errors, 449]
4
4
 
5
+ module ClassMethods
6
+ def repair_all_permissions
7
+ Card.where(
8
+ '(read_rule_class is null or read_rule_id is null) and trash is false'
9
+ ).each do |broken_card|
10
+ broken_card.include_set_modules
11
+ broken_card.repair_permissions!
12
+ end
13
+ end
14
+ end
15
+
16
+ def repair_permissions!
17
+ rule_id, rule_class = permission_rule_id_and_class :read
18
+ update_columns read_rule_id: rule_id, read_rule_class: rule_class
19
+ end
20
+
5
21
  # ok? and ok! are public facing methods to approve one action at a time
6
22
  #
7
23
  # fetching: if the optional :trait parameter is supplied, it is passed
@@ -13,13 +13,13 @@ module ClassMethods
13
13
  def delete_trashed_files
14
14
  trashed_card_ids = all_trashed_card_ids
15
15
  file_ids = all_file_ids
16
+ dir = Cardio.paths['files'].existent.first
16
17
  file_ids.each do |file_id|
17
- if trashed_card_ids.member?(file_id)
18
- if Card.exists?(file_id) # double check!
19
- fail Card::Error, 'Narrowly averted deleting current file'
20
- end
21
- FileUtils.rm_rf "#{dir}/#{file_id}", secure: true
18
+ next unless trashed_card_ids.member?(file_id)
19
+ if Card.exists?(file_id) # double check!
20
+ fail Card::Error, 'Narrowly averted deleting current file'
22
21
  end
22
+ FileUtils.rm_rf "#{dir}/#{file_id}", secure: true
23
23
  end
24
24
  end
25
25
 
@@ -1,3 +1,4 @@
1
+
1
2
  def standardize_items
2
3
  # noop to override default behavior, which wouldn't let '_left' through and would therefore break
3
4
  end
@@ -9,6 +9,7 @@ event :admin_tasks, on: :update, before: :approve do
9
9
  when :clear_view_cache then Card::ViewCache.reset
10
10
  when :delete_old_revisions then Card::Action.delete_old
11
11
  when :delete_old_sessions then Card.delete_old_sessions
12
+ when :repair_permissions then Card.repair_all_permissions
12
13
  end
13
14
  Env.params[:success] = Card[:stats].name
14
15
  abort :success
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2
4
+ version: 1.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-02-08 00:00:00.000000000 Z
14
+ date: 2016-02-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname