card-mod-permissions 0.14.1 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/style/permissions.scss +10 -0
- data/data/real.yml +54 -0
- data/data/test.yml +97 -0
- data/set/abstract/permission.rb +2 -2
- data/set/all/permissions.rb +1 -5
- data/set/right/create.rb +2 -0
- data/set/right/delete.rb +2 -0
- data/set/right/read.rb +3 -0
- data/set/right/update.rb +2 -0
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf30084e64226d72fb5c1fdf33d5ef281018e80301c6ee3aba9d4007e263777f
|
4
|
+
data.tar.gz: e6f8dfb2358c5439efc4272597ad42edd7d16fd86011b5afd28dc8cdc9d5c50a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc7fa29f19695ab63f32f49ea1405a0af5d5b4cf4225c92101ad1b6797cdc3e0ae59bc534f772ea203a06c15a835039d9e6a008bbb7f07d79ca5718aece7d6e7
|
7
|
+
data.tar.gz: 2294dd59bd49f131164aed0690181fb3e51563573459c1a5d983d4784bbbe93c22b977f4f6c5f1a4a14c6d62434ffad9e2c3fbac96691f9f4233a7c16757ec68
|
data/data/real.yml
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
- :name: "*create"
|
2
|
+
:type: :setting
|
3
|
+
:codename: create
|
4
|
+
- :name: "*read"
|
5
|
+
:type: :setting
|
6
|
+
:codename: read
|
7
|
+
- :name: "*update"
|
8
|
+
:type: :setting
|
9
|
+
:codename: update
|
10
|
+
- :name: "*delete"
|
11
|
+
:type: :setting
|
12
|
+
:codename: delete
|
13
|
+
|
14
|
+
- :codename: all
|
15
|
+
:fields:
|
16
|
+
:read: Anyone
|
17
|
+
:create: Anyone Signed In
|
18
|
+
:update: Anyone Signed In
|
19
|
+
:delete: Anyone Signed In
|
20
|
+
|
21
|
+
- :codename: all_plus
|
22
|
+
:fields:
|
23
|
+
:read: _left
|
24
|
+
:create: _left
|
25
|
+
:update: _left
|
26
|
+
:delete: _left
|
27
|
+
|
28
|
+
- :codename: star
|
29
|
+
:fields:
|
30
|
+
:create: Administrator
|
31
|
+
:update: Administrator
|
32
|
+
:delete: Administrator
|
33
|
+
|
34
|
+
- :codename: rstar
|
35
|
+
:fields:
|
36
|
+
:create: Shark
|
37
|
+
:update: Shark
|
38
|
+
:delete: Shark
|
39
|
+
|
40
|
+
- :name:
|
41
|
+
- :html
|
42
|
+
- :type
|
43
|
+
:fields:
|
44
|
+
:create: Shark
|
45
|
+
:update: Shark
|
46
|
+
:delete: Shark
|
47
|
+
|
48
|
+
- :name:
|
49
|
+
- :cardtype
|
50
|
+
- :type
|
51
|
+
:fields:
|
52
|
+
:create: Shark
|
53
|
+
:update: Shark
|
54
|
+
:delete: Shark
|
data/data/test.yml
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
---
|
2
|
+
- :name: Fruit
|
3
|
+
:type: :cardtype
|
4
|
+
- :name:
|
5
|
+
- Fruit
|
6
|
+
- :type
|
7
|
+
- :create
|
8
|
+
:type: :list
|
9
|
+
:content: Anyone
|
10
|
+
- :name:
|
11
|
+
- Fruit
|
12
|
+
- :type
|
13
|
+
- :read
|
14
|
+
:type: :list
|
15
|
+
:content: Administrator
|
16
|
+
- :name:
|
17
|
+
- :cardtype_b
|
18
|
+
- :type
|
19
|
+
- :create
|
20
|
+
:type: :list
|
21
|
+
:content: r3
|
22
|
+
- :name:
|
23
|
+
- :cardtype_b
|
24
|
+
- :type
|
25
|
+
- :update
|
26
|
+
:type: :list
|
27
|
+
:content: r1
|
28
|
+
|
29
|
+
- :name: u1
|
30
|
+
:type: :user
|
31
|
+
:conflict: :defer
|
32
|
+
:fields:
|
33
|
+
:account:
|
34
|
+
:fields:
|
35
|
+
:email: u1@user.com
|
36
|
+
:password: u1_pass
|
37
|
+
- :name: u2
|
38
|
+
:type: :user
|
39
|
+
:conflict: :defer
|
40
|
+
:fields:
|
41
|
+
:account:
|
42
|
+
:fields:
|
43
|
+
:email: u2@user.com
|
44
|
+
:password: u2_pass
|
45
|
+
|
46
|
+
- :name: u3
|
47
|
+
:type: :user
|
48
|
+
:conflict: :defer
|
49
|
+
:fields:
|
50
|
+
:account:
|
51
|
+
:fields:
|
52
|
+
:email: u3@user.com
|
53
|
+
:password: u3_pass
|
54
|
+
|
55
|
+
|
56
|
+
- :name: Administrator
|
57
|
+
:fields:
|
58
|
+
:members:
|
59
|
+
- Joe Admin
|
60
|
+
- u3
|
61
|
+
- :name: Shark
|
62
|
+
:fields:
|
63
|
+
:members:
|
64
|
+
- Joe Admin
|
65
|
+
- Joe User
|
66
|
+
- u3
|
67
|
+
- :name: Help Desk
|
68
|
+
:fields:
|
69
|
+
:members:
|
70
|
+
- Joe Admin
|
71
|
+
|
72
|
+
|
73
|
+
- :name: r1
|
74
|
+
:type: :role
|
75
|
+
:fields:
|
76
|
+
:members:
|
77
|
+
- u1
|
78
|
+
- u2
|
79
|
+
- u3
|
80
|
+
- :name: r2
|
81
|
+
:type: :role
|
82
|
+
:fields:
|
83
|
+
:members:
|
84
|
+
- u1
|
85
|
+
- u2
|
86
|
+
- :name: r3
|
87
|
+
:type: :role
|
88
|
+
:fields:
|
89
|
+
:members:
|
90
|
+
- u1
|
91
|
+
- :name: r4
|
92
|
+
:type: :role
|
93
|
+
:fields:
|
94
|
+
:members:
|
95
|
+
- u2
|
96
|
+
- u3
|
97
|
+
|
data/set/abstract/permission.rb
CHANGED
@@ -47,7 +47,7 @@ format :html do
|
|
47
47
|
def groups item_names
|
48
48
|
group_options.map do |option|
|
49
49
|
checked = !item_names.delete(option.name).nil?
|
50
|
-
icon = icon_tag "open_in_new", "
|
50
|
+
icon = icon_tag "open_in_new", "text-muted"
|
51
51
|
option_link = link_to_card option.name, icon, target: "decko_role"
|
52
52
|
box = check_box_tag "#{option.key}-perm-checkbox",
|
53
53
|
option.name, checked, class: "perm-checkbox-button"
|
@@ -63,7 +63,7 @@ format :html do
|
|
63
63
|
|
64
64
|
def group_options
|
65
65
|
Auth.as_bot do
|
66
|
-
Card.search({ type_id: RoleID,
|
66
|
+
Card.search({ type_id: RoleID, sort_by: "name" }, "roles by name")
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
data/set/all/permissions.rb
CHANGED
@@ -34,10 +34,6 @@ def ok? action
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def ok! action
|
38
|
-
raise Card::Error::PermissionDenied, self unless ok? action
|
39
|
-
end
|
40
|
-
|
41
37
|
def who_can action
|
42
38
|
permission_rule_card(action).item_cards.map(&:id)
|
43
39
|
end
|
@@ -56,7 +52,7 @@ def permission_rule_id action
|
|
56
52
|
if compound? && rule(action).match?(/^\[?\[?_left\]?\]?$/)
|
57
53
|
left_permission_rule_id action
|
58
54
|
else
|
59
|
-
rule_card_id
|
55
|
+
rule_card_id action
|
60
56
|
end
|
61
57
|
end
|
62
58
|
|
data/set/right/create.rb
CHANGED
data/set/right/delete.rb
CHANGED
data/set/right/read.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
include Abstract::Permission
|
2
2
|
|
3
|
+
assign_type :list
|
4
|
+
|
3
5
|
format :html do include Abstract::Permission::HtmlFormat end
|
4
6
|
|
5
7
|
event :cascade_read_rule, :finalize, after: :update_rule_cache, when: :rule? do
|
@@ -24,6 +26,7 @@ def update_read_rules_of_set_members
|
|
24
26
|
|
25
27
|
each_member do |member, processed|
|
26
28
|
processed << member.key
|
29
|
+
member.update_read_rule
|
27
30
|
member.update_read_rule unless member_has_overriding_rule?(member)
|
28
31
|
end
|
29
32
|
end
|
data/set/right/update.rb
CHANGED
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.
|
4
|
+
version: 0.15.0
|
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:
|
13
|
+
date: 2023-01-04 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.
|
21
|
+
version: 1.105.0
|
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.
|
28
|
+
version: 1.105.0
|
29
29
|
description: ''
|
30
30
|
email:
|
31
31
|
- info@decko.org
|
@@ -33,6 +33,9 @@ executables: []
|
|
33
33
|
extensions: []
|
34
34
|
extra_rdoc_files: []
|
35
35
|
files:
|
36
|
+
- assets/style/permissions.scss
|
37
|
+
- data/real.yml
|
38
|
+
- data/test.yml
|
36
39
|
- locales/de.yml
|
37
40
|
- locales/en.yml
|
38
41
|
- set/abstract/permission.rb
|
@@ -56,6 +59,7 @@ metadata:
|
|
56
59
|
wiki_uri: https://decko.org
|
57
60
|
documentation_url: http://docs.decko.org/
|
58
61
|
card-mod: permissions
|
62
|
+
card-mod-group: gem-defaults
|
59
63
|
post_install_message:
|
60
64
|
rdoc_options: []
|
61
65
|
require_paths:
|
@@ -71,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
75
|
- !ruby/object:Gem::Version
|
72
76
|
version: '0'
|
73
77
|
requirements: []
|
74
|
-
rubygems_version: 3.
|
78
|
+
rubygems_version: 3.3.11
|
75
79
|
signing_key:
|
76
80
|
specification_version: 4
|
77
81
|
summary: decko permissions
|