biovision 0.0.200518.1 → 0.1.210414.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +60 -18
- data/app/assets/images/biovision/icons/back.svg +19 -0
- data/app/assets/images/biovision/icons/create.svg +19 -0
- data/app/assets/images/biovision/icons/destroy.svg +12 -0
- data/app/assets/images/biovision/icons/dropdown.svg +3 -0
- data/app/assets/images/biovision/icons/edit.svg +22 -0
- data/app/assets/images/biovision/icons/gear.svg +11 -0
- data/app/assets/images/biovision/icons/return.svg +25 -0
- data/app/assets/images/biovision/icons/world.svg +11 -0
- data/app/assets/stylesheets/biovision/admin/components.scss +3 -1
- data/app/assets/stylesheets/biovision/admin/components/users.scss +16 -0
- data/app/assets/stylesheets/biovision/admin/layout.scss +6 -17
- data/app/assets/stylesheets/biovision/biovision.scss +42 -1
- data/app/assets/stylesheets/biovision/components.scss +6 -0
- data/app/assets/stylesheets/biovision/components/breadcrumbs.scss +13 -0
- data/app/assets/stylesheets/biovision/components/buttons.scss +130 -0
- data/app/assets/stylesheets/biovision/components/forms.scss +162 -1
- data/app/assets/stylesheets/biovision/components/lists.scss +6 -7
- data/app/assets/stylesheets/biovision/{biovision → components}/messages.scss +9 -0
- data/app/assets/stylesheets/biovision/components/pagination.scss +34 -0
- data/app/assets/stylesheets/biovision/components/simple_image.scss +112 -0
- data/app/assets/stylesheets/biovision/components/toggleable.scss +71 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components.scss +2 -3
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users.scss +2 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/form_tabs.scss +101 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/profile.scss +77 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +2 -16
- data/app/controllers/admin/components_controller.rb +9 -19
- data/app/controllers/admin/dynamic_blocks_controller.rb +15 -0
- data/app/controllers/admin/dynamic_pages_controller.rb +15 -0
- data/app/controllers/admin/navigation_groups_controller.rb +14 -0
- data/app/controllers/admin/users_controller.rb +70 -0
- data/app/controllers/admin_controller.rb +3 -2
- data/app/controllers/authentication_controller.rb +6 -34
- data/app/controllers/concerns/authentication.rb +12 -12
- data/app/controllers/concerns/crud_entities.rb +132 -0
- data/app/controllers/concerns/entity_priority.rb +10 -0
- data/app/controllers/concerns/toggleable_entity.rb +31 -0
- data/app/controllers/contact_controller.rb +49 -0
- data/app/controllers/fallback_controller.rb +12 -0
- data/app/controllers/index_controller.rb +1 -0
- data/app/controllers/legal_controller.rb +14 -0
- data/app/controllers/my/components_controller.rb +5 -0
- data/app/controllers/my/confirmations_controller.rb +44 -0
- data/app/controllers/my/index_controller.rb +8 -0
- data/app/controllers/my/profiles_controller.rb +31 -16
- data/app/controllers/profile_controller.rb +12 -0
- data/app/controllers/users_controller.rb +61 -0
- data/app/helpers/biovision_helper.rb +171 -0
- data/app/helpers/simple_image_helper.rb +125 -0
- data/app/jobs/application_job.rb +7 -0
- data/app/jobs/send_phone_confirmation_job.rb +16 -0
- data/app/lib/biovision/components/base/component_parameters.rb +44 -0
- data/app/lib/biovision/components/base/component_privileges.rb +65 -0
- data/app/lib/biovision/components/base/component_settings.rb +32 -0
- data/app/lib/biovision/components/base/privilege_handler.rb +79 -0
- data/app/lib/biovision/components/base_component.rb +51 -54
- data/app/lib/biovision/components/contact_component.rb +22 -0
- data/app/lib/biovision/components/content_component.rb +28 -0
- data/app/lib/biovision/components/track_component.rb +3 -0
- data/app/lib/biovision/components/users/authentication.rb +15 -7
- data/app/lib/biovision/components/users/codes.rb +104 -0
- data/app/lib/biovision/components/users/flag_helpers.rb +72 -0
- data/app/lib/biovision/components/users/profile_handler.rb +111 -1
- data/app/lib/biovision/components/users/registration_handler.rb +40 -52
- data/app/lib/biovision/components/users/validation.rb +83 -0
- data/app/lib/biovision/components/users_component.rb +82 -19
- data/app/lib/biovision/notifiers/base_notifier.rb +2 -2
- data/app/lib/biovision/notifiers/contact_notifier.rb +15 -0
- data/app/lib/canonizer.rb +38 -0
- data/app/lib/carrier_wave/image_optim.rb +32 -0
- data/app/mailers/code_sender.rb +29 -0
- data/app/models/agent.rb +4 -0
- data/app/models/biovision_component.rb +22 -2
- data/app/models/browser.rb +1 -1
- data/app/models/code.rb +32 -9
- data/app/models/concerns/has_simple_image.rb +9 -0
- data/app/models/concerns/meta_texts.rb +25 -5
- data/app/models/concerns/tree_structure.rb +72 -0
- data/app/models/contact_method.rb +47 -0
- data/app/models/contact_type.rb +27 -0
- data/app/models/dynamic_block.rb +43 -0
- data/app/models/dynamic_page.rb +71 -0
- data/app/models/feedback_message.rb +59 -0
- data/app/models/feedback_response.rb +50 -0
- data/app/models/group.rb +48 -0
- data/app/models/language.rb +4 -0
- data/app/models/navigation_group.rb +33 -0
- data/app/models/navigation_group_page.rb +23 -0
- data/app/models/role.rb +56 -0
- data/app/models/role_group.rb +13 -0
- data/app/models/simple_image.rb +22 -8
- data/app/models/simple_image_tag.rb +1 -1
- data/app/models/token.rb +4 -4
- data/app/models/user.rb +94 -26
- data/app/models/user_group.rb +20 -0
- data/app/models/user_role.rb +19 -0
- data/app/uploaders/simple_file_uploader.rb +27 -0
- data/app/uploaders/simple_image_uploader.rb +20 -0
- data/app/views/admin/agents/index.html.erb +0 -2
- data/app/views/admin/components/_image.jbuilder +18 -0
- data/app/views/admin/components/_list.html.erb +1 -1
- data/app/views/admin/components/entity/_links.html.erb +1 -1
- data/app/views/admin/components/image.jbuilder +1 -0
- data/app/views/admin/components/images.jbuilder +4 -0
- data/app/views/admin/components/links/_content.html.erb +9 -0
- data/app/views/admin/components/links/_users.html.erb +1 -8
- data/app/views/admin/components/links/extra/_content.html.erb +0 -0
- data/app/views/admin/components/privileges/_links.html.erb +0 -18
- data/app/views/admin/components/settings/_new_parameter.html.erb +4 -2
- data/app/views/admin/components/settings/_parameters.html.erb +8 -2
- data/app/views/admin/components/settings/_settings.html.erb +1 -1
- data/app/views/admin/components/update_privileges.jbuilder +21 -0
- data/app/views/admin/dynamic_blocks/_form.html.erb +16 -0
- data/app/views/admin/dynamic_blocks/_nav_item.html.erb +6 -0
- data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +10 -0
- data/app/views/admin/dynamic_blocks/index.html.erb +15 -0
- data/app/views/admin/dynamic_blocks/show.html.erb +23 -0
- data/app/views/admin/dynamic_pages/_form.html.erb +21 -0
- data/app/views/admin/dynamic_pages/_nav_item.html.erb +6 -0
- data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +15 -0
- data/app/views/admin/dynamic_pages/index.html.erb +15 -0
- data/app/views/admin/dynamic_pages/show.html.erb +28 -0
- data/app/views/admin/ip_addresses/index.html.erb +0 -2
- data/app/views/admin/navigation_groups/_form.html.erb +15 -0
- data/app/views/admin/navigation_groups/_nav_item.html.erb +6 -0
- data/app/views/admin/navigation_groups/entity/_in_list.html.erb +12 -0
- data/app/views/admin/navigation_groups/index.html.erb +15 -0
- data/app/views/admin/navigation_groups/show.html.erb +20 -0
- data/app/views/admin/unauthorized.html.erb +2 -5
- data/app/views/admin/users/_form.html.erb +81 -0
- data/app/views/admin/users/_nav_item.html.erb +6 -0
- data/app/views/admin/users/entity/_fields.html.erb +53 -0
- data/app/views/admin/users/entity/_in_list.html.erb +38 -0
- data/app/views/admin/users/entity/_profile.html.erb +26 -0
- data/app/views/admin/users/entity/in_list/_additional_data.html.erb +0 -0
- data/app/views/admin/users/index.html.erb +15 -0
- data/app/views/admin/users/show.html.erb +44 -0
- data/app/views/application/forbidden.html.erb +9 -0
- data/app/views/application/forbidden.jbuilder +4 -0
- data/app/views/application/not_found.html.erb +9 -0
- data/app/views/application/not_found.jbuilder +4 -0
- data/app/views/application/unauthorized.html.erb +16 -0
- data/app/views/application/unauthorized.jbuilder +4 -0
- data/app/views/authentication/new.html.erb +2 -8
- data/app/views/components/content/_dynamic_page.html.erb +21 -0
- data/app/views/components/users/_form_tabs.html.erb +31 -0
- data/app/views/components/users/_join_form.html.erb +192 -0
- data/app/views/components/users/_login_form.html.erb +45 -0
- data/app/views/components/users/form/_image.html.erb +17 -0
- data/app/views/components/users/form/_profile_data.html.erb +54 -0
- data/app/views/contact/_form.html.erb +108 -0
- data/app/views/contact/create_feedback_message.js.erb +1 -0
- data/app/views/contact/feedback.html.erb +13 -0
- data/app/views/contact/index.html.erb +16 -0
- data/app/views/fallback/show.html.erb +6 -0
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/layouts/admin/_footer.html.erb +1 -1
- data/app/views/layouts/application/header/_authentication.html.erb +1 -1
- data/app/views/legal/privacy.html.erb +5 -0
- data/app/views/legal/tos.html.erb +5 -0
- data/app/views/my/confirmations/show.html.erb +62 -0
- data/app/views/my/index/index.html.erb +33 -0
- data/app/views/my/profiles/_form.html.erb +10 -0
- data/app/views/my/profiles/check.jbuilder +4 -0
- data/app/views/my/profiles/edit.html.erb +14 -0
- data/app/views/my/profiles/form/_basic_parameters.html.erb +9 -0
- data/app/views/my/profiles/form/_sensitive_parameters.html.erb +68 -0
- data/app/views/my/profiles/new.html.erb +6 -8
- data/app/views/my/profiles/show.html.erb +23 -0
- data/app/views/shared/_flash_messages.html.erb +1 -1
- data/app/views/shared/_list_of_errors.html.erb +7 -0
- data/app/views/shared/admin/_breadcrumbs.html.erb +8 -0
- data/app/views/shared/admin/_list.html.erb +4 -4
- data/app/views/shared/admin/_list_with_priority.html.erb +4 -4
- data/app/views/shared/admin/_priority.html.erb +5 -0
- data/app/views/shared/admin/_toggle.html.erb +11 -0
- data/app/views/shared/entity/_formatted_text_field.html.erb +10 -0
- data/app/views/shared/entity/_image.html.erb +31 -0
- data/app/views/shared/entity/_language.html.erb +6 -0
- data/app/views/shared/entity/_linked_entity.html.erb +6 -0
- data/app/views/shared/entity/_meta_texts.html.erb +16 -0
- data/app/views/shared/entity/_metadata.html.erb +18 -0
- data/app/views/shared/entity/_parent.html.erb +6 -0
- data/app/views/shared/entity/_priority.html.erb +4 -0
- data/app/views/shared/entity/_raw_text_field.html.erb +10 -0
- data/app/views/shared/entity/_simple_image.html.erb +10 -0
- data/app/views/shared/entity/_slug.html.erb +6 -0
- data/app/views/shared/entity/_text_field.html.erb +6 -0
- data/app/views/shared/entity/_text_fields.html.erb +9 -0
- data/app/views/shared/entity/_timestamps.html.erb +13 -0
- data/app/views/shared/entity/_tree_caches.html.erb +12 -0
- data/app/views/shared/entity/_uuid.html.erb +4 -0
- data/app/views/shared/entity/edit.html.erb +21 -0
- data/app/views/shared/entity/new.html.erb +16 -0
- data/app/views/shared/forms/_entity_flags.html.erb +15 -0
- data/app/views/shared/forms/_field.html.erb +46 -0
- data/app/views/shared/forms/_fields.html.erb +3 -0
- data/app/views/shared/forms/_language.html.erb +40 -0
- data/app/views/shared/forms/_meta_texts.html.erb +27 -0
- data/app/views/shared/forms/_priority.html.erb +13 -0
- data/app/views/shared/forms/_simple_image.html.erb +39 -0
- data/app/views/shared/forms/_state_container.html.erb +7 -0
- data/app/views/shared/forms/_text_area.html.erb +25 -0
- data/app/views/shared/forms/_text_field.html.erb +24 -0
- data/app/views/shared/forms/_text_fields.html.erb +3 -0
- data/app/views/shared/forms/check.jbuilder +4 -0
- data/app/views/shared/forms/errors.jbuilder +3 -0
- data/app/views/shared/forms/simple_image/_browse.html.erb +14 -0
- data/app/views/shared/forms/simple_image/_load_image.html.erb +38 -0
- data/app/views/shared/my/_list.html.erb +19 -0
- data/app/views/shared/my/_list_with_priority.html.erb +19 -0
- data/app/views/users/_profile.html.erb +30 -0
- data/app/views/users/profile/_data.html.erb +20 -0
- data/app/views/users/show.html.erb +21 -0
- data/config/locales/biovision-ru.yml +58 -0
- data/config/locales/components-ru.yml +30 -2
- data/config/locales/contact-ru.yml +106 -0
- data/config/locales/content-ru.yml +103 -0
- data/config/locales/users-ru.yml +117 -3
- data/config/routes.rb +70 -50
- data/db/migrate/20191228000000_create_biovision_components.rb +4 -5
- data/db/migrate/20200224000000_create_track_component.rb +7 -8
- data/db/migrate/20200224000010_create_users_component.rb +15 -43
- data/db/migrate/20200404000000_create_simple_images.rb +3 -3
- data/db/migrate/20200529000000_create_content_component.rb +74 -0
- data/db/migrate/20210401000000_create_contact_component.rb +95 -0
- data/db/migrate/20210405000000_create_acl.rb +74 -0
- data/lib/biovision/base_methods.rb +18 -10
- data/lib/biovision/engine.rb +8 -13
- data/lib/biovision/version.rb +1 -1
- metadata +186 -20
- data/app/assets/images/biovision/placeholders/user.svg +0 -15
- data/app/helpers/users_helper.rb +0 -11
- data/app/lib/biovision/components/component_settings.rb +0 -30
- data/app/lib/biovision/components/privilege_handler.rb +0 -77
- data/app/lib/biovision/components/users/code_handler.rb +0 -23
- data/app/models/foreign_site.rb +0 -34
- data/app/models/foreign_user.rb +0 -21
- data/app/uploaders/user_image_uploader.rb +0 -58
- data/app/views/admin/components/privileges/_privilege_flag.html.erb +0 -28
- data/app/views/authentication/_form.html.erb +0 -40
- data/app/views/authentication/failed.js.erb +0 -3
- data/app/views/my/profiles/new/_form.html.erb +0 -147
- data/app/views/shared/admin/_toggleable.html.erb +0 -8
@@ -1,3 +1,2 @@
|
|
1
|
-
@import "biovision/components
|
2
|
-
@import "biovision/components/
|
3
|
-
@import "biovision/components/lists";
|
1
|
+
@import "biovision/components";
|
2
|
+
@import "biovision/themes/default_theme/components/users";
|
@@ -0,0 +1,101 @@
|
|
1
|
+
$users-tab-color: hsl(220, 75%, 50%) !default;
|
2
|
+
$users-tab-color-hover: hsl(220, 100%, 95%) !default;
|
3
|
+
|
4
|
+
.users__form-tabs {
|
5
|
+
box-shadow: var(--block-shadow);
|
6
|
+
margin: 0 auto var(--spacer-m);
|
7
|
+
max-width: 40rem;
|
8
|
+
padding-top: var(--spacer-xs);
|
9
|
+
|
10
|
+
.errors {
|
11
|
+
margin: 0 var(--spacer-xs);
|
12
|
+
}
|
13
|
+
|
14
|
+
.labels {
|
15
|
+
align-items: center;
|
16
|
+
border: .1rem solid $users-tab-color;
|
17
|
+
display: flex;
|
18
|
+
margin: 0 var(--spacer-xs);
|
19
|
+
|
20
|
+
label {
|
21
|
+
color: $users-tab-color;
|
22
|
+
cursor: pointer;
|
23
|
+
display: block;
|
24
|
+
flex: 1;
|
25
|
+
padding: var(--spacer-xs) var(--spacer-s);
|
26
|
+
text-align: center;
|
27
|
+
transition: .25s;
|
28
|
+
|
29
|
+
&:hover {
|
30
|
+
background-color: $users-tab-color-hover;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
.tabs {
|
36
|
+
.tab {
|
37
|
+
display: none;
|
38
|
+
}
|
39
|
+
|
40
|
+
.login {
|
41
|
+
form {
|
42
|
+
margin: 0 auto;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
.tab-control-login {
|
48
|
+
&:checked {
|
49
|
+
~ .labels {
|
50
|
+
.login {
|
51
|
+
background: $users-tab-color;
|
52
|
+
color: var(--text-color-inverted-primary);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
~ .tabs {
|
57
|
+
.login {
|
58
|
+
display: block;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
.tab-control-join {
|
65
|
+
&:checked {
|
66
|
+
~ .labels {
|
67
|
+
.join {
|
68
|
+
background: $users-tab-color;
|
69
|
+
color: var(--text-color-inverted-primary);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
~ .tabs {
|
74
|
+
.join {
|
75
|
+
display: block;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.fields {
|
82
|
+
> div:not(:last-of-type) {
|
83
|
+
margin-bottom: 0;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
.actions {
|
88
|
+
align-items: center;
|
89
|
+
display: flex;
|
90
|
+
justify-content: space-between;
|
91
|
+
padding: var(--spacer-xs);
|
92
|
+
}
|
93
|
+
|
94
|
+
.flags {
|
95
|
+
font-weight: 300;
|
96
|
+
|
97
|
+
li {
|
98
|
+
padding: var(--spacer-xxs) var(--spacer-xs);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
.users__profile {
|
2
|
+
--avatar-size: 36rem;
|
3
|
+
align-items: flex-start;
|
4
|
+
display: flex;
|
5
|
+
|
6
|
+
.avatar {
|
7
|
+
flex: none;
|
8
|
+
padding: var(--spacer-xs) var(--spacer-xxs);
|
9
|
+
width: calc(var(--avatar-size) + var(--spacer-xxs) * 2 + var(--spacer-s));
|
10
|
+
|
11
|
+
.image {
|
12
|
+
max-width: 100%;
|
13
|
+
height: var(--avatar-size);
|
14
|
+
width: var(--avatar-size);
|
15
|
+
}
|
16
|
+
|
17
|
+
img {
|
18
|
+
box-shadow: var(--block-shadow);
|
19
|
+
height: 100%;
|
20
|
+
object-fit: contain;
|
21
|
+
width: 100%;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
@media (max-width: 850px) {
|
27
|
+
.users__profile {
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
@media (max-width: 375px) {
|
33
|
+
.users__profile {
|
34
|
+
--avatar-size: 30rem;
|
35
|
+
|
36
|
+
.avatar {
|
37
|
+
width: 100%;
|
38
|
+
|
39
|
+
.image {
|
40
|
+
margin: 0 auto;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
.users__profile-aside {
|
47
|
+
margin: var(--spacer-s) 0;
|
48
|
+
padding: 0 var(--spacer-xs);
|
49
|
+
}
|
50
|
+
|
51
|
+
.users__profile-form {
|
52
|
+
background: #f7f7f7;
|
53
|
+
border: var(--border-secondary);
|
54
|
+
margin: var(--spacer-s) auto;
|
55
|
+
padding: var(--spacer-xs);
|
56
|
+
|
57
|
+
img {
|
58
|
+
box-shadow: var(--block-shadow);
|
59
|
+
}
|
60
|
+
|
61
|
+
h3 {
|
62
|
+
margin-bottom: var(--spacer-s);
|
63
|
+
}
|
64
|
+
|
65
|
+
.hint {
|
66
|
+
background: #fff;
|
67
|
+
box-shadow: var(--block-shadow);
|
68
|
+
font-size: var(--font-size-increased);
|
69
|
+
font-weight: 300;
|
70
|
+
padding: var(--spacer-xs);
|
71
|
+
|
72
|
+
&::before {
|
73
|
+
content: '☝';
|
74
|
+
margin-right: var(--spacer-xxs);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
@@ -4,33 +4,19 @@
|
|
4
4
|
//* { outline: solid pink 1px }
|
5
5
|
|
6
6
|
html {
|
7
|
-
height: 100%;
|
7
|
+
//height: 100%;
|
8
8
|
}
|
9
9
|
|
10
10
|
body {
|
11
11
|
display: flex;
|
12
12
|
flex-direction: column;
|
13
|
-
height: 100%;
|
13
|
+
//height: 100%;
|
14
14
|
}
|
15
15
|
|
16
16
|
#main {
|
17
17
|
flex: 1;
|
18
18
|
}
|
19
19
|
|
20
|
-
.breadcrumbs {
|
21
|
-
a {
|
22
|
-
background: image_url('biovision/icons/breadcrumb.svg') no-repeat bottom .1rem right / .6rem 1.2rem;
|
23
|
-
padding-right: 1rem;
|
24
|
-
transition: background .25s;
|
25
|
-
|
26
|
-
&:active,
|
27
|
-
&:focus,
|
28
|
-
&:hover {
|
29
|
-
background-image: image_url('biovision/icons/breadcrumb-hover.svg');
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
20
|
.content-wrapper {
|
35
21
|
padding: var(--spacer-xs);
|
36
22
|
}
|
@@ -13,18 +13,18 @@ class Admin::ComponentsController < AdminController
|
|
13
13
|
# get /admin/components/:slug
|
14
14
|
def show
|
15
15
|
error = 'Viewing component is not allowed'
|
16
|
-
handle_http_401(error) unless @handler.
|
16
|
+
handle_http_401(error) unless @handler.permit?('view')
|
17
17
|
end
|
18
18
|
|
19
19
|
# get /admin/components/:slug/settings
|
20
20
|
def settings
|
21
21
|
error = 'Viewing settings is not allowed'
|
22
|
-
handle_http_401(error) unless @handler.
|
22
|
+
handle_http_401(error) unless @handler.permit?('settings.view')
|
23
23
|
end
|
24
24
|
|
25
25
|
# patch /admin/components/:slug/settings
|
26
26
|
def update_settings
|
27
|
-
if @handler.
|
27
|
+
if @handler.permit?('settings.edit')
|
28
28
|
new_settings = params.dig(:component, :settings).permit!
|
29
29
|
@handler.settings = new_settings.to_h
|
30
30
|
flash[:success] = t('.success')
|
@@ -36,7 +36,7 @@ class Admin::ComponentsController < AdminController
|
|
36
36
|
|
37
37
|
# patch /admin/components/:slug/parameters
|
38
38
|
def update_parameter
|
39
|
-
if @handler.
|
39
|
+
if @handler.permit?('settings.edit')
|
40
40
|
slug = param_from_request(:key, :slug).downcase
|
41
41
|
value = param_from_request(:key, :value)
|
42
42
|
|
@@ -48,7 +48,7 @@ class Admin::ComponentsController < AdminController
|
|
48
48
|
|
49
49
|
# delete /admin/components/:slug/parameters/:parameter_slug
|
50
50
|
def delete_parameter
|
51
|
-
if @handler.
|
51
|
+
if @handler.permit?('settings.edit')
|
52
52
|
@handler.component.parameters.delete(params[:parameter_slug])
|
53
53
|
@handler.component.save
|
54
54
|
end
|
@@ -99,32 +99,22 @@ class Admin::ComponentsController < AdminController
|
|
99
99
|
|
100
100
|
# put /admin/components/:slug/users/:user_id/privileges/:privilege_slug
|
101
101
|
def add_privilege
|
102
|
-
if @handler.administrator?
|
103
|
-
@handler.user = User.find_by(id: params[:user_id])
|
104
|
-
@handler.privilege_handler.add_privilege(params[:privilege_slug])
|
105
|
-
end
|
106
|
-
|
107
102
|
head :no_content
|
108
103
|
end
|
109
104
|
|
110
105
|
# put /admin/components/:slug/users/:user_id/privileges/:privilege_slug
|
111
106
|
def remove_privilege
|
112
|
-
if @handler.administrator?
|
113
|
-
@handler.user = User.find_by(id: params[:user_id])
|
114
|
-
@handler.privilege_handler.remove_privilege(params[:privilege_slug])
|
115
|
-
end
|
116
|
-
|
117
107
|
head :no_content
|
118
108
|
end
|
119
109
|
|
120
110
|
# get /admin/components/:slug/images
|
121
111
|
def images
|
122
112
|
list = SimpleImage.in_component(@handler.component).list_for_administration
|
123
|
-
@collection = @handler.
|
113
|
+
@collection = @handler.permit?('simple_images.view') ? list.page(current_page) : []
|
124
114
|
end
|
125
115
|
|
126
116
|
def create_image
|
127
|
-
if @handler.
|
117
|
+
if @handler.permit?('simple_images.create')
|
128
118
|
@entity = @handler.component.simple_images.new(image_parameters)
|
129
119
|
if @entity.save
|
130
120
|
render 'image', formats: :json
|
@@ -168,7 +158,7 @@ class Admin::ComponentsController < AdminController
|
|
168
158
|
|
169
159
|
def image_parameters
|
170
160
|
permitted = SimpleImage.entity_parameters
|
171
|
-
params.require(:simple_image).permit(permitted)
|
172
|
-
|
161
|
+
parameters = params.require(:simple_image).permit(permitted)
|
162
|
+
parameters.merge(owner_for_entity(true))
|
173
163
|
end
|
174
164
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Administrative part for handling dynamic_blocks
|
4
|
+
class Admin::DynamicBlocksController < AdminController
|
5
|
+
include CrudEntities
|
6
|
+
include ToggleableEntity
|
7
|
+
|
8
|
+
before_action :set_entity, except: %i[check create index new]
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def component_class
|
13
|
+
Biovision::Components::ContentComponent
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Administrative part for handling dynamic_pages
|
4
|
+
class Admin::DynamicPagesController < AdminController
|
5
|
+
include CrudEntities
|
6
|
+
include ToggleableEntity
|
7
|
+
|
8
|
+
before_action :set_entity, except: %i[check create index new]
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def component_class
|
13
|
+
Biovision::Components::ContentComponent
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Administrative part for handling navigation_groups
|
4
|
+
class Admin::NavigationGroupsController < AdminController
|
5
|
+
include CrudEntities
|
6
|
+
|
7
|
+
before_action :set_entity, except: %i[check create index new]
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def component_class
|
12
|
+
Biovision::Components::ContentComponent
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Administrative part for handling dynamic_pages
|
4
|
+
class Admin::UsersController < AdminController
|
5
|
+
include Authentication
|
6
|
+
include CrudEntities
|
7
|
+
include ToggleableEntity
|
8
|
+
|
9
|
+
before_action :set_entity, except: %i[check create index new]
|
10
|
+
|
11
|
+
# post /admin/users
|
12
|
+
def create
|
13
|
+
@entity = component_handler.create_user(entity_parameters, profile_parameters)
|
14
|
+
if @entity.persisted?
|
15
|
+
form_processed_ok(path_after_save)
|
16
|
+
else
|
17
|
+
form_processed_with_error(view_for_new)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# patch /admin/users/:id
|
22
|
+
def update
|
23
|
+
if component_handler.update_user(@entity, entity_parameters, profile_parameters)
|
24
|
+
form_processed_ok(path_after_save)
|
25
|
+
else
|
26
|
+
form_processed_with_error(view_for_edit)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# post /admin/users/:id/authenticate
|
31
|
+
def authenticate
|
32
|
+
unless @entity.super_user?
|
33
|
+
cookies['pt'] = {
|
34
|
+
value: cookies['token'],
|
35
|
+
expires: 1.year.from_now,
|
36
|
+
domain: :all,
|
37
|
+
httponly: true
|
38
|
+
}
|
39
|
+
create_token_for_user(@entity)
|
40
|
+
end
|
41
|
+
|
42
|
+
redirect_to my_path
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def component_class
|
48
|
+
Biovision::Components::UsersComponent
|
49
|
+
end
|
50
|
+
|
51
|
+
def entity_parameters
|
52
|
+
excluded = @entity&.super_user? ? User.sensitive_parameters : []
|
53
|
+
permitted = User.entity_parameters - excluded
|
54
|
+
params.require(:user).permit(permitted)
|
55
|
+
end
|
56
|
+
|
57
|
+
def creation_parameters
|
58
|
+
parameters = params.require(:user).permit(User.entity_parameters)
|
59
|
+
parameters.merge(tracking_for_entity)
|
60
|
+
end
|
61
|
+
|
62
|
+
def profile_parameters
|
63
|
+
if params.key?(:profile)
|
64
|
+
list = Biovision::Components::Users::ProfileHandler.permitted_for_request
|
65
|
+
params.require(:profile).permit(list)
|
66
|
+
else
|
67
|
+
{}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -4,11 +4,12 @@
|
|
4
4
|
class AdminController < ApplicationController
|
5
5
|
before_action :restrict_access
|
6
6
|
|
7
|
-
|
7
|
+
private
|
8
8
|
|
9
9
|
def restrict_access
|
10
|
+
user_action = "#{controller_name}.default"
|
10
11
|
error = t('admin.errors.unauthorized.message')
|
11
12
|
|
12
|
-
handle_http_401(error) unless component_handler.
|
13
|
+
handle_http_401(error) unless component_handler.permit?(user_action)
|
13
14
|
end
|
14
15
|
end
|