symphonia 4.2.0 → 5.0.0
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.
- checksums.yaml +4 -4
- data/README.md +27 -1
- data/app/assets/javascripts/symphonia/application.js +3 -3
- data/app/assets/stylesheets/symphonia/_font_awesome.scss +8 -6
- data/app/assets/stylesheets/symphonia/_layout.scss +33 -1
- data/app/assets/stylesheets/symphonia/basic.scss +3 -99
- data/app/assets/stylesheets/symphonia/filters.scss +3 -5
- data/app/assets/stylesheets/symphonia/symphonia_bootstrap.scss +1 -1
- data/app/controllers/symphonia/accounts_controller.rb +7 -3
- data/app/controllers/symphonia/application_controller.rb +2 -1
- data/app/controllers/symphonia/users_controller.rb +17 -29
- data/app/helpers/symphonia/application_helper.rb +48 -26
- data/app/models/symphonia/preference.rb +5 -5
- data/app/models/symphonia/user.rb +3 -35
- data/app/models/symphonia/user_ability.rb +46 -0
- data/app/views/common/403.html.erb +4 -3
- data/app/views/layouts/symphonia/application.html.erb +4 -4
- data/app/views/symphonia/accounts/_detail.html.erb +21 -18
- data/app/views/symphonia/common/_filters.html.erb +15 -15
- data/app/views/symphonia/common/_share_links.html.erb +2 -3
- data/app/views/symphonia/users/_form.html.erb +1 -6
- data/app/views/symphonia/users/show.html.erb +15 -20
- data/config/locales/cs.yml +3 -2
- data/db/migrate/20130714140500_create_users.rb +0 -2
- data/db/seeds.rb +3 -3
- data/lib/generators/symphonia/entity_controller/entity_controller_generator.rb +2 -2
- data/lib/generators/symphonia/entity_controller/templates/{controller.rb → controller.rb.tt} +0 -0
- data/lib/symphonia/admin_constraint.rb +1 -1
- data/lib/symphonia/base_controller.rb +9 -17
- data/lib/symphonia/controller_extensions.rb +5 -15
- data/lib/symphonia/engine.rb +12 -40
- data/lib/symphonia/form_builder.rb +17 -16
- data/lib/symphonia/menu_manager.rb +15 -11
- data/lib/symphonia/object.rb +9 -9
- data/lib/symphonia/spec_helper.rb +8 -4
- data/lib/symphonia/user_management.rb +1 -1
- data/lib/symphonia/version.rb +1 -1
- data/lib/symphonia.rb +12 -9
- data/spec/factories/factories.rb +0 -4
- data/spec/models/user_spec.rb +39 -2
- data/spec/spec_helper.rb +0 -1
- data/spec/support/stub_users.rb +7 -7
- metadata +39 -124
- data/app/controllers/symphonia/roles_controller.rb +0 -39
- data/app/models/symphonia/role.rb +0 -55
- data/app/views/symphonia/roles/_form.html.erb +0 -26
- data/app/views/symphonia/roles/edit.html.erb +0 -5
- data/app/views/symphonia/roles/index.html.erb +0 -6
- data/app/views/symphonia/roles/new.html.erb +0 -4
- data/app/views/symphonia/roles/show.html.erb +0 -11
- data/db/migrate/20130714140501_create_roles.rb +0 -18
- data/db/migrate/20210509141420_roles_change_permissions_to_json.rb +0 -18
- data/db/migrate/20210509180525_roles_change_permissions_to_native_json.rb +0 -7
- data/lib/symphonia/permissions.rb +0 -93
- data/spec/controllers/roles_controller_spec.rb +0 -12
- data/spec/models/role_spec.rb +0 -13
- data/spec/requests/roles_spec.rb +0 -10
@@ -1,26 +1,26 @@
|
|
1
1
|
module Symphonia
|
2
2
|
class FormBuilder < ::BootstrapForm::FormBuilder
|
3
3
|
|
4
|
+
delegate :tag, :t, to: :@template
|
5
|
+
|
4
6
|
def error_messages
|
5
|
-
if object.respond_to?(:errors)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
12
|
-
content_tag(:div, list, class: 'error_explanation')
|
7
|
+
return if !object.respond_to?(:errors) || object.errors.blank?
|
8
|
+
|
9
|
+
list = tag.p(@template.icon("circle-exclamation", t('activerecord.errors.template.body')))
|
10
|
+
list += tag.ul do
|
11
|
+
object.errors.full_messages.collect do |error|
|
12
|
+
tag.li error
|
13
|
+
end.join.html_safe
|
13
14
|
end
|
15
|
+
tag.div(list, class: 'alert alert-danger error_explanation')
|
14
16
|
end
|
15
17
|
|
16
18
|
def calendar_field(name, options = {})
|
17
|
-
options[:
|
18
|
-
options
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
append: @template.fa_icon('calendar')
|
23
|
-
}))
|
19
|
+
options[:type] ||= "date"
|
20
|
+
text_field(name, options.merge(
|
21
|
+
class: 'form-control datepicker',
|
22
|
+
append: @template.icon('calendar'),
|
23
|
+
))
|
24
24
|
end
|
25
25
|
|
26
26
|
# def form_group_builder(method, options, html_options = nil)
|
@@ -91,6 +91,7 @@ module Symphonia
|
|
91
91
|
options[:text]
|
92
92
|
end
|
93
93
|
end
|
94
|
+
|
94
95
|
# def generate_label(id, name, options, custom_label_col, group_layout)
|
95
96
|
# return if options.blank?
|
96
97
|
# # id is the caller's options[:id] at the only place this method is called.
|
@@ -134,4 +135,4 @@ module Symphonia
|
|
134
135
|
end
|
135
136
|
|
136
137
|
end
|
137
|
-
end
|
138
|
+
end
|
@@ -1,23 +1,27 @@
|
|
1
1
|
module Symphonia
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
# Store in-app menu super-global object for all instances/workers
|
3
|
+
class MenuManager
|
4
|
+
class << self
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
def mapper
|
7
|
+
$mapper ||= {}
|
8
|
+
end
|
9
|
+
|
10
|
+
# @param [Symbol] name
|
11
|
+
def menu(name)
|
12
|
+
mapper[name] || {}
|
13
|
+
end
|
9
14
|
|
10
|
-
class << self
|
11
15
|
def map(menu_name)
|
12
16
|
mapper[menu_name] ||= {}
|
13
|
-
|
14
|
-
yield mapper[menu_name]
|
15
|
-
end
|
17
|
+
yield mapper[menu_name]
|
16
18
|
end
|
17
19
|
|
18
20
|
def clear(menu_name)
|
19
|
-
!mapper.delete(menu_name
|
21
|
+
!mapper.delete(menu_name).nil?
|
20
22
|
end
|
23
|
+
|
21
24
|
end
|
25
|
+
|
22
26
|
end
|
23
27
|
end
|
data/lib/symphonia/object.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
class Object
|
2
|
-
# def to_boolean
|
3
|
-
# return true if self.is_a?(TrueClass)
|
4
|
-
|
5
|
-
# respond_to?(:downcase) && ['true', 1, '1', 'yes', 't', 'y'].include?(self.downcase)
|
6
|
-
# end
|
7
|
-
end
|
8
|
-
|
9
1
|
class String
|
2
|
+
|
10
3
|
def to_boolean
|
11
|
-
['true', 1, '1', 'yes', 't', 'y'].include?(
|
4
|
+
['true', 1, '1', 'yes', 't', 'y'].include?(downcase)
|
12
5
|
end
|
6
|
+
|
13
7
|
end
|
14
8
|
|
15
9
|
class NilClass
|
10
|
+
|
16
11
|
def to_boolean
|
17
12
|
false
|
18
13
|
end
|
14
|
+
|
19
15
|
end
|
20
16
|
|
21
17
|
class FalseClass
|
18
|
+
|
22
19
|
def to_boolean
|
23
20
|
false
|
24
21
|
end
|
22
|
+
|
25
23
|
end
|
26
24
|
|
27
25
|
class TrueClass
|
26
|
+
|
28
27
|
def to_boolean
|
29
28
|
true
|
30
29
|
end
|
30
|
+
|
31
31
|
end
|
@@ -1,6 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Symphonia
|
2
|
+
module SpecHelper
|
3
|
+
if Rails.env.test?
|
4
|
+
require File.expand_path('../../../spec/spec_helper', __FILE__)
|
5
|
+
Dir.glob(File.expand_path('../../../spec/{factories,support}/*.rb', __FILE__)).each do |file|
|
6
|
+
require file
|
7
|
+
end
|
8
|
+
end
|
5
9
|
end
|
6
10
|
end
|
data/lib/symphonia/version.rb
CHANGED
data/lib/symphonia.rb
CHANGED
@@ -2,15 +2,18 @@ module Symphonia
|
|
2
2
|
|
3
3
|
include ::ActiveSupport::Configurable
|
4
4
|
|
5
|
-
autoload :BaseController, 'symphonia/base_controller'
|
6
|
-
autoload :BootstrapLinkRender, 'symphonia/bootstrap_link_render'
|
7
|
-
autoload :ControllerExtensions, 'symphonia/controller_extensions'
|
8
|
-
autoload :EntityDecorator, 'symphonia/entity_decorator'
|
9
|
-
autoload :FormBuilder, 'symphonia/form_builder'
|
10
|
-
autoload :
|
11
|
-
autoload :
|
12
|
-
autoload :
|
13
|
-
autoload :
|
5
|
+
# autoload :BaseController, 'symphonia/base_controller'
|
6
|
+
# autoload :BootstrapLinkRender, 'symphonia/bootstrap_link_render'
|
7
|
+
# autoload :ControllerExtensions, 'symphonia/controller_extensions'
|
8
|
+
# autoload :EntityDecorator, 'symphonia/entity_decorator'
|
9
|
+
# autoload :FormBuilder, 'symphonia/form_builder'
|
10
|
+
# autoload :MenuManager, 'symphonia/menu_manager'
|
11
|
+
# autoload :ModelAttributes, 'symphonia/model_attributes'
|
12
|
+
# autoload :ModelFilters, 'symphonia/model_filters'
|
13
|
+
# autoload :Permissions, 'symphonia/permissions'
|
14
|
+
# autoload :Query, 'symphonia/query'
|
15
|
+
# autoload :QueryColumns, 'symphonia/query_columns'
|
16
|
+
# autoload :UserManagement, 'symphonia/user_management'
|
14
17
|
|
15
18
|
module ActionCable
|
16
19
|
|
data/spec/factories/factories.rb
CHANGED
@@ -23,10 +23,6 @@ FactoryBot.define do
|
|
23
23
|
factory :admin_user, traits: [:admin]
|
24
24
|
end
|
25
25
|
|
26
|
-
factory :role, class: 'Symphonia::Role' do
|
27
|
-
sequence(:name) { |n| "#{Faker::Job.title} #{n}" }
|
28
|
-
end
|
29
|
-
|
30
26
|
factory :preference, class: 'Symphonia::Preference' do
|
31
27
|
|
32
28
|
factory :email_preference, class: 'Symphonia::EmailPreference' do
|
data/spec/models/user_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
RSpec.describe Symphonia::User do
|
2
2
|
subject { FactoryBot.create(:user, email: "test@dummy.com") }
|
3
|
+
|
3
4
|
it "#like" do
|
4
|
-
expect(
|
5
|
+
expect(described_class.like(subject.mail)).to be_all described_class
|
5
6
|
end
|
6
7
|
|
7
8
|
it "#to_s" do
|
@@ -22,14 +23,50 @@ RSpec.describe Symphonia::User do
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
|
26
26
|
describe "#required_password" do
|
27
27
|
it "require password for internal" do
|
28
28
|
expect { FactoryBot.create(:user, password: nil) }.to raise_error ActiveRecord::RecordInvalid
|
29
29
|
end
|
30
|
+
|
30
31
|
it "do not require password for external_ids" do
|
31
32
|
expect { FactoryBot.create(:user, password: nil, external_id: "ex1") }.not_to raise_error
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
36
|
+
require "cancan/matchers"
|
37
|
+
|
38
|
+
describe "abilities" do
|
39
|
+
subject(:ability) { Symphonia::UserAbility.new(user) }
|
40
|
+
|
41
|
+
let(:admin) { create(:admin_user) }
|
42
|
+
let(:franta) { create(:user, login: "franta", status: :pending) }
|
43
|
+
let(:user) { nil }
|
44
|
+
|
45
|
+
context "when is an admin" do
|
46
|
+
let(:user) { create(:admin_user) }
|
47
|
+
|
48
|
+
it { is_expected.to be_able_to(:show, admin) }
|
49
|
+
it { is_expected.to be_able_to(:edit, admin) }
|
50
|
+
it { is_expected.to be_able_to(:edit, user) }
|
51
|
+
it { is_expected.not_to be_able_to(:activate, described_class.new(status: :active)) }
|
52
|
+
it { is_expected.to be_able_to(:activate, described_class.new(status: :pending)) }
|
53
|
+
it { is_expected.not_to be_able_to(:activate, described_class.new(status: :archived)) }
|
54
|
+
it { is_expected.to be_able_to(:archive, described_class.new(status: :active)) }
|
55
|
+
it { is_expected.not_to be_able_to(:archive, described_class.new(status: :archived)) }
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
context "regular user" do
|
60
|
+
let(:user) { create(:user) }
|
61
|
+
|
62
|
+
it { is_expected.not_to be_able_to(:show, franta) }
|
63
|
+
it { is_expected.to be_able_to(:show, user) }
|
64
|
+
it { is_expected.to be_able_to(:edit, user) }
|
65
|
+
it { is_expected.not_to be_able_to(:edit, franta) }
|
66
|
+
it { is_expected.to be_able_to(:update, user) }
|
67
|
+
it { is_expected.not_to be_able_to(:destroy, described_class.new) }
|
68
|
+
it { is_expected.not_to be_able_to(:create, described_class.new) }
|
69
|
+
it { is_expected.not_to be_able_to(:update, described_class.new) }
|
70
|
+
end
|
71
|
+
end
|
35
72
|
end
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/stub_users.rb
CHANGED
@@ -6,10 +6,10 @@ def regular_user
|
|
6
6
|
@regular_user ||= FactoryBot.create :user
|
7
7
|
end
|
8
8
|
|
9
|
-
def add_permission *args
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
9
|
+
# def add_permission *args
|
10
|
+
# # @role ||= FactoryBot.build_stubbed :role
|
11
|
+
# # @role.permissions = args
|
12
|
+
# # regular_user.role = @role
|
13
|
+
# # # allow(regular_user).to receive(:role).and_return @role
|
14
|
+
# # @role
|
15
|
+
# end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: symphonia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Pokorny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: api-pagination
|
@@ -38,34 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 6.4.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bootstrap
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 4.6.0
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 4.6.0
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bootstrap-datepicker-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
41
|
- !ruby/object:Gem::Dependency
|
70
42
|
name: bootstrap_form
|
71
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,47 +53,33 @@ dependencies:
|
|
81
53
|
- !ruby/object:Gem::Version
|
82
54
|
version: 4.4.0
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
56
|
+
name: cancancan
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
86
58
|
requirements:
|
87
59
|
- - "~>"
|
88
60
|
- !ruby/object:Gem::Version
|
89
|
-
version: 4
|
61
|
+
version: '3.4'
|
90
62
|
type: :runtime
|
91
63
|
prerelease: false
|
92
64
|
version_requirements: !ruby/object:Gem::Requirement
|
93
65
|
requirements:
|
94
66
|
- - "~>"
|
95
67
|
- !ruby/object:Gem::Version
|
96
|
-
version: 4
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: jquery-rails
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
68
|
+
version: '3.4'
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
70
|
+
name: net-smtp
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
|
-
- - "
|
73
|
+
- - "~>"
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
75
|
+
version: 0.3.1
|
118
76
|
type: :runtime
|
119
77
|
prerelease: false
|
120
78
|
version_requirements: !ruby/object:Gem::Requirement
|
121
79
|
requirements:
|
122
|
-
- - "
|
80
|
+
- - "~>"
|
123
81
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
82
|
+
version: 0.3.1
|
125
83
|
- !ruby/object:Gem::Dependency
|
126
84
|
name: rails
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,16 +98,16 @@ dependencies:
|
|
140
98
|
name: rails-i18n
|
141
99
|
requirement: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
|
-
- - "
|
101
|
+
- - "~>"
|
144
102
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
103
|
+
version: '6.0'
|
146
104
|
type: :runtime
|
147
105
|
prerelease: false
|
148
106
|
version_requirements: !ruby/object:Gem::Requirement
|
149
107
|
requirements:
|
150
|
-
- - "
|
108
|
+
- - "~>"
|
151
109
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
110
|
+
version: '6.0'
|
153
111
|
- !ruby/object:Gem::Dependency
|
154
112
|
name: rake
|
155
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,20 +136,6 @@ dependencies:
|
|
178
136
|
- - ">="
|
179
137
|
- !ruby/object:Gem::Version
|
180
138
|
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: sass-rails
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :runtime
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
139
|
- !ruby/object:Gem::Dependency
|
196
140
|
name: scrypt
|
197
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,20 +192,6 @@ dependencies:
|
|
248
192
|
- - ">="
|
249
193
|
- !ruby/object:Gem::Version
|
250
194
|
version: 0.1.1
|
251
|
-
- !ruby/object:Gem::Dependency
|
252
|
-
name: turbolinks
|
253
|
-
requirement: !ruby/object:Gem::Requirement
|
254
|
-
requirements:
|
255
|
-
- - ">="
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version: '0'
|
258
|
-
type: :runtime
|
259
|
-
prerelease: false
|
260
|
-
version_requirements: !ruby/object:Gem::Requirement
|
261
|
-
requirements:
|
262
|
-
- - ">="
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: '0'
|
265
195
|
- !ruby/object:Gem::Dependency
|
266
196
|
name: will_paginate
|
267
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -318,7 +248,6 @@ files:
|
|
318
248
|
- app/controllers/symphonia/application_controller.rb
|
319
249
|
- app/controllers/symphonia/filters_controller.rb
|
320
250
|
- app/controllers/symphonia/login_controller.rb
|
321
|
-
- app/controllers/symphonia/roles_controller.rb
|
322
251
|
- app/controllers/symphonia/user_sessions_controller.rb
|
323
252
|
- app/controllers/symphonia/users_controller.rb
|
324
253
|
- app/helpers/symphonia/application_helper.rb
|
@@ -330,8 +259,8 @@ files:
|
|
330
259
|
- app/models/symphonia/application_record.rb
|
331
260
|
- app/models/symphonia/email_preference.rb
|
332
261
|
- app/models/symphonia/preference.rb
|
333
|
-
- app/models/symphonia/role.rb
|
334
262
|
- app/models/symphonia/user.rb
|
263
|
+
- app/models/symphonia/user_ability.rb
|
335
264
|
- app/models/symphonia/user_session.rb
|
336
265
|
- app/views/base/_form.html.erb
|
337
266
|
- app/views/base/edit.html.erb
|
@@ -377,11 +306,6 @@ files:
|
|
377
306
|
- app/views/symphonia/notifier/user_change_to_active.text.erb
|
378
307
|
- app/views/symphonia/notifier/user_registered.html.erb
|
379
308
|
- app/views/symphonia/notifier/user_registered.text.erb
|
380
|
-
- app/views/symphonia/roles/_form.html.erb
|
381
|
-
- app/views/symphonia/roles/edit.html.erb
|
382
|
-
- app/views/symphonia/roles/index.html.erb
|
383
|
-
- app/views/symphonia/roles/new.html.erb
|
384
|
-
- app/views/symphonia/roles/show.html.erb
|
385
309
|
- app/views/symphonia/users/_form.html.erb
|
386
310
|
- app/views/symphonia/users/edit.html.erb
|
387
311
|
- app/views/symphonia/users/edit.js.erb
|
@@ -393,16 +317,13 @@ files:
|
|
393
317
|
- config/locales/en.yml
|
394
318
|
- config/routes.rb
|
395
319
|
- db/migrate/20130714140500_create_users.rb
|
396
|
-
- db/migrate/20130714140501_create_roles.rb
|
397
320
|
- db/migrate/20130714140502_create_preferences.rb
|
398
321
|
- db/migrate/20190706130409_add_external_id_to_users.rb
|
399
322
|
- db/migrate/20200428180001_add_uuid_to_users.rb
|
400
323
|
- db/migrate/20200428180008_add_avatar_to_users.rb
|
401
|
-
- db/migrate/20210509141420_roles_change_permissions_to_json.rb
|
402
|
-
- db/migrate/20210509180525_roles_change_permissions_to_native_json.rb
|
403
324
|
- db/seeds.rb
|
404
325
|
- lib/generators/symphonia/entity_controller/entity_controller_generator.rb
|
405
|
-
- lib/generators/symphonia/entity_controller/templates/controller.rb
|
326
|
+
- lib/generators/symphonia/entity_controller/templates/controller.rb.tt
|
406
327
|
- lib/generators/symphonia/query/query_generator.rb
|
407
328
|
- lib/generators/symphonia/setup/setup_generator.rb
|
408
329
|
- lib/generators/symphonia/setup/templates/Gemfile
|
@@ -434,7 +355,6 @@ files:
|
|
434
355
|
- lib/symphonia/model_filters/select_filter.rb
|
435
356
|
- lib/symphonia/model_filters/string_filter.rb
|
436
357
|
- lib/symphonia/object.rb
|
437
|
-
- lib/symphonia/permissions.rb
|
438
358
|
- lib/symphonia/query.rb
|
439
359
|
- lib/symphonia/query_columns.rb
|
440
360
|
- lib/symphonia/query_columns/attribute_column.rb
|
@@ -446,7 +366,6 @@ files:
|
|
446
366
|
- spec/controllers/base_controller_spec.rb
|
447
367
|
- spec/controllers/filters_controller_spec.rb
|
448
368
|
- spec/controllers/login_controller_spec.rb
|
449
|
-
- spec/controllers/roles_controller_spec.rb
|
450
369
|
- spec/controllers/users_controller_spec.rb
|
451
370
|
- spec/factories/factories.rb
|
452
371
|
- spec/helpers/symphonia/application_helper_spec.rb
|
@@ -458,12 +377,10 @@ files:
|
|
458
377
|
- spec/models/query/attribute_spec.rb
|
459
378
|
- spec/models/query/filters_spec.rb
|
460
379
|
- spec/models/query/symphonia_query_spec.rb
|
461
|
-
- spec/models/role_spec.rb
|
462
380
|
- spec/models/user_spec.rb
|
463
381
|
- spec/rails_helper.rb
|
464
382
|
- spec/requests/accounts_spec.rb
|
465
383
|
- spec/requests/login_spec.rb
|
466
|
-
- spec/requests/roles_spec.rb
|
467
384
|
- spec/requests/users_spec.rb
|
468
385
|
- spec/spec_helper.rb
|
469
386
|
- spec/support/query.rb
|
@@ -477,7 +394,8 @@ files:
|
|
477
394
|
homepage: https://github.com/luk4s
|
478
395
|
licenses:
|
479
396
|
- GPL-3.0
|
480
|
-
metadata:
|
397
|
+
metadata:
|
398
|
+
rubygems_mfa_required: 'true'
|
481
399
|
post_install_message: 'run: rails g symphonia:setup'
|
482
400
|
rdoc_options: []
|
483
401
|
require_paths:
|
@@ -493,41 +411,38 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
493
411
|
- !ruby/object:Gem::Version
|
494
412
|
version: '0'
|
495
413
|
requirements: []
|
496
|
-
rubygems_version: 3.3.
|
414
|
+
rubygems_version: 3.3.7
|
497
415
|
signing_key:
|
498
416
|
specification_version: 4
|
499
417
|
summary: My administration
|
500
418
|
test_files:
|
501
|
-
- spec/
|
502
|
-
- spec/
|
419
|
+
- spec/controllers/account_controller_spec.rb
|
420
|
+
- spec/controllers/admin_controller_spec.rb
|
421
|
+
- spec/controllers/base_controller_spec.rb
|
422
|
+
- spec/controllers/filters_controller_spec.rb
|
423
|
+
- spec/controllers/login_controller_spec.rb
|
424
|
+
- spec/controllers/users_controller_spec.rb
|
425
|
+
- spec/factories/factories.rb
|
426
|
+
- spec/helpers/symphonia/application_helper_spec.rb
|
427
|
+
- spec/helpers/symphonia/entity_decorator_spec.rb
|
428
|
+
- spec/helpers/symphonia/renderer_helper_spec.rb
|
429
|
+
- spec/libs/some_lib_spec.rb
|
503
430
|
- spec/mailers/previews/symphonia/notifier_preview.rb
|
504
|
-
- spec/
|
431
|
+
- spec/mailers/symphonia/notifier_spec.rb
|
505
432
|
- spec/models/query/attribute_spec.rb
|
506
|
-
- spec/models/query/symphonia_query_spec.rb
|
507
433
|
- spec/models/query/filters_spec.rb
|
434
|
+
- spec/models/query/symphonia_query_spec.rb
|
508
435
|
- spec/models/user_spec.rb
|
509
|
-
- spec/
|
510
|
-
- spec/requests/roles_spec.rb
|
511
|
-
- spec/requests/login_spec.rb
|
436
|
+
- spec/rails_helper.rb
|
512
437
|
- spec/requests/accounts_spec.rb
|
438
|
+
- spec/requests/login_spec.rb
|
513
439
|
- spec/requests/users_spec.rb
|
514
|
-
- spec/
|
515
|
-
- spec/support/
|
440
|
+
- spec/spec_helper.rb
|
441
|
+
- spec/support/query.rb
|
516
442
|
- spec/support/shared.rb
|
517
|
-
- spec/support/wait_for_ajax.rb
|
518
443
|
- spec/support/shared_controllers.rb
|
519
444
|
- spec/support/shared_requests.rb
|
520
|
-
- spec/support/
|
521
|
-
- spec/
|
522
|
-
- spec/
|
523
|
-
- spec/controllers/login_controller_spec.rb
|
524
|
-
- spec/controllers/users_controller_spec.rb
|
525
|
-
- spec/controllers/filters_controller_spec.rb
|
526
|
-
- spec/controllers/admin_controller_spec.rb
|
527
|
-
- spec/controllers/account_controller_spec.rb
|
528
|
-
- spec/controllers/base_controller_spec.rb
|
445
|
+
- spec/support/stub_users.rb
|
446
|
+
- spec/support/wait_for_ajax.rb
|
447
|
+
- spec/version_spec.rb
|
529
448
|
- spec/views/filters/options.html.erb_spec.rb
|
530
|
-
- spec/rails_helper.rb
|
531
|
-
- spec/helpers/symphonia/application_helper_spec.rb
|
532
|
-
- spec/helpers/symphonia/renderer_helper_spec.rb
|
533
|
-
- spec/helpers/symphonia/entity_decorator_spec.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Symphonia
|
2
|
-
class RolesController < ApplicationController
|
3
|
-
|
4
|
-
include BaseController
|
5
|
-
|
6
|
-
def model
|
7
|
-
Role
|
8
|
-
end
|
9
|
-
|
10
|
-
def safe_attributes
|
11
|
-
[:name, :description, permissions: []]
|
12
|
-
end
|
13
|
-
# helper Symphonia::RendererHelper
|
14
|
-
#
|
15
|
-
# before_action :authorize
|
16
|
-
before_action :load_permissions, only: [:new, :edit, :update, :create]
|
17
|
-
|
18
|
-
def create
|
19
|
-
@entity = @role = Role.new(entity_params)
|
20
|
-
@role.permissions = Symphonia::Permissions.find_all(params[:permissions]).map(&:name)
|
21
|
-
super
|
22
|
-
end
|
23
|
-
|
24
|
-
def update
|
25
|
-
@entity = @role = Role.find(params[:id])
|
26
|
-
@role.permissions = Symphonia::Permissions.find_all(params[:permissions]).map(&:name)
|
27
|
-
super
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def load_permissions
|
34
|
-
@permissions = Symphonia::Permissions.all
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|