symphonia 3.1.5 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -8
- data/CHANGELOG.md +88 -0
- data/app/assets/javascripts/symphonia/symphonia_ckeditor.js +0 -1
- data/app/controllers/symphonia/accounts_controller.rb +0 -1
- data/app/controllers/symphonia/roles_controller.rb +3 -64
- data/app/controllers/symphonia/user_sessions_controller.rb +1 -1
- data/app/controllers/symphonia/users_controller.rb +1 -34
- data/app/helpers/symphonia/application_helper.rb +1 -1
- data/app/helpers/symphonia/form_helper.rb +0 -2
- data/app/models/symphonia/user.rb +2 -25
- data/app/views/symphonia/accounts/_form.html.erb +19 -8
- data/app/views/symphonia/accounts/edit.html.erb +2 -2
- data/app/views/symphonia/users/_form.html.erb +7 -7
- data/app/views/symphonia/users/edit.html.erb +17 -15
- data/app/views/symphonia/users/new.html.erb +2 -2
- data/config/routes.rb +1 -0
- data/db/migrate/20200428180001_add_uuid_to_users.rb +6 -0
- data/db/migrate/20200428180008_add_avatar_to_users.rb +5 -0
- data/db/seeds.rb +2 -1
- data/lib/generators/symphonia/setup/setup_generator.rb +2 -1
- data/lib/generators/symphonia/setup/templates/app/assets/javascripts/application.js.tt +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 +7 -0
- data/lib/symphonia/engine.rb +9 -8
- data/lib/symphonia/model_attributes/attribute.rb +1 -1
- data/lib/symphonia/version.rb +1 -1
- data/spec/controllers/base_controller_spec.rb +37 -2
- data/spec/factories/factories.rb +11 -12
- data/spec/spec_helper.rb +2 -2
- metadata +42 -69
- data/app/controllers/symphonia/api_controller.rb +0 -64
- 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 -19
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a195060e6fa12677b383245afdaa0d7cefb75e463031b21aca473c2b2eabc6d
|
4
|
+
data.tar.gz: ca98109a38542883af2f24a0eadbfb9363861b09fa98a146437c405ba4872338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5a099d7ab9e70cbe8526a9e2a765220c3d137472a08dfcbedebaef43745c96f78dc90512335adf4da26b1e910052231c9fa49fcff11dc8eeda122bb8ef1554
|
7
|
+
data.tar.gz: 6f300e80b0373f6f19298f6a1c33a4e059be86e7f1110eeebe74f32e90a04960a3ab2edbadf2d5d54624fbc3b4b38c6734b02abd7f6e857d06c11c6648a49b03
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
#require:
|
2
|
-
# - rubocop-rails
|
3
|
-
All:
|
4
|
-
Rails: true
|
5
1
|
AllCops:
|
6
2
|
TargetRubyVersion: 2.5
|
7
3
|
|
@@ -16,13 +12,13 @@ Metrics/AbcSize:
|
|
16
12
|
Enabled: false
|
17
13
|
Metrics/BlockLength:
|
18
14
|
Enabled: false
|
19
|
-
Metrics/LineLength:
|
20
|
-
Enabled: false
|
15
|
+
#Metrics/LineLength:
|
16
|
+
# Enabled: false
|
21
17
|
Metrics/MethodLength:
|
22
18
|
Enabled: false
|
23
19
|
|
24
|
-
Style/BracesAroundHashParameters:
|
25
|
-
EnforcedStyle: context_dependent
|
20
|
+
#Style/BracesAroundHashParameters:
|
21
|
+
# EnforcedStyle: context_dependent
|
26
22
|
Style/Documentation:
|
27
23
|
Enabled: false
|
28
24
|
Style/MutableConstant:
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,88 @@
|
|
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
|
+
### Removed
|
9
|
+
- openapi (it seems to be uneccessary)
|
10
|
+
- paperclip support
|
11
|
+
### Changed
|
12
|
+
- upgrade authlogic to 6.1.0
|
13
|
+
## [3.2.4] - 2020-05-10
|
14
|
+
### Added
|
15
|
+
- sidekiq-cron gem
|
16
|
+
## [3.2.3] - 2020-05-07
|
17
|
+
### Fixed
|
18
|
+
- find user by token from session
|
19
|
+
## [3.2.2] - 2020-05-05
|
20
|
+
### Changed
|
21
|
+
- user/account form layout
|
22
|
+
- Sidekiq v6
|
23
|
+
### Fixed
|
24
|
+
- UsersController#update Role should be sorted
|
25
|
+
## [3.2.1] - 2020-05-01
|
26
|
+
### Added
|
27
|
+
- avatar_url to users
|
28
|
+
- uuid to users
|
29
|
+
- openapi support
|
30
|
+
### Changed
|
31
|
+
- improve setup generator
|
32
|
+
- anonymous user have no "enforced" language
|
33
|
+
### Fixed
|
34
|
+
- update .rubocop
|
35
|
+
- bootstrap_form update to 4.4.0
|
36
|
+
- show time in localtime
|
37
|
+
### Removed
|
38
|
+
- ckeditor-jquery
|
39
|
+
## [3.1.5] - 2020-01-20
|
40
|
+
### Changed
|
41
|
+
- improve split name (Symphonia::UserManagement#name=)
|
42
|
+
## [3.1.4] - 2020-01-17
|
43
|
+
### Changed
|
44
|
+
- improve role form
|
45
|
+
## [3.1.3] - 2019-12-21
|
46
|
+
### Added
|
47
|
+
- bootstrap_modal_helper extended by `link_to_modal` feature
|
48
|
+
### Changed
|
49
|
+
- helper Symphonia::BootstrapModalHelper in BaseController
|
50
|
+
- new argument options in `icon` method (pass into `fa_icon`)
|
51
|
+
## [3.1.2] - 2019-12-07
|
52
|
+
### Added
|
53
|
+
- skip permission check in link_to_new_entity method
|
54
|
+
### Fixed
|
55
|
+
- login form additional buttons
|
56
|
+
- lost_password form & mail
|
57
|
+
- reset_password form & mail
|
58
|
+
## [3.1.1] - 2019-12-07
|
59
|
+
### Changed
|
60
|
+
- accounts registration validation
|
61
|
+
- update static 500.html
|
62
|
+
## [3.1.0] - 2019-12-07
|
63
|
+
### Added
|
64
|
+
- BaseController for simplier create CRUD inheritance
|
65
|
+
- base views (new, form, edit, show and index)
|
66
|
+
- general EntityDecorator
|
67
|
+
- input field in model Attribute
|
68
|
+
- TextAttribute format
|
69
|
+
### Changed
|
70
|
+
- registration form refactored
|
71
|
+
- update dummy to Rails 6
|
72
|
+
### Removed
|
73
|
+
- wicked_pdf dependency
|
74
|
+
## [3.0.3] - 2019-10-06
|
75
|
+
### Changed
|
76
|
+
- rubocop.yml
|
77
|
+
- use real user in tests instead a dummy object
|
78
|
+
## [3.0.1] - 2019-07-08
|
79
|
+
### Changed
|
80
|
+
- do not require password for SSO users
|
81
|
+
- hide password field from form of SSO users
|
82
|
+
## [3.0.0] - 2019-07-06
|
83
|
+
### Added
|
84
|
+
- external_id on user
|
85
|
+
### Changed
|
86
|
+
- users/show only for logged users
|
87
|
+
- upgrade to authlogic 5
|
88
|
+
- minor improvements
|
@@ -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
|
@@ -1,38 +1,5 @@
|
|
1
1
|
module Symphonia
|
2
2
|
class UsersController < ApplicationController
|
3
|
-
include ::Swagger::Blocks
|
4
|
-
|
5
|
-
swagger_path '/admin/users/{id}.json' do
|
6
|
-
operation :get do
|
7
|
-
key :summary, 'Find User by ID'
|
8
|
-
key :description, 'Returns a single user if the user has access'
|
9
|
-
# key :operationId, 'findPetById'
|
10
|
-
# key :tags, [
|
11
|
-
# 'pet'
|
12
|
-
# ]
|
13
|
-
parameter do
|
14
|
-
key :name, :id
|
15
|
-
key :in, :path
|
16
|
-
key :description, 'ID of user to fetch'
|
17
|
-
key :required, true
|
18
|
-
key :type, :integer
|
19
|
-
key :format, :int64
|
20
|
-
end
|
21
|
-
extend Symphonia::Swagger::Responses
|
22
|
-
response 200 do
|
23
|
-
key :description, 'user response'
|
24
|
-
schema do
|
25
|
-
key :'$ref', :User
|
26
|
-
end
|
27
|
-
end
|
28
|
-
# response :default do
|
29
|
-
# key :description, 'unexpected error'
|
30
|
-
# schema do
|
31
|
-
# key :'$ref', :ErrorModel
|
32
|
-
# end
|
33
|
-
# end
|
34
|
-
end
|
35
|
-
end
|
36
3
|
|
37
4
|
helper Symphonia::RendererHelper
|
38
5
|
|
@@ -108,7 +75,7 @@ module Symphonia
|
|
108
75
|
format.any(:json, :xml) { head :no_content }
|
109
76
|
else
|
110
77
|
format.html do
|
111
|
-
@roles = Symphonia::Role.
|
78
|
+
@roles = Symphonia::Role.sorted
|
112
79
|
render action: 'edit'
|
113
80
|
end
|
114
81
|
format.xml { render xml: @user.errors, status: :unprocessable_entity }
|
@@ -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 = {})
|
@@ -19,6 +19,7 @@ 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
24
|
validates :email, uniqueness: { case_sensitive: false }
|
24
25
|
validates :password,
|
@@ -30,30 +31,6 @@ module Symphonia
|
|
30
31
|
|
31
32
|
include UserManagement
|
32
33
|
|
33
|
-
include ::Swagger::Blocks
|
34
|
-
|
35
|
-
swagger_schema :User do
|
36
|
-
key :required, %i[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
|
-
|
57
34
|
attr_writer :password_confirmation
|
58
35
|
|
59
36
|
has_and_belongs_to_many :preferences, foreign_key: 'user_id'
|
@@ -155,7 +132,7 @@ module Symphonia
|
|
155
132
|
end
|
156
133
|
|
157
134
|
def language
|
158
|
-
|
135
|
+
nil
|
159
136
|
end
|
160
137
|
end
|
161
138
|
|
@@ -1,9 +1,20 @@
|
|
1
|
-
<div class="row">
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<div class="col-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<div class="row justify-content-center">
|
2
|
+
<div class="col-lg-8">
|
3
|
+
<%= f.email_field :email, required: true %>
|
4
|
+
</div>
|
5
|
+
<div class="col-lg-8">
|
6
|
+
<%= f.text_field :first_name, required: true %>
|
7
|
+
|
8
|
+
</div>
|
9
|
+
<div class="col-lg-8">
|
10
|
+
<%= f.text_field :last_name, required: true %>
|
11
|
+
|
12
|
+
</div>
|
13
|
+
<div class="col-lg-8">
|
14
|
+
<% if f.object.external_id.blank? %>
|
15
|
+
<%= f.password_field :password, required: f.object.new_record?, prepend: icon('key') %>
|
16
|
+
<% end %>
|
17
|
+
</div>
|
9
18
|
</div>
|
19
|
+
|
20
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= title(@user.name) %>
|
2
|
-
<%= symphonia_form_for(@user, :
|
3
|
-
<%= render(:
|
2
|
+
<%= symphonia_form_for(@user, url: { action: 'update' }) do |f| %>
|
3
|
+
<%= render(partial: @user.form_path, locals: { f: f }) %>
|
4
4
|
|
5
5
|
<div class="buttons">
|
6
6
|
<%= link_to_back %>
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<%= render(partial: 'symphonia/accounts/form', locals: {f: f}) %>
|
2
|
-
|
3
|
-
|
4
|
-
<div class="col-
|
1
|
+
<%= render(partial: 'symphonia/accounts/form', locals: { f: f }) %>
|
2
|
+
<% if Symphonia::User.current.admin? %>
|
3
|
+
<div class="row justify-content-center">
|
4
|
+
<div class="col-8">
|
5
5
|
<%= f.check_box :admin, id: 'user_admin', layout: :inline %>
|
6
6
|
</div>
|
7
7
|
<% if @roles.any? %>
|
8
|
-
<div class="col-
|
8
|
+
<div class="col-9">
|
9
9
|
<%= f.select(:role_id, options_from_collection_for_select(@roles, :id, :name, selected: @user.role_id), include_blank: true, layout: :horizontal) %>
|
10
10
|
</div>
|
11
11
|
<% end -%>
|
12
|
-
|
13
|
-
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -4,22 +4,24 @@
|
|
4
4
|
<%= render(partial: 'form', locals: { f: f }) %>
|
5
5
|
|
6
6
|
<% if @user && !@user.new_record? && Symphonia::User.current.logged_in? && (prefs = Symphonia::EmailPreference.visible.to_a).any? %>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<div class="
|
14
|
-
<
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
<div class="row justify-content-center">
|
8
|
+
<%= hidden_field_tag 'user[preference_ids][]' %>
|
9
|
+
<fieldset id="users-notifications-map" class="col-8">
|
10
|
+
<%= content_tag(:legend, t(:label_user_notifications)) %>
|
11
|
+
<div class="row">
|
12
|
+
<% prefs.each do |pref| %>
|
13
|
+
<div class="col-6">
|
14
|
+
<div class="form-check">
|
15
|
+
<label class="form-check-label">
|
16
|
+
<%= check_box_tag('user[preference_ids][]', pref.id, @user.preference_ids.include?(pref.id), class: 'form-check-input') %>
|
17
|
+
<%= t(pref.name, scope: :preferences) %>
|
18
|
+
</label>
|
19
|
+
</div>
|
18
20
|
</div>
|
19
|
-
|
20
|
-
|
21
|
-
</
|
22
|
-
</
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
</fieldset>
|
24
|
+
</div>
|
23
25
|
<% end %>
|
24
26
|
|
25
27
|
<%= f.primary unless request.xhr? %>
|