symphonia 3.2.2 → 3.3.3
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/CHANGELOG.md +99 -0
- data/app/controllers/symphonia/accounts_controller.rb +14 -13
- data/app/controllers/symphonia/roles_controller.rb +3 -64
- data/app/controllers/symphonia/users_controller.rb +0 -5
- data/app/helpers/symphonia/application_helper.rb +18 -62
- data/app/mailers/symphonia/notifier.rb +2 -1
- data/app/models/symphonia/user.rb +1 -29
- data/app/views/layouts/symphonia/application.pdf.erb +0 -1
- data/app/views/symphonia/accounts/_form.html.erb +5 -0
- data/app/views/symphonia/accounts/lost_password.html.erb +1 -1
- data/app/views/symphonia/accounts/reset_password.html.erb +2 -2
- data/app/views/symphonia/login/_form.html.erb +0 -2
- data/app/views/symphonia/notifier/reset_password_user.html.erb +1 -2
- data/app/views/symphonia/notifier/reset_password_user.text.erb +1 -1
- data/config/locales/cs.yml +2 -0
- data/config/routes.rb +1 -0
- data/lib/symphonia.rb +0 -1
- data/lib/symphonia/action_cable/connection.rb +1 -1
- data/lib/symphonia/admin_constraint.rb +2 -1
- data/lib/symphonia/base_controller.rb +0 -1
- data/lib/symphonia/engine.rb +5 -5
- data/lib/symphonia/user_management.rb +14 -4
- data/lib/symphonia/version.rb +1 -1
- data/spec/controllers/account_controller_spec.rb +1 -1
- data/spec/factories/factories.rb +2 -15
- data/spec/mailers/previews/symphonia/notifier_preview.rb +1 -2
- data/spec/mailers/symphonia/notifier_spec.rb +1 -1
- data/spec/requests/accounts_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -2
- metadata +42 -92
- data/app/controllers/concerns/symphonia/swagger/base_controller.rb +0 -134
- data/app/controllers/symphonia/api_controller.rb +0 -78
- data/app/controllers/symphonia/attachments_controller.rb +0 -37
- data/app/controllers/symphonia/images_controller.rb +0 -16
- data/app/models/symphonia/attachment.rb +0 -16
- data/app/models/symphonia/common_file.rb +0 -9
- data/app/models/symphonia/image.rb +0 -46
- data/app/models/symphonia/swagger/error_model.rb +0 -24
- data/app/models/symphonia/swagger/parameters.rb +0 -21
- data/app/models/symphonia/swagger/responses.rb +0 -27
- data/lib/symphonia/attachable.rb +0 -35
- data/spec/controllers/api_controller_spec.rb +0 -9
- data/spec/controllers/images_controller_spec.rb +0 -5
- data/spec/models/attachment_spec.rb +0 -22
- data/spec/requests/attachments_controller_spec.rb +0 -23
- data/spec/support/common_file.txt +0 -2
- data/spec/support/symphonia.jpg +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a94d9e18f62261a832ffb94a8392973d1bc7ecad3c147c9a67bf524fde81d061
|
|
4
|
+
data.tar.gz: 52ab54d867d94ba7029011f416fa854eb34984b33feed8447c920adfb647ca3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98facf3061caf96e02c909469c6812eb07b77f5a8695eee924713e00ab052332949e4d26c9e5cbfea557f2f5c86c441f1568807df52cb5373ebda6d6b3094fe5
|
|
7
|
+
data.tar.gz: fd12db3ba010a729958fa5c11921528db0b36b2c5e614baf359eab19e5472f46c455fed36aeba2c643b43028a7866ca7a4e351666e39536d162706ac26bdf9b4
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
## [3.3.3] - 2020-10
|
|
9
|
+
### Changed
|
|
10
|
+
- prefill login from email
|
|
11
|
+
- allow login edit for legacy accounts
|
|
12
|
+
## [3.3.2] - 2020-10-17
|
|
13
|
+
### Added
|
|
14
|
+
- `render_super` for templates
|
|
15
|
+
### Changed
|
|
16
|
+
- lost password check
|
|
17
|
+
## [3.3.1] - 2020-09-28
|
|
18
|
+
### Removed
|
|
19
|
+
- openapi (it seems to be unnecessarily)
|
|
20
|
+
- paperclip support
|
|
21
|
+
- the_sortable_tree
|
|
22
|
+
### Changed
|
|
23
|
+
- upgrade authlogic to 6.2.0
|
|
24
|
+
## [3.2.4] - 2020-05-10
|
|
25
|
+
### Added
|
|
26
|
+
- sidekiq-cron gem
|
|
27
|
+
## [3.2.3] - 2020-05-07
|
|
28
|
+
### Fixed
|
|
29
|
+
- find user by token from session
|
|
30
|
+
## [3.2.2] - 2020-05-05
|
|
31
|
+
### Changed
|
|
32
|
+
- user/account form layout
|
|
33
|
+
- Sidekiq v6
|
|
34
|
+
### Fixed
|
|
35
|
+
- UsersController#update Role should be sorted
|
|
36
|
+
## [3.2.1] - 2020-05-01
|
|
37
|
+
### Added
|
|
38
|
+
- avatar_url to users
|
|
39
|
+
- uuid to users
|
|
40
|
+
- openapi support
|
|
41
|
+
### Changed
|
|
42
|
+
- improve setup generator
|
|
43
|
+
- anonymous user have no "enforced" language
|
|
44
|
+
### Fixed
|
|
45
|
+
- update .rubocop
|
|
46
|
+
- bootstrap_form update to 4.4.0
|
|
47
|
+
- show time in localtime
|
|
48
|
+
### Removed
|
|
49
|
+
- ckeditor-jquery
|
|
50
|
+
## [3.1.5] - 2020-01-20
|
|
51
|
+
### Changed
|
|
52
|
+
- improve split name (Symphonia::UserManagement#name=)
|
|
53
|
+
## [3.1.4] - 2020-01-17
|
|
54
|
+
### Changed
|
|
55
|
+
- improve role form
|
|
56
|
+
## [3.1.3] - 2019-12-21
|
|
57
|
+
### Added
|
|
58
|
+
- bootstrap_modal_helper extended by `link_to_modal` feature
|
|
59
|
+
### Changed
|
|
60
|
+
- helper Symphonia::BootstrapModalHelper in BaseController
|
|
61
|
+
- new argument options in `icon` method (pass into `fa_icon`)
|
|
62
|
+
## [3.1.2] - 2019-12-07
|
|
63
|
+
### Added
|
|
64
|
+
- skip permission check in link_to_new_entity method
|
|
65
|
+
### Fixed
|
|
66
|
+
- login form additional buttons
|
|
67
|
+
- lost_password form & mail
|
|
68
|
+
- reset_password form & mail
|
|
69
|
+
## [3.1.1] - 2019-12-07
|
|
70
|
+
### Changed
|
|
71
|
+
- accounts registration validation
|
|
72
|
+
- update static 500.html
|
|
73
|
+
## [3.1.0] - 2019-12-07
|
|
74
|
+
### Added
|
|
75
|
+
- BaseController for simplier create CRUD inheritance
|
|
76
|
+
- base views (new, form, edit, show and index)
|
|
77
|
+
- general EntityDecorator
|
|
78
|
+
- input field in model Attribute
|
|
79
|
+
- TextAttribute format
|
|
80
|
+
### Changed
|
|
81
|
+
- registration form refactored
|
|
82
|
+
- update dummy to Rails 6
|
|
83
|
+
### Removed
|
|
84
|
+
- wicked_pdf dependency
|
|
85
|
+
## [3.0.3] - 2019-10-06
|
|
86
|
+
### Changed
|
|
87
|
+
- rubocop.yml
|
|
88
|
+
- use real user in tests instead a dummy object
|
|
89
|
+
## [3.0.1] - 2019-07-08
|
|
90
|
+
### Changed
|
|
91
|
+
- do not require password for SSO users
|
|
92
|
+
- hide password field from form of SSO users
|
|
93
|
+
## [3.0.0] - 2019-07-06
|
|
94
|
+
### Added
|
|
95
|
+
- external_id on user
|
|
96
|
+
### Changed
|
|
97
|
+
- users/show only for logged users
|
|
98
|
+
- upgrade to authlogic 5
|
|
99
|
+
- minor improvements
|
|
@@ -100,38 +100,39 @@ module Symphonia
|
|
|
100
100
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
# @!group Reset lost password
|
|
104
|
+
|
|
103
105
|
def reset_password
|
|
104
106
|
@user = find_account_by_token(params.require(:id))
|
|
105
107
|
return render_404 if @user.nil?
|
|
106
108
|
|
|
107
109
|
if params[:password] # && params[:password_confirmation]
|
|
108
110
|
@user.password = params[:password]
|
|
109
|
-
# @user.password_confirmation = params[:password_confirmation]
|
|
110
111
|
end
|
|
111
112
|
|
|
112
113
|
if @user.changed? && @user.save
|
|
113
|
-
|
|
114
|
+
logger.info "#{@user.id} has changed password"
|
|
115
|
+
return redirect_to(login_path, notice: t(:text_password_reset_success))
|
|
114
116
|
end
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
def lost_password
|
|
118
120
|
@user = find_account_by_mail(params[:email]) if params[:email]
|
|
119
|
-
if @user
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
if @user&.active?
|
|
122
|
+
@user.reset_perishable_token!
|
|
123
|
+
activation_url = url_for(action: "reset_password", id: @user.perishable_token, only_path: false)
|
|
124
|
+
Notifier.reset_password_user(@user, activation_url).deliver_later
|
|
125
|
+
end
|
|
126
|
+
respond_to do |format|
|
|
127
|
+
format.html do
|
|
123
128
|
redirect_to login_path, notice: t(:text_reset_password_resend)
|
|
124
|
-
else
|
|
125
|
-
redirect_to login_path, flash: { error: t("authlogic.error_messages.not_active") }
|
|
126
|
-
end
|
|
127
|
-
else
|
|
128
|
-
respond_to do |format|
|
|
129
|
-
format.html
|
|
130
|
-
format.js
|
|
131
129
|
end
|
|
130
|
+
format.js
|
|
132
131
|
end
|
|
133
132
|
end
|
|
134
133
|
|
|
134
|
+
# @!endgroup
|
|
135
|
+
|
|
135
136
|
private
|
|
136
137
|
|
|
137
138
|
def prepare_user
|
|
@@ -14,87 +14,26 @@ module Symphonia
|
|
|
14
14
|
#
|
|
15
15
|
# before_action :authorize
|
|
16
16
|
before_action :load_permissions, only: [:new, :edit, :update, :create]
|
|
17
|
-
#
|
|
18
|
-
# #layout 'admin'
|
|
19
|
-
#
|
|
20
|
-
# def index
|
|
21
|
-
# @query = Symphonia::Role.query.new(self)
|
|
22
|
-
# @entities = @query.entities
|
|
23
|
-
# respond_to do |format|
|
|
24
|
-
# format.html do
|
|
25
|
-
# @entities = @entities.page(params[:page])
|
|
26
|
-
# render layout: !request.xhr?
|
|
27
|
-
# end
|
|
28
|
-
# format.xml { render xml: @entities.all }
|
|
29
|
-
# format.json { render json: @entities.all }
|
|
30
|
-
# end
|
|
31
|
-
# end
|
|
32
|
-
#
|
|
33
|
-
# def show
|
|
34
|
-
# @role = Role.find(params[:id])
|
|
35
|
-
# respond_to do |format|
|
|
36
|
-
# format.html
|
|
37
|
-
# format.json { render json: @role }
|
|
38
|
-
# end
|
|
39
|
-
# end
|
|
40
|
-
#
|
|
41
|
-
# def new
|
|
42
|
-
# @role = Role.new
|
|
43
|
-
# end
|
|
44
|
-
#
|
|
45
|
-
# def edit
|
|
46
|
-
# @role = Role.find(params[:id])
|
|
47
|
-
# end
|
|
48
17
|
|
|
49
18
|
def create
|
|
50
19
|
@entity = @role = Role.new(entity_params)
|
|
51
20
|
@role.permissions = Symphonia::Permissions.find_all(params[:permissions]).map(&:name)
|
|
52
21
|
super
|
|
53
|
-
# respond_to do |format|
|
|
54
|
-
# if @role.save
|
|
55
|
-
# format.html { redirect_to((params[:continue] ? new_role_path : roles_path), notice: t(:text_created)) }
|
|
56
|
-
# format.json { render(json: @role, status: :created, location: @role) }
|
|
57
|
-
# else
|
|
58
|
-
# format.html { render(action: 'new') }
|
|
59
|
-
# format.json { render(json: @role.errors, status: :unprocessable_entity) }
|
|
60
|
-
# end
|
|
61
|
-
# end
|
|
62
22
|
end
|
|
63
23
|
|
|
64
24
|
def update
|
|
65
25
|
@entity = @role = Role.find(params[:id])
|
|
66
26
|
@role.permissions = Symphonia::Permissions.find_all(params[:permissions]).map(&:name)
|
|
67
27
|
super
|
|
68
|
-
|
|
69
|
-
# if @role.update_attributes(role_params)
|
|
70
|
-
# format.html { redirect_to(edit_role_path(@role), notice: t(:text_updated)) }
|
|
71
|
-
# format.json { head(:no_content) }
|
|
72
|
-
# else
|
|
73
|
-
# format.html { render(action: 'edit') }
|
|
74
|
-
# format.json { render(json: @role.errors, status: :unprocessable_entity) }
|
|
75
|
-
# end
|
|
76
|
-
# end
|
|
28
|
+
|
|
77
29
|
end
|
|
78
30
|
|
|
79
|
-
# def destroy
|
|
80
|
-
# @role = Role.find(params[:id])
|
|
81
|
-
# @role.destroy
|
|
82
|
-
# respond_to do |format|
|
|
83
|
-
# format.html { redirect_to(roles_url, notice: t(:text_destroyed)) }
|
|
84
|
-
# format.json { head :no_content }
|
|
85
|
-
# format.js { render js: "Symphonia.filters.removeRow('#{view_context.dom_id(@role)}')"}
|
|
86
|
-
# end
|
|
87
|
-
# end
|
|
88
|
-
#
|
|
89
31
|
private
|
|
90
|
-
|
|
32
|
+
|
|
91
33
|
def load_permissions
|
|
92
34
|
@permissions = Symphonia::Permissions.all
|
|
93
35
|
end
|
|
94
|
-
|
|
95
|
-
# def role_params
|
|
96
|
-
# params.require(:role).permit(:name, :description, permissions: [])
|
|
97
|
-
# end
|
|
36
|
+
|
|
98
37
|
end
|
|
99
38
|
|
|
100
39
|
end
|
|
@@ -38,7 +38,7 @@ module Symphonia
|
|
|
38
38
|
end
|
|
39
39
|
options[:container_class] ||= 'mr-auto'
|
|
40
40
|
|
|
41
|
-
return content_tag(:ul, s.html_safe, itemscope: '', itemtype: 'http://
|
|
41
|
+
return content_tag(:ul, s.html_safe, itemscope: '', itemtype: 'http://schema.org/BreadcrumbList', class: "navbar-nav #{options[:container_class]}", id: menu.to_s)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def render_menu_node(menu, item, options = {})
|
|
@@ -242,6 +242,23 @@ module Symphonia
|
|
|
242
242
|
fa_icon(fa, (text && { text: content_tag(:span, text, class: 'd-none d-sm-inline') } || {}).merge(options))
|
|
243
243
|
end
|
|
244
244
|
|
|
245
|
+
# Render original template from engine
|
|
246
|
+
# Useful for override part of engine view
|
|
247
|
+
#
|
|
248
|
+
# @example render_super "login/new"
|
|
249
|
+
# @param [String] template_name
|
|
250
|
+
# @param [Class<Symphonia::Engine>] engine
|
|
251
|
+
# @param [String] format
|
|
252
|
+
def render_super(template_name, engine: Symphonia::Engine, format: "html")
|
|
253
|
+
resolver = lookup_context.view_paths.paths.find do |resolver|
|
|
254
|
+
resolver.path == engine.root.join("app", "views").to_s
|
|
255
|
+
end
|
|
256
|
+
template = resolver.find_all(template_name, engine.engine_name, false, { locale: ["."], formats: [format], variants: [], handlers: [:erb] }, nil, {}).first
|
|
257
|
+
return "" unless template
|
|
258
|
+
|
|
259
|
+
render template: template
|
|
260
|
+
end
|
|
261
|
+
|
|
245
262
|
def render_symphonia_dialog(*args, &block)
|
|
246
263
|
ActiveSupport::Deprecation.warn "Use `render_modal` instead"
|
|
247
264
|
options = args.extract_options!
|
|
@@ -356,67 +373,6 @@ module Symphonia
|
|
|
356
373
|
end
|
|
357
374
|
|
|
358
375
|
end
|
|
359
|
-
|
|
360
|
-
# Example of use
|
|
361
|
-
# <%=
|
|
362
|
-
# table_header_tag_for(User) do |t|
|
|
363
|
-
# t.th :login
|
|
364
|
-
# t.th :email
|
|
365
|
-
# end
|
|
366
|
-
# %>
|
|
367
|
-
# options:
|
|
368
|
-
# => column : DB full name of column
|
|
369
|
-
#
|
|
370
|
-
# def table_header_tag_for(model, &block)
|
|
371
|
-
# tags = TableHeaderTag.new(model, self)
|
|
372
|
-
# yield tags
|
|
373
|
-
# tags.to_html
|
|
374
|
-
# end
|
|
375
|
-
#
|
|
376
|
-
# class TableHeaderTag
|
|
377
|
-
#
|
|
378
|
-
# attr_reader :view, :model
|
|
379
|
-
#
|
|
380
|
-
# def initialize(model, view)
|
|
381
|
-
# @model = model
|
|
382
|
-
# @tags = Array.new
|
|
383
|
-
# @view = view
|
|
384
|
-
# end
|
|
385
|
-
#
|
|
386
|
-
# def th(*args)
|
|
387
|
-
# options = args.extract_options!
|
|
388
|
-
# attribute = args.first
|
|
389
|
-
# label = args[1]
|
|
390
|
-
# raise ArgumentError if attribute.nil?
|
|
391
|
-
#
|
|
392
|
-
# sort_options = options.delete(:sort_options) || {}
|
|
393
|
-
# html_options = options.delete(:html_options) || {}
|
|
394
|
-
#
|
|
395
|
-
# label ||= @model.send(:human_attribute_name, attribute, options[:i18n] || {})
|
|
396
|
-
# @tags << @view.content_tag(:th, html_options) do
|
|
397
|
-
# if options[:sort] === false
|
|
398
|
-
# label
|
|
399
|
-
# else
|
|
400
|
-
# sort_options[:column] ||= options.delete(:column)
|
|
401
|
-
# sort_options[:column] ||= "#{@model.send(:table_name)}.#{attribute}"
|
|
402
|
-
# # @view.sortable_column(label, sort_options) # TODO: Rails 5 error
|
|
403
|
-
# label
|
|
404
|
-
# end
|
|
405
|
-
# end
|
|
406
|
-
#
|
|
407
|
-
# end
|
|
408
|
-
#
|
|
409
|
-
# def to_html
|
|
410
|
-
# @tags.join("\n").html_safe
|
|
411
|
-
# end
|
|
412
|
-
#
|
|
413
|
-
# end
|
|
414
|
-
|
|
415
|
-
# def render_share_buttons(url, name, options = {})
|
|
416
|
-
# options[:icon_css] ||= ''
|
|
417
|
-
# render(partial: 'common/share_links', locals: options.merge({ url: url, name: name }))
|
|
418
|
-
# end
|
|
419
376
|
end
|
|
420
377
|
end
|
|
421
378
|
|
|
422
|
-
#ApplicationHelper.send :include, Symphonia::ApplicationHelperExtension
|
|
@@ -21,8 +21,9 @@ module Symphonia
|
|
|
21
21
|
mail({ to: @user.mail, subject: 'Váš účet je aktivován' })
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def reset_password_user(user)
|
|
24
|
+
def reset_password_user(user, url)
|
|
25
25
|
@user = user
|
|
26
|
+
@url = url
|
|
26
27
|
mail({ to: @user.mail, subject: t(:subject_reset_password_mail) })
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -19,8 +19,8 @@ module Symphonia
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
acts_as_authentic do |config|
|
|
22
|
+
config.crypto_provider = ::Authlogic::CryptoProviders::SCrypt
|
|
22
23
|
end
|
|
23
|
-
validates :email, uniqueness: { case_sensitive: false }
|
|
24
24
|
validates :password,
|
|
25
25
|
confirmation: { if: :require_password? },
|
|
26
26
|
length: {
|
|
@@ -30,31 +30,6 @@ module Symphonia
|
|
|
30
30
|
|
|
31
31
|
include UserManagement
|
|
32
32
|
|
|
33
|
-
include ::Swagger::Blocks
|
|
34
|
-
swagger_component do
|
|
35
|
-
schema :User do
|
|
36
|
-
key :required, %w[id login email]
|
|
37
|
-
property :id do
|
|
38
|
-
key :type, "integer"
|
|
39
|
-
key :format, "int64"
|
|
40
|
-
end
|
|
41
|
-
property :fist_name do
|
|
42
|
-
key :type, "string"
|
|
43
|
-
end
|
|
44
|
-
property :last_name do
|
|
45
|
-
key :type, "string"
|
|
46
|
-
end
|
|
47
|
-
property :email do
|
|
48
|
-
key :type, "string"
|
|
49
|
-
key :format, "email"
|
|
50
|
-
end
|
|
51
|
-
property :status do
|
|
52
|
-
key :type, "string"
|
|
53
|
-
key :enum, Symphonia::User.statuses.keys
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
33
|
attr_writer :password_confirmation
|
|
59
34
|
|
|
60
35
|
has_and_belongs_to_many :preferences, foreign_key: 'user_id'
|
|
@@ -75,9 +50,6 @@ module Symphonia
|
|
|
75
50
|
before_save do |model|
|
|
76
51
|
Rails.cache.delete_matched('user_allowed_to*') if model.role_id_changed?
|
|
77
52
|
end
|
|
78
|
-
before_validation do |model|
|
|
79
|
-
model.login ||= model.email
|
|
80
|
-
end
|
|
81
53
|
|
|
82
54
|
def allowed_to?(action)
|
|
83
55
|
return true if admin?
|