card-mod-account 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/admin.yml +4 -0
- data/config/locales/de.yml +3 -2
- data/config/locales/en.yml +3 -2
- data/data/files/mod_account_script_asset_output/file.js +2 -2
- data/data/real.yml +29 -15
- data/data/transform/20240510141851_member_ids.rb +7 -0
- data/set/abstract/account_field.rb +11 -3
- data/set/abstract/account_holder.rb +152 -0
- data/set/all/account.rb +3 -84
- data/set/all/password_input.haml +4 -1
- data/set/right/account/events.rb +1 -1
- data/set/right/account/views.rb +4 -4
- data/set/right/account.rb +6 -2
- data/set/right/email.rb +1 -1
- data/set/right/password.rb +4 -3
- data/set/right/status.rb +1 -1
- data/set/self/anonymous.rb +13 -0
- data/set/self/signin.rb +1 -1
- data/set/self/wagn_bot.rb +5 -0
- data/set/type/role.rb +14 -0
- data/set/type/signup/views.rb +1 -1
- data/set/type/signup.rb +1 -1
- data/set/type/user.rb +20 -18
- data/set/type_plus_right/cardtype/account.rb +5 -0
- data/set/type_plus_right/role/members.rb +2 -0
- metadata +23 -18
- data/set/abstract/accountable.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a0d5402c82a124a66eb06050e1ed1568850dc86631e19ac940636b5bed60aae
|
4
|
+
data.tar.gz: 9464fa45a61845dcc62a52b6206aa1ff8accf8c38c62a5e133ff97c93054b355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ebe98ad01d8b3452af57978f69c17c35f8a22adbfc40dd20b72307afd4bb0847bfc9fd798f3ef98c2c12b339f7bfaaff9f2b32cf83162a532ab1c9f0b62715f
|
7
|
+
data.tar.gz: 0c1a6e2c9dc977d1fca4fd5df3cfe3e5368dc53c5fbac56e4f70318de0c1995cea0b59d3b00b960e4658daa5aebe7beab38744adbbd0976d817fc1456011e52d
|
data/config/admin.yml
ADDED
data/config/locales/de.yml
CHANGED
@@ -102,8 +102,9 @@ de:
|
|
102
102
|
account_password_requirements: muss %{char_type} enthalten
|
103
103
|
account_password_requirement_upper: einen Grossbuchstaben
|
104
104
|
account_password_requirement_lower: einene Kleinbuchstaben
|
105
|
-
account_password_requirement_special_char: ein Sonderzeichen (
|
106
|
-
account_password_requirement_number:
|
105
|
+
account_password_requirement_special_char: ein Sonderzeichen (wie !@$%&#)
|
106
|
+
account_password_requirement_number: eine Zahl
|
107
|
+
account_password_requirement_letter: einen Buchstaben
|
107
108
|
account_password_missing: Passwort muss angegeben werden
|
108
109
|
account_private_data: Private Daten
|
109
110
|
account_reset_password: Password Zurücksetzen
|
data/config/locales/en.yml
CHANGED
@@ -17,12 +17,13 @@ en:
|
|
17
17
|
account_invite: Invite
|
18
18
|
account_missing_account: "ERROR: signup card missing account"
|
19
19
|
account_or_sign_up: '...or sign up!'
|
20
|
-
account_password_length: must be
|
20
|
+
account_password_length: must be %{num_char} characters or longer
|
21
21
|
account_password_requirements: must contain %{char_type}
|
22
22
|
account_password_requirement_upper: an upper case letter
|
23
23
|
account_password_requirement_lower: a lower case letter
|
24
|
-
account_password_requirement_special_char: a special character (
|
24
|
+
account_password_requirement_special_char: a special character (like !@$%&#)
|
25
25
|
account_password_requirement_number: a number
|
26
|
+
account_password_requirement_letter: a letter
|
26
27
|
account_password_missing: password can't be blank
|
27
28
|
account_private_data: Private data
|
28
29
|
account_reset_password: Reset password
|
@@ -1,2 +1,2 @@
|
|
1
|
-
//
|
2
|
-
(function(){$(function(){var t
|
1
|
+
// toggle_visibility.js.coffee
|
2
|
+
(function(){$(function(){return $("body").on("click","._toggle-pw-visibility",function(){var i,t;return i=$("._pw-input"),t=$("._pw-text-area"),"password"===i.prop("type")?(i.prop("type","text"),t.find("i").text("visibility")):(i.prop("type","password"),t.find("i").text("visibility_off"))})})}).call(this);
|
data/data/real.yml
CHANGED
@@ -77,17 +77,21 @@
|
|
77
77
|
- :type_plus_right
|
78
78
|
- :update
|
79
79
|
:content:
|
80
|
-
|
80
|
+
- :help_desk
|
81
81
|
|
82
82
|
- :name: "*account"
|
83
83
|
:codename: account
|
84
84
|
:fields:
|
85
85
|
:right:
|
86
86
|
:fields:
|
87
|
-
:create:
|
88
|
-
|
89
|
-
:
|
90
|
-
|
87
|
+
:create:
|
88
|
+
- :administrator
|
89
|
+
:read:
|
90
|
+
- :help_desk
|
91
|
+
:update:
|
92
|
+
- :help_desk
|
93
|
+
:delete:
|
94
|
+
- :help_desk
|
91
95
|
:content: |-
|
92
96
|
<div>When someone signs up, they create a [[Sign up]] card...</div>
|
93
97
|
<blockquote>
|
@@ -119,31 +123,41 @@
|
|
119
123
|
:fields:
|
120
124
|
:right:
|
121
125
|
:fields:
|
122
|
-
:
|
123
|
-
|
124
|
-
:
|
126
|
+
:read:
|
127
|
+
- :help_desk
|
128
|
+
:update:
|
129
|
+
- :help_desk
|
130
|
+
:delete:
|
131
|
+
- :help_desk
|
125
132
|
- :name: "*password"
|
126
133
|
:codename: password
|
127
134
|
:fields:
|
128
135
|
:right:
|
129
136
|
:fields:
|
130
|
-
:
|
131
|
-
|
132
|
-
:
|
137
|
+
:read:
|
138
|
+
- :help_desk
|
139
|
+
:update:
|
140
|
+
- :help_desk
|
141
|
+
:delete:
|
142
|
+
- :help_desk
|
133
143
|
- :name: "*salt"
|
134
144
|
:codename: salt
|
135
145
|
:fields:
|
136
146
|
:right:
|
137
147
|
:fields:
|
138
|
-
:read:
|
148
|
+
:read:
|
149
|
+
- :help_desk
|
139
150
|
- :name: "*status"
|
140
151
|
:codename: status
|
141
152
|
:fields:
|
142
153
|
:right:
|
143
154
|
:fields:
|
144
|
-
:
|
145
|
-
|
146
|
-
:
|
155
|
+
:read:
|
156
|
+
- :help_desk
|
157
|
+
:update:
|
158
|
+
- :help_desk
|
159
|
+
:delete:
|
160
|
+
- :help_desk
|
147
161
|
|
148
162
|
- :name: "*account settings"
|
149
163
|
:codename: account_settings
|
@@ -1,11 +1,19 @@
|
|
1
|
-
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
def account_card
|
4
|
-
left
|
4
|
+
left.tap { |l| return nil unless l.right_id == AccountID }
|
5
|
+
end
|
6
|
+
|
7
|
+
def accounted
|
8
|
+
account_card&.accounted
|
9
|
+
end
|
10
|
+
|
11
|
+
def own_account?
|
12
|
+
account_card&.own_account?
|
5
13
|
end
|
6
14
|
|
7
15
|
# allow account owner to update account field content
|
8
|
-
def ok_to_update
|
16
|
+
def ok_to_update?
|
9
17
|
(own_account? && !name_changed? && !type_id_changed?) || super
|
10
18
|
end
|
11
19
|
|
@@ -0,0 +1,152 @@
|
|
1
|
+
event :validate_account_holder_name_change, :validate, on: :update, changed: :name do
|
2
|
+
return unless account? && !Card::Auth.as_card.account_manager?
|
3
|
+
|
4
|
+
errors.add :name, "cannot rename Account Holder"
|
5
|
+
end
|
6
|
+
|
7
|
+
def account
|
8
|
+
fetch :account, new: {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def account?
|
12
|
+
account.real?
|
13
|
+
end
|
14
|
+
|
15
|
+
def own_account?
|
16
|
+
key == Auth.as_card.key
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_account_status
|
20
|
+
"active"
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_account?
|
24
|
+
id && Auth.current_id == id
|
25
|
+
end
|
26
|
+
|
27
|
+
def parties
|
28
|
+
@parties ||= (all_enabled_roles << id).flatten.reject(&:blank?)
|
29
|
+
end
|
30
|
+
|
31
|
+
def among? ok_ids
|
32
|
+
ok_ids.any? do |ok_id|
|
33
|
+
ok_id == AnyoneID ||
|
34
|
+
# (ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
|
35
|
+
parties.member?(ok_id)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def all_enabled_roles
|
40
|
+
@all_enabled_roles ||= (id == AnonymousID ? [] : enabled_role_ids)
|
41
|
+
end
|
42
|
+
|
43
|
+
def all_roles
|
44
|
+
@all_roles ||= (id == AnonymousID ? [] : fetch_roles)
|
45
|
+
end
|
46
|
+
|
47
|
+
def read_rules
|
48
|
+
@read_rules ||= fetch_read_rules
|
49
|
+
end
|
50
|
+
|
51
|
+
def read_rules_hash
|
52
|
+
@read_rules_hash ||= read_rules.each_with_object({}) { |id, h| h[id] = true }
|
53
|
+
end
|
54
|
+
|
55
|
+
def clear_roles
|
56
|
+
@parties = @all_roles = @all_enabled_roles = @read_rules = nil
|
57
|
+
end
|
58
|
+
|
59
|
+
def ok_to_update?
|
60
|
+
(own_account? && !type_id_changed?) || super
|
61
|
+
end
|
62
|
+
|
63
|
+
def admin?
|
64
|
+
role? AdministratorID
|
65
|
+
end
|
66
|
+
|
67
|
+
def role? role_mark
|
68
|
+
all_enabled_roles.include? role_mark.card_id
|
69
|
+
end
|
70
|
+
|
71
|
+
def account_manager?
|
72
|
+
own_account? || parties.member?(HelpDeskID)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def enabled_role_ids
|
78
|
+
with_enabled_roles do |enabled|
|
79
|
+
enabled.virtual? ? enabled.item_ids : fetch_roles
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def with_enabled_roles
|
84
|
+
Auth.as_bot do
|
85
|
+
Card::Codename.exist?(:enabled_roles) ? yield(enabled_roles_card) : fetch_roles
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def enabled_roles_card
|
90
|
+
fetch :enabled_roles, eager_cache: true, new: { type_id: SessionID }
|
91
|
+
end
|
92
|
+
|
93
|
+
def role_ids_from_role_member_cards
|
94
|
+
Self::Role.role_ids id
|
95
|
+
end
|
96
|
+
|
97
|
+
def fetch_roles
|
98
|
+
[AnyoneSignedInID] + role_ids_from_role_member_cards
|
99
|
+
end
|
100
|
+
|
101
|
+
def fetch_read_rules
|
102
|
+
return [] if id == WagnBotID # always_ok, so not needed
|
103
|
+
|
104
|
+
([AnyoneID] + parties).each_with_object([]) do |party_id, rule_ids|
|
105
|
+
next unless (cache = Card::Rule.read_rule_cache[party_id])
|
106
|
+
|
107
|
+
rule_ids.concat cache
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
format :html do
|
112
|
+
def default_board_tab
|
113
|
+
card.current_account? ? :account_tab : super
|
114
|
+
end
|
115
|
+
|
116
|
+
view :account_tab do
|
117
|
+
board_pill_sections "Account" do
|
118
|
+
[["Settings", account_details_items],
|
119
|
+
["Content", account_content_items]]
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def show_account_tab?
|
124
|
+
card.account?
|
125
|
+
end
|
126
|
+
|
127
|
+
def account_formgroups
|
128
|
+
Auth.as_bot do
|
129
|
+
subformat(card.account)._render :content_formgroups, structure: true
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def account_details_items
|
134
|
+
[
|
135
|
+
["Email and Password", :account,
|
136
|
+
{ path: { slot: { hide: %i[help_link board_link] } } }],
|
137
|
+
["Roles", :roles,
|
138
|
+
{ path: { view: :content } }],
|
139
|
+
["Notifications", :follow],
|
140
|
+
# FIXME: this should be added in api_key mod!
|
141
|
+
["API", :account,
|
142
|
+
{ path: { view: :api_key,
|
143
|
+
items: { view: :content },
|
144
|
+
slot: { hide: %i[help_link board_link] } } }]
|
145
|
+
]
|
146
|
+
end
|
147
|
+
|
148
|
+
def account_content_items
|
149
|
+
[["Created", :created],
|
150
|
+
["Edited", :edited]]
|
151
|
+
end
|
152
|
+
end
|
data/set/all/account.rb
CHANGED
@@ -5,92 +5,11 @@ module ClassMethods
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def account
|
8
|
-
|
8
|
+
nil
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def among? ok_ids
|
16
|
-
ok_ids.any? do |ok_id|
|
17
|
-
ok_id == AnyoneID ||
|
18
|
-
# (ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
|
19
|
-
parties.member?(ok_id)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def own_account?
|
24
|
-
# card is +*account card of signed_in user.
|
25
|
-
name.part_names[0].key == Auth.as_card.key &&
|
26
|
-
name.part_names[1].key == Card[:account].key
|
27
|
-
end
|
28
|
-
|
29
|
-
def read_rules
|
30
|
-
@read_rules ||= fetch_read_rules
|
31
|
-
end
|
32
|
-
|
33
|
-
def read_rules_hash
|
34
|
-
@read_rules_hash ||= read_rules.each_with_object({}) { |id, h| h[id] = true }
|
35
|
-
end
|
36
|
-
|
37
|
-
def fetch_read_rules
|
38
|
-
return [] if id == WagnBotID # always_ok, so not needed
|
39
|
-
|
40
|
-
([AnyoneID] + parties).each_with_object([]) do |party_id, rule_ids|
|
41
|
-
next unless (cache = Card::Rule.read_rule_cache[party_id])
|
42
|
-
|
43
|
-
rule_ids.concat cache
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def clear_roles
|
48
|
-
@parties = @all_roles = @all_active_roles = @read_rules = nil
|
49
|
-
end
|
50
|
-
|
51
|
-
# def with_clear_roles
|
52
|
-
# a = @parties
|
53
|
-
# b = @all_roles
|
54
|
-
# c = @all_active_roles
|
55
|
-
# d = @read_rules
|
56
|
-
# yield
|
57
|
-
# ensure
|
58
|
-
# @parties = a
|
59
|
-
# @all_roles = b
|
60
|
-
# @all_active_roles = c
|
61
|
-
# @read_rules = d
|
62
|
-
# end
|
63
|
-
|
64
|
-
def all_enabled_roles
|
65
|
-
@all_active_roles ||= (id == AnonymousID ? [] : enabled_role_ids)
|
66
|
-
end
|
67
|
-
|
68
|
-
def all_roles
|
69
|
-
@all_roles ||= (id == AnonymousID ? [] : fetch_roles)
|
70
|
-
end
|
71
|
-
|
72
|
-
def enabled_role_ids
|
73
|
-
with_enabled_roles do |enabled|
|
74
|
-
enabled.virtual? ? enabled.item_ids : fetch_roles
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def with_enabled_roles
|
79
|
-
Auth.as_bot do
|
80
|
-
Card::Codename.exists?(:enabled_roles) ? yield(enabled_roles_card) : fetch_roles
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def enabled_roles_card
|
85
|
-
fetch :enabled_roles, eager_cache: true, new: { type_id: SessionID }
|
86
|
-
end
|
87
|
-
|
88
|
-
def fetch_roles
|
89
|
-
[AnyoneSignedInID] + role_ids_from_role_member_cards
|
90
|
-
end
|
91
|
-
|
92
|
-
def role_ids_from_role_member_cards
|
93
|
-
Self::Role.role_ids id
|
11
|
+
def account?
|
12
|
+
false
|
94
13
|
end
|
95
14
|
|
96
15
|
event :generate_token do
|
data/set/all/password_input.haml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
= password_field :content, class: "d0-card-content _pw-input",
|
3
|
+
placeholder: "Password",
|
4
|
+
autocomplete: "off"
|
2
5
|
%span._toggle-password.visibility-icon._pw-text-area
|
3
6
|
= icon_tag :hide_password, class: "_toggle-pw-visibility"
|
data/set/right/account/events.rb
CHANGED
data/set/right/account/views.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
format do
|
2
|
-
view :verify_url, cache: :never do
|
2
|
+
view :verify_url, cache: :never, denial: :blank do
|
3
3
|
raise Error::PermissionDenied unless card.ok?(:create) || card.action
|
4
4
|
|
5
5
|
token_url :verify_and_activate, anonymous: true
|
6
6
|
end
|
7
7
|
|
8
|
-
view :reset_password_url do
|
8
|
+
view :reset_password_url, denial: :blank do
|
9
9
|
raise Error::PermissionDenied unless card.password_card.ok? :update
|
10
10
|
|
11
11
|
token_url :reset_password
|
12
12
|
end
|
13
13
|
|
14
|
-
view :token_expiry do
|
14
|
+
view :token_expiry, denial: :blank do
|
15
15
|
"(#{token_expiry_sentence}"
|
16
16
|
end
|
17
17
|
|
18
|
-
view :token_days do
|
18
|
+
view :token_days, denial: :blank do
|
19
19
|
Card.config.token_expiry / 1.day
|
20
20
|
end
|
21
21
|
|
data/set/right/account.rb
CHANGED
@@ -7,6 +7,10 @@ card_accessor :status
|
|
7
7
|
|
8
8
|
require_field :email
|
9
9
|
|
10
|
+
def own_account?
|
11
|
+
accounted&.try :own_account?
|
12
|
+
end
|
13
|
+
|
10
14
|
def accounted
|
11
15
|
left
|
12
16
|
end
|
@@ -15,12 +19,12 @@ def accounted_id
|
|
15
19
|
left_id
|
16
20
|
end
|
17
21
|
|
18
|
-
def ok_to_read
|
22
|
+
def ok_to_read?
|
19
23
|
own_account? || super
|
20
24
|
end
|
21
25
|
|
22
26
|
# allow account owner to update account field content
|
23
|
-
def ok_to_update
|
27
|
+
def ok_to_update?
|
24
28
|
(own_account? && !name_changed? && !type_id_changed?) || super
|
25
29
|
end
|
26
30
|
|
data/set/right/email.rb
CHANGED
data/set/right/password.rb
CHANGED
@@ -5,15 +5,16 @@ assign_type :phrase
|
|
5
5
|
PASSWORD_REGEX = {
|
6
6
|
lower: /[a-z]/,
|
7
7
|
upper: /[A-Z]/,
|
8
|
-
special_char: /[
|
9
|
-
number: /\d
|
8
|
+
special_char: /[!"#$%&'()*+,-.\/:;<=>?@\[\]\\^_`{|}~]/,
|
9
|
+
number: /\d+/,
|
10
|
+
letter: /[a-zA-Z]/
|
10
11
|
}.freeze
|
11
12
|
|
12
13
|
def history?
|
13
14
|
false
|
14
15
|
end
|
15
16
|
|
16
|
-
def ok_to_read
|
17
|
+
def ok_to_read?
|
17
18
|
own_account? || super
|
18
19
|
end
|
19
20
|
|
data/set/right/status.rb
CHANGED
data/set/self/signin.rb
CHANGED
data/set/type/role.rb
CHANGED
@@ -9,6 +9,20 @@ format :html do
|
|
9
9
|
role_checkbox
|
10
10
|
end
|
11
11
|
|
12
|
+
view :configs do
|
13
|
+
configs_by_cat = card.all_admin_configs_grouped_by(:roles, :category)[card.codename]
|
14
|
+
configs_by_cat.map do |(cat, configs)|
|
15
|
+
if cat == "cardtypes"
|
16
|
+
nested_list_section cat.capitalize,
|
17
|
+
card.config_codenames_grouped_by_title(configs)
|
18
|
+
elsif cat == "views"
|
19
|
+
next
|
20
|
+
else
|
21
|
+
list_section cat.capitalize, configs.map { |c| c.codename.to_sym }, :closed_bar
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
12
26
|
def role_checkbox
|
13
27
|
name = card.disabled? ? "add_item" : "drop_item"
|
14
28
|
subformat(Auth.current.field(:disabled_roles)).card_form :update do
|
data/set/type/signup/views.rb
CHANGED
data/set/type/signup.rb
CHANGED
data/set/type/user.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
-
include_set Abstract::
|
1
|
+
include_set Abstract::AccountHolder
|
2
|
+
|
3
|
+
basket[:roles_for_first_user] = %i[help_desk shark administrator]
|
2
4
|
|
3
5
|
attr_accessor :email
|
4
6
|
|
5
7
|
format :html do
|
6
8
|
delegate :needs_setup?, to: Card::Auth
|
7
9
|
|
8
|
-
view :setup, unknown: true, perms: :needs_setup
|
10
|
+
view :setup, unknown: true, perms: :needs_setup?, cache: :never do
|
9
11
|
with_nest_mode :edit do
|
10
12
|
voo.title = "Your deck is ready to go!" # LOCALIZE
|
11
13
|
voo.show! :help
|
@@ -36,37 +38,37 @@ format :html do
|
|
36
38
|
|
37
39
|
def setup_hidden_fields
|
38
40
|
hidden_tags(
|
39
|
-
|
40
|
-
|
41
|
-
|
41
|
+
card: {
|
42
|
+
type_id: Card.default_accounted_type_id,
|
43
|
+
trigger: %w[check_setup]
|
44
|
+
},
|
45
|
+
success: { redirect: true, mark: path(mark: "") }
|
42
46
|
)
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
|
47
|
-
def setup?
|
48
|
-
Card::Env.params[:setup]
|
49
|
-
end
|
50
|
-
|
51
|
-
event :setup_as_bot, before: :check_permissions, on: :create, when: :setup? do
|
50
|
+
event :check_setup, before: :check_permissions, on: :create, trigger: :required do
|
52
51
|
abort :failure unless Auth.needs_setup?
|
53
52
|
Auth.as_bot
|
53
|
+
@setup_approved = true
|
54
54
|
# we need bot authority to set the initial administrator roles
|
55
55
|
# this is granted and inspected here as a separate event for
|
56
56
|
# flexibility and security when configuring initial setups
|
57
57
|
end
|
58
58
|
|
59
|
-
event :setup_first_user, :
|
59
|
+
event :setup_first_user, :finalize, on: :create, when: :setup? do
|
60
60
|
subcard %i[signup_alert_email to].cardname, content: name
|
61
|
-
roles_for_first_user.each do |role|
|
62
|
-
subcard [role, :members], content: name
|
61
|
+
basket[:roles_for_first_user].map(&:cardname).each do |role|
|
62
|
+
subcard [role, :members].cardname, content: name
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def roles_for_first_user
|
67
|
-
%i[help_desk shark administrator].map(&:cardname)
|
68
|
-
end
|
69
|
-
|
70
66
|
event :signin_after_setup, :integrate, on: :create, when: :setup? do
|
71
67
|
Auth.signin id
|
72
68
|
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
def setup?
|
73
|
+
@setup_approved == true
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: card-mod-account
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.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: 2024-10-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,84 +18,84 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.108.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.108.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: card-mod-email
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.18.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.18.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: card-mod-permissions
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - '='
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.
|
49
|
+
version: 0.18.0
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - '='
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
56
|
+
version: 0.18.0
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: card-mod-list
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - '='
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 0.
|
63
|
+
version: 0.18.0
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - '='
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 0.
|
70
|
+
version: 0.18.0
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: card-mod-integrate
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
77
|
+
version: 0.18.0
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
84
|
+
version: 0.18.0
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: card-mod-edit
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - '='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.
|
91
|
+
version: 0.18.0
|
92
92
|
type: :runtime
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - '='
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
98
|
+
version: 0.18.0
|
99
99
|
description: ''
|
100
100
|
email:
|
101
101
|
- info@decko.org
|
@@ -107,14 +107,16 @@ files:
|
|
107
107
|
- README.md
|
108
108
|
- assets/script/toggle_visibility.js.coffee
|
109
109
|
- assets/style/account.scss
|
110
|
+
- config/admin.yml
|
110
111
|
- config/locales/de.yml
|
111
112
|
- config/locales/en.yml
|
112
113
|
- data/files/mod_account_script_asset_output/file.js
|
113
114
|
- data/real.yml
|
114
115
|
- data/transform/20220815112551_move_roles.rb
|
116
|
+
- data/transform/20240510141851_member_ids.rb
|
115
117
|
- lib/card/mod/account.rb
|
116
118
|
- set/abstract/account_field.rb
|
117
|
-
- set/abstract/
|
119
|
+
- set/abstract/account_holder.rb
|
118
120
|
- set/all/account.rb
|
119
121
|
- set/all/password_input.haml
|
120
122
|
- set/all/password_input.rb
|
@@ -126,20 +128,23 @@ files:
|
|
126
128
|
- set/right/roles.rb
|
127
129
|
- set/right/salt.rb
|
128
130
|
- set/right/status.rb
|
131
|
+
- set/self/anonymous.rb
|
129
132
|
- set/self/role.rb
|
130
133
|
- set/self/signin.rb
|
131
134
|
- set/self/signin/core.haml
|
135
|
+
- set/self/wagn_bot.rb
|
132
136
|
- set/type/role.rb
|
133
137
|
- set/type/signup.rb
|
134
138
|
- set/type/signup/core.haml
|
135
139
|
- set/type/signup/views.rb
|
136
140
|
- set/type/user.rb
|
137
141
|
- set/type/user/setup_help.haml
|
142
|
+
- set/type_plus_right/cardtype/account.rb
|
138
143
|
- set/type_plus_right/role/members.rb
|
139
144
|
- set/type_plus_right/user/email.rb
|
140
145
|
homepage: https://decko.org
|
141
146
|
licenses:
|
142
|
-
- GPL-3.0
|
147
|
+
- GPL-3.0-or-later
|
143
148
|
metadata:
|
144
149
|
source_code_uri: https://github.com/decko-commons/decko
|
145
150
|
homepage_uri: https://decko.org
|
@@ -156,14 +161,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
161
|
requirements:
|
157
162
|
- - ">="
|
158
163
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
164
|
+
version: '3.0'
|
160
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
166
|
requirements:
|
162
167
|
- - ">="
|
163
168
|
- !ruby/object:Gem::Version
|
164
169
|
version: '0'
|
165
170
|
requirements: []
|
166
|
-
rubygems_version: 3.
|
171
|
+
rubygems_version: 3.5.7
|
167
172
|
signing_key:
|
168
173
|
specification_version: 4
|
169
174
|
summary: Email-based account handling for decko cards
|
data/set/abstract/accountable.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
def account
|
2
|
-
fetch :account, new: {}
|
3
|
-
end
|
4
|
-
|
5
|
-
def default_account_status
|
6
|
-
"active"
|
7
|
-
end
|
8
|
-
|
9
|
-
def current_account?
|
10
|
-
id && Auth.current_id == id
|
11
|
-
end
|
12
|
-
|
13
|
-
format :html do
|
14
|
-
def default_board_tab
|
15
|
-
card.current_account? ? :account_tab : super
|
16
|
-
end
|
17
|
-
|
18
|
-
view :account_tab do
|
19
|
-
board_pill_sections "Account" do
|
20
|
-
[["Settings", account_details_items],
|
21
|
-
["Content", account_content_items]]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def show_account_tab?
|
26
|
-
card.account.real?
|
27
|
-
end
|
28
|
-
|
29
|
-
def account_formgroups
|
30
|
-
Auth.as_bot do
|
31
|
-
subformat(card.account)._render :content_formgroups, structure: true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def account_details_items
|
36
|
-
[
|
37
|
-
["Email and Password", :account,
|
38
|
-
{ path: { slot: { hide: %i[help_link board_link] } } }],
|
39
|
-
["Roles", :roles,
|
40
|
-
{ path: { view: :content } }],
|
41
|
-
["Notifications", :follow],
|
42
|
-
# FIXME: this should be added in api_key mod!
|
43
|
-
["API", :account,
|
44
|
-
{ path: { view: :api_key,
|
45
|
-
items: { view: :content },
|
46
|
-
slot: { hide: %i[help_link board_link] } } }]
|
47
|
-
]
|
48
|
-
end
|
49
|
-
|
50
|
-
def account_content_items
|
51
|
-
[["Created", :created],
|
52
|
-
["Edited", :edited]]
|
53
|
-
end
|
54
|
-
end
|