card-mod-permissions 0.11.1 → 0.11.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/set/abstract/permission.rb +3 -2
- data/set/all/permissions.rb +11 -7
- data/set/all/update_read_rules.rb +1 -2
- data/set/right/read.rb +3 -5
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 702205228e1f4682a4dcafe6b52fc815308a85fea6129f33c6c7dbcba4d954a1
|
4
|
+
data.tar.gz: a68d350ddd383e303e49279c5a965a3ecfb025707bf2e99111074e924a4e645d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e836f80cd26bf0d1ec99aae1dd233c4d5f78b98fbbcbf18e58f6af76658a4ed1f9507bcd4022d9bbb346e75d7c08c8d1bdd9da0d5af96b045aa5c47dda70e44
|
7
|
+
data.tar.gz: fcc0937ac9a48d4fd89ad3c1d29b822e72f362106b936d84ab8fe325316b4ff7c83f4f9394ff6ca1e1a31f32b75999a1e060ee67545add00d8cc61ab40e25627
|
data/set/abstract/permission.rb
CHANGED
@@ -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
|
data/set/all/permissions.rb
CHANGED
@@ -51,7 +51,7 @@ def direct_rule_card action
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def permission_rule_id action
|
54
|
-
if
|
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,9 +74,11 @@ 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
|
-
errors.add :permission_denied,
|
80
|
+
errors.add :permission_denied,
|
81
|
+
t(:permission_error_no_action_rule, action: action, name: name)
|
82
82
|
raise Card::Error::PermissionDenied, self
|
83
83
|
end
|
84
84
|
|
@@ -110,6 +110,7 @@ def permit action, verb=nil
|
|
110
110
|
end
|
111
111
|
|
112
112
|
return true if permitted? action
|
113
|
+
|
113
114
|
verb ||= action.to_s
|
114
115
|
deny_because you_cant("#{verb} #{name.present? ? name : 'this'}")
|
115
116
|
end
|
@@ -124,6 +125,7 @@ end
|
|
124
125
|
def ok_to_create_side side
|
125
126
|
# left is supercard; create permissions will get checked there.
|
126
127
|
return true if side == :left && superleft
|
128
|
+
|
127
129
|
part_card = send side, new: {}
|
128
130
|
# if no card, there must be other errors
|
129
131
|
return true unless part_card&.new_card? && !part_card.ok?(:create)
|
@@ -144,6 +146,7 @@ end
|
|
144
146
|
def ok_to_update
|
145
147
|
return false unless permit(:update)
|
146
148
|
return true unless type_id_changed? && !permitted?(:create)
|
149
|
+
|
147
150
|
deny_because you_cant("change to this type (need create permission)")
|
148
151
|
end
|
149
152
|
|
@@ -170,17 +173,18 @@ end
|
|
170
173
|
|
171
174
|
def update_field_read_rules
|
172
175
|
return unless type_id_changed? || read_rule_id_changed?
|
176
|
+
|
173
177
|
each_field_as_bot do |field|
|
174
178
|
field.update_read_rule if field.rule(:read) == "_left"
|
175
179
|
end
|
176
180
|
end
|
177
181
|
|
178
|
-
def each_field_as_bot
|
182
|
+
def each_field_as_bot &block
|
179
183
|
# find all cards with me as trunk and update their read_rule
|
180
184
|
# (because of *type plus right)
|
181
185
|
# skip if name is updated because will already be resaved
|
182
186
|
Auth.as_bot do
|
183
|
-
fields.each
|
187
|
+
fields.each(&block)
|
184
188
|
end
|
185
189
|
end
|
186
190
|
|
@@ -1,8 +1,7 @@
|
|
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
|
|
5
|
-
event :update_rule_cache, :finalize, when: :
|
4
|
+
event :update_rule_cache, :finalize, when: :rule? do
|
6
5
|
Card::Rule.clear_rule_cache
|
7
6
|
end
|
8
7
|
|
data/set/right/read.rb
CHANGED
@@ -2,7 +2,7 @@ include Abstract::Permission
|
|
2
2
|
|
3
3
|
format :html do include Abstract::Permission::HtmlFormat end
|
4
4
|
|
5
|
-
event :cascade_read_rule, :finalize, after: :update_rule_cache, when: :
|
5
|
+
event :cascade_read_rule, :finalize, after: :update_rule_cache, when: :rule? do
|
6
6
|
return unless name_is_changing? || trash_is_changing?
|
7
7
|
|
8
8
|
update_read_ruled_cards
|
@@ -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
|
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
|
+
version: 0.11.6
|
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-
|
13
|
+
date: 2021-05-21 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.
|
21
|
+
version: 1.101.6
|
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.
|
28
|
+
version: 1.101.6
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|
@@ -44,10 +44,15 @@ files:
|
|
44
44
|
- set/self/delete.rb
|
45
45
|
- set/self/read.rb
|
46
46
|
- set/self/update.rb
|
47
|
-
homepage:
|
47
|
+
homepage: https://decko.org
|
48
48
|
licenses:
|
49
49
|
- GPL-3.0
|
50
50
|
metadata:
|
51
|
+
source_code_uri: https://github.com/decko-commons/decko
|
52
|
+
homepage_uri: https://decko.org
|
53
|
+
bug_tracker_uri: https://github.com/decko-commons/decko/issues
|
54
|
+
wiki_uri: https://decko.org
|
55
|
+
documentation_url: http://docs.decko.org/
|
51
56
|
card-mod: permissions
|
52
57
|
post_install_message:
|
53
58
|
rdoc_options: []
|
@@ -64,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
69
|
- !ruby/object:Gem::Version
|
65
70
|
version: '0'
|
66
71
|
requirements: []
|
67
|
-
rubygems_version: 3.
|
72
|
+
rubygems_version: 3.1.4
|
68
73
|
signing_key:
|
69
74
|
specification_version: 4
|
70
75
|
summary: decko permissions
|