card-mod-permissions 0.11.4 → 0.11.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 588c237c885364801617bf81982e5c202a6cbc9e0b5f4931bc93f3315152c1a5
4
- data.tar.gz: f0502bd2c432523959497206e788d4d70b8b00bb5712c1a3a4d4684fbf6d6e25
3
+ metadata.gz: b8b4edad152a8ea94c2a359c04185d2ff9349e7e6c0cbdf6fb1ec454b0106c85
4
+ data.tar.gz: 1e14a4bef67298039970e7edc98703966f8273d9644b37861b003df207f11909
5
5
  SHA512:
6
- metadata.gz: a65e935794bf6c7d9a714158582c3941cbdbe08240e9a90c724593b95f584bf798486207550fe6fcffb4004d1ddb22fb579dac6a0fc81ad1235a2f92fc8c36d0
7
- data.tar.gz: 066fda9824c995c94afa6bf641d272b015932dd284a948a2e6715bd025f20a396605d26232465dce304167d839c46c616d5d5345de7c3cb73f4c032f3ee47054
6
+ metadata.gz: 27b47ea8c0829e1b69e9180a4734126ea1d3482acaf6f6fd086ecf750f30dcbeccdfb5a02a5ea94653813c33e428d2d295dc019028d8040b0c68904713be050c
7
+ data.tar.gz: 1b2da5b94b525b8d532dd638c612293885e9d241804b8b7e14fae18ea4820d93c074a6928c6835e449806cf0c31c23d7bb000fdd555350bf407f1a59606d7629
@@ -1,4 +1,3 @@
1
-
2
1
  def standardize_items
3
2
  super unless content == "_left"
4
3
  end
@@ -84,6 +83,7 @@ format :html do
84
83
 
85
84
  def inheritance_checkbox
86
85
  return unless inheritable?
86
+
87
87
  <<-HTML
88
88
  <div class="perm-inheritance perm-section">
89
89
  #{check_box_tag 'inherit', 'inherit', inheriting?}
@@ -106,6 +106,7 @@ format :html do
106
106
 
107
107
  def in_context_of_self_set?
108
108
  return false unless @set_context
109
+
109
110
  @set_context.to_name.tag_name.key == Card[:self].key
110
111
  end
111
112
 
@@ -116,7 +117,7 @@ format :html do
116
117
  link_to_card card_id, nil, target: args[:target]
117
118
  end * ", "
118
119
  "Inherit ( #{links} )"
119
- rescue
120
+ rescue StandardError
120
121
  "Inherit"
121
122
  end
122
123
  end
@@ -51,7 +51,7 @@ def direct_rule_card action
51
51
  end
52
52
 
53
53
  def permission_rule_id action
54
- if junction? && rule(action).match?(/^\[?\[?_left\]?\]?$/)
54
+ if compound? && rule(action).match?(/^\[?\[?_left\]?\]?$/)
55
55
  left_permission_rule_id action
56
56
  else
57
57
  rule_card_id(action)
@@ -64,9 +64,7 @@ end
64
64
 
65
65
  def left_permission_rule_id action
66
66
  lcard = left_or_new(skip_virtual: true, skip_modules: true)
67
- if action == :create && lcard.real? && lcard.action != :create
68
- action = :update
69
- end
67
+ action = :update if action == :create && lcard.real? && lcard.action != :create
70
68
  lcard.permission_rule_id action
71
69
  end
72
70
 
@@ -76,6 +74,7 @@ end
76
74
 
77
75
  def require_permission_rule! rule_id, action
78
76
  return if rule_id
77
+
79
78
  # RULE missing. should not be possible.
80
79
  # generalize this to handling of all required rules
81
80
  errors.add :permission_denied,
@@ -111,6 +110,7 @@ def permit action, verb=nil
111
110
  end
112
111
 
113
112
  return true if permitted? action
113
+
114
114
  verb ||= action.to_s
115
115
  deny_because you_cant("#{verb} #{name.present? ? name : 'this'}")
116
116
  end
@@ -125,6 +125,7 @@ end
125
125
  def ok_to_create_side side
126
126
  # left is supercard; create permissions will get checked there.
127
127
  return true if side == :left && superleft
128
+
128
129
  part_card = send side, new: {}
129
130
  # if no card, there must be other errors
130
131
  return true unless part_card&.new_card? && !part_card.ok?(:create)
@@ -145,6 +146,7 @@ end
145
146
  def ok_to_update
146
147
  return false unless permit(:update)
147
148
  return true unless type_id_changed? && !permitted?(:create)
149
+
148
150
  deny_because you_cant("change to this type (need create permission)")
149
151
  end
150
152
 
@@ -171,17 +173,18 @@ end
171
173
 
172
174
  def update_field_read_rules
173
175
  return unless type_id_changed? || read_rule_id_changed?
176
+
174
177
  each_field_as_bot do |field|
175
178
  field.update_read_rule if field.rule(:read) == "_left"
176
179
  end
177
180
  end
178
181
 
179
- def each_field_as_bot
182
+ def each_field_as_bot &block
180
183
  # find all cards with me as trunk and update their read_rule
181
184
  # (because of *type plus right)
182
185
  # skip if name is updated because will already be resaved
183
186
  Auth.as_bot do
184
- fields.each { |field| yield field }
187
+ fields.each(&block)
185
188
  end
186
189
  end
187
190
 
@@ -1,4 +1,3 @@
1
-
2
1
  # FIXME: the following don't really belong here, but they have to come after
3
2
  # the reference stuff. we need to organize a bit!
4
3
 
data/set/right/read.rb CHANGED
@@ -44,11 +44,9 @@ def update_cards_with_read_rule_id processed
44
44
  end
45
45
  end
46
46
 
47
- def each_member
47
+ def each_member &block
48
48
  Auth.as_bot do
49
- all_members.each_with_object(::Set.new) do |member, processed|
50
- yield member, processed
51
- end
49
+ all_members.each_with_object(::Set.new, &block)
52
50
  end
53
51
  end
54
52
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.11.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-05-05 00:00:00.000000000 Z
13
+ date: 2021-05-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.4
21
+ version: 1.101.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.101.4
28
+ version: 1.101.5
29
29
  description: ''
30
30
  email:
31
31
  - info@decko.org