biovision 0.0.200518.1 → 0.12.211124.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 +105 -52
- 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/users.scss +20 -0
- data/app/assets/stylesheets/biovision/admin/components.scss +13 -1
- data/app/assets/stylesheets/biovision/admin/layout.scss +27 -12
- data/app/assets/stylesheets/biovision/biovision.scss +105 -26
- 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/filters.scss +39 -0
- data/app/assets/stylesheets/biovision/components/forms.scss +208 -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/quick_search.scss +24 -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/components.scss +7 -0
- data/app/assets/stylesheets/biovision/default.scss +4 -4
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/dashboard.scss +4 -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/components/users.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components.scss +2 -3
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +12 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +8 -19
- data/app/assets/stylesheets/biovision/themes/default_theme.scss +0 -1
- data/app/assets/stylesheets/biovision/vars.scss +5 -0
- data/app/controllers/admin/biovision_components_controller.rb +10 -0
- data/app/controllers/admin/components_controller.rb +37 -97
- data/app/controllers/admin/dynamic_blocks_controller.rb +15 -0
- data/app/controllers/admin/dynamic_pages_controller.rb +15 -0
- data/app/controllers/admin/index_controller.rb +8 -2
- data/app/controllers/admin/navigation_groups_controller.rb +45 -0
- data/app/controllers/admin/tokens_controller.rb +15 -0
- data/app/controllers/admin/users_controller.rb +101 -0
- data/app/controllers/admin_controller.rb +2 -8
- data/app/controllers/authentication_controller.rb +6 -34
- data/app/controllers/concerns/authentication.rb +12 -12
- data/app/controllers/concerns/component_stories.rb +22 -0
- data/app/controllers/concerns/crud_entities.rb +140 -0
- data/app/controllers/concerns/entity_priority.rb +10 -0
- data/app/controllers/concerns/my_crud_entities.rb +146 -0
- data/app/controllers/concerns/processed_forms.rb +28 -0
- data/app/controllers/concerns/restricted_access.rb +37 -0
- data/app/controllers/concerns/toggleable_entity.rb +31 -0
- data/app/controllers/contact_controller.rb +49 -0
- data/app/controllers/errors_controller.rb +37 -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 +26 -0
- data/app/controllers/my/confirmations_controller.rb +44 -0
- data/app/controllers/my/index_controller.rb +7 -1
- data/app/controllers/my/profiles_controller.rb +33 -16
- data/app/controllers/oembed_controller.rb +12 -0
- data/app/controllers/profile_controller.rb +14 -0
- data/app/controllers/users_controller.rb +63 -0
- data/app/helpers/biovision_components_helper.rb +7 -3
- data/app/helpers/biovision_helper.rb +170 -0
- data/app/helpers/entity_helper.rb +77 -0
- data/app/helpers/my_helper.rb +34 -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 +55 -0
- data/app/lib/biovision/components/base/component_privileges.rb +75 -0
- data/app/lib/biovision/components/base/component_settings.rb +40 -0
- data/app/lib/biovision/components/base/component_stories.rb +30 -0
- data/app/lib/biovision/components/base/entity_links.rb +38 -0
- data/app/lib/biovision/components/base/image_handling.rb +33 -0
- data/app/lib/biovision/components/base_component.rb +63 -95
- data/app/lib/biovision/components/contact_component.rb +26 -0
- data/app/lib/biovision/components/content/oembed/receiver.rb +98 -0
- data/app/lib/biovision/components/content/oembed/twitter_receiver.rb +20 -0
- data/app/lib/biovision/components/content/oembed/vimeo_receiver.rb +20 -0
- data/app/lib/biovision/components/content/oembed/youtube_receiver.rb +20 -0
- data/app/lib/biovision/components/content_component.rb +65 -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 +114 -19
- data/app/lib/biovision/helpers/data_helper.rb +70 -0
- data/app/lib/biovision/helpers/export_helper.rb +97 -0
- data/app/lib/biovision/migrations/component_migration.rb +56 -0
- data/app/lib/biovision/notifiers/base_notifier.rb +2 -2
- data/app/lib/biovision/notifiers/contact_notifier.rb +15 -0
- data/app/lib/biovision/stories/component_story.rb +55 -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/mailers/feedback_mailer.rb +14 -0
- data/app/models/agent.rb +4 -0
- data/app/models/biovision_component.rb +39 -3
- data/app/models/code.rb +31 -8
- data/app/models/concerns/checkable.rb +2 -1
- data/app/models/concerns/has_simple_image.rb +9 -0
- data/app/models/concerns/has_uploaded_file.rb +26 -0
- data/app/models/concerns/meta_texts.rb +25 -5
- data/app/models/concerns/simple_tag.rb +30 -0
- data/app/models/concerns/toggleable.rb +2 -1
- data/app/models/concerns/tree_structure.rb +75 -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 +73 -0
- data/app/models/feedback_message.rb +65 -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/metric.rb +4 -0
- data/app/models/navigation_group.rb +43 -0
- data/app/models/navigation_group_page.rb +23 -0
- data/app/models/oembed_domain.rb +25 -0
- data/app/models/oembed_link.rb +19 -0
- data/app/models/oembed_receiver.rb +15 -0
- data/app/models/role.rb +86 -0
- data/app/models/role_group.rb +13 -0
- data/app/models/simple_image.rb +49 -8
- data/app/models/simple_image_tag.rb +1 -16
- data/app/models/token.rb +6 -2
- data/app/models/uploaded_file.rb +62 -0
- data/app/models/uploaded_file_tag.rb +15 -0
- data/app/models/uploaded_file_tag_file.rb +13 -0
- data/app/models/user.rb +122 -29
- data/app/models/user_group.rb +20 -0
- data/app/models/user_role.rb +18 -0
- data/app/uploaders/simple_file_uploader.rb +23 -0
- data/app/uploaders/simple_image_uploader.rb +29 -20
- data/app/uploaders/uploaders/path_slug.rb +22 -0
- data/app/views/admin/agents/index.html.erb +1 -3
- data/app/views/admin/biovision_components/_nav_item.html.erb +6 -0
- data/app/views/admin/biovision_components/entity/_in_list.html.erb +12 -0
- data/app/views/admin/biovision_components/index.html.erb +11 -0
- 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 +31 -21
- data/app/views/admin/components/image.jbuilder +1 -0
- data/app/views/admin/components/images.jbuilder +4 -0
- data/app/views/admin/components/links/_base.html.erb +1 -0
- 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 +4 -4
- data/app/views/admin/components/settings.html.erb +2 -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 +12 -0
- data/app/views/admin/dynamic_blocks/index.html.erb +17 -0
- data/app/views/admin/dynamic_blocks/show.html.erb +25 -0
- data/app/views/admin/dynamic_pages/_dynamic_page.jbuilder +18 -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 +17 -0
- data/app/views/admin/dynamic_pages/entity/_in_search.html.erb +7 -0
- data/app/views/admin/dynamic_pages/index.html.erb +17 -0
- data/app/views/admin/dynamic_pages/search.jbuilder +4 -0
- data/app/views/admin/dynamic_pages/show.html.erb +28 -0
- data/app/views/admin/index/index.html.erb +7 -5
- data/app/views/admin/ip_addresses/index.html.erb +2 -4
- data/app/views/admin/navigation_group_pages/entity/_in_list.html.erb +26 -0
- 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/_dynamic_pages.html.erb +38 -0
- data/app/views/admin/navigation_groups/entity/_in_list.html.erb +14 -0
- data/app/views/admin/navigation_groups/index.html.erb +17 -0
- data/app/views/admin/navigation_groups/show.html.erb +33 -0
- data/app/views/admin/tokens/_form.html.erb +31 -0
- data/app/views/admin/tokens/_nav_item.html.erb +6 -0
- data/app/views/admin/tokens/entity/_in_list.html.erb +27 -0
- data/app/views/admin/tokens/index.html.erb +11 -0
- data/app/views/admin/tokens/show.html.erb +26 -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/_user.jbuilder +18 -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/_in_search.html.erb +18 -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 +24 -0
- data/app/views/admin/users/roles/_component.html.erb +22 -0
- data/app/views/admin/users/roles.html.erb +23 -0
- data/app/views/admin/users/search.jbuilder +4 -0
- data/app/views/admin/users/show.html.erb +62 -0
- data/app/views/admin/widgets/_filters.html.erb +20 -0
- data/app/views/admin/widgets/_quick_search.html.erb +13 -0
- data/app/views/admin/widgets/filters/_flag.html.erb +15 -0
- data/app/views/admin/widgets/filters/_text.html.erb +7 -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 +19 -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 +17 -0
- data/app/views/components/content/_dynamic_page_content.html.erb +14 -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 +46 -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/errors/error.html.erb +1 -0
- data/app/views/fallback/show.html.erb +6 -0
- data/app/views/feedback_mailer/new_feedback_request.html.erb +11 -0
- data/app/views/feedback_mailer/new_feedback_request.text.erb +6 -0
- data/app/views/index/index.html.erb +14 -0
- data/app/views/layouts/admin/_footer.html.erb +1 -1
- data/app/views/layouts/admin/_header.html.erb +7 -2
- data/app/views/layouts/admin.html.erb +0 -1
- data/app/views/layouts/application/_footer.html.erb +1 -1
- data/app/views/layouts/application/header/_authentication.html.erb +4 -1
- data/app/views/legal/privacy.html.erb +5 -0
- data/app/views/legal/tos.html.erb +5 -0
- data/app/views/my/components/index.html.erb +25 -0
- data/app/views/my/components/show.html.erb +21 -0
- data/app/views/my/confirmations/show.html.erb +62 -0
- data/app/views/my/index/_cards.html.erb +15 -0
- data/app/views/my/index/_email.html.erb +14 -0
- data/app/views/my/index/_navigation.html.erb +33 -0
- data/app/views/my/index/index.html.erb +12 -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 +36 -0
- data/app/views/my/recoveries/show.html.erb +0 -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 +10 -19
- data/app/views/shared/admin/_list_with_priority.html.erb +10 -19
- data/app/views/shared/admin/_priority.html.erb +6 -0
- data/app/views/shared/admin/_toggle.html.erb +6 -0
- data/app/views/shared/entity/_date_field.html.erb +6 -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/_list.html.erb +22 -0
- data/app/views/shared/entity/_list_with_priority.html.erb +22 -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/_priority_icons.html.erb +8 -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/_time_field.html.erb +6 -0
- data/app/views/shared/entity/_timestamps.html.erb +13 -0
- data/app/views/shared/entity/_toggle.html.erb +12 -0
- data/app/views/shared/entity/_track.html.erb +12 -0
- data/app/views/shared/entity/_tree_caches.html.erb +19 -0
- data/app/views/shared/entity/_uuid.html.erb +4 -0
- data/app/views/shared/entity/edit.html.erb +23 -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 +50 -0
- data/app/views/shared/forms/_field_with_search.html.erb +17 -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_entity_link.html.erb +14 -0
- data/app/views/shared/forms/_simple_image.html.erb +47 -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 +10 -0
- data/app/views/shared/my/_list_with_priority.html.erb +10 -0
- data/app/views/shared/my/entity/edit.html.erb +25 -0
- data/app/views/shared/my/entity/new.html.erb +18 -0
- data/app/views/simple_images/_simple_image.jbuilder +13 -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 +76 -1
- data/config/locales/components-ru.yml +55 -4
- data/config/locales/contact-ru.yml +110 -0
- data/config/locales/content-ru.yml +115 -0
- data/config/locales/users-ru.yml +142 -3
- data/config/routes.rb +99 -48
- data/db/migrate/20191228000000_create_biovision_components.rb +6 -5
- data/db/migrate/20200224000000_create_track_component.rb +9 -14
- data/db/migrate/20200224000010_create_users_component.rb +14 -83
- data/db/migrate/20200404000000_create_simple_images.rb +4 -3
- data/db/migrate/20210405000000_create_acl.rb +88 -0
- data/db/migrate/20210421000000_create_content_component.rb +80 -0
- data/db/migrate/20210421000010_create_contact_component.rb +74 -0
- data/db/migrate/20210616000000_create_uploaded_files.rb +52 -0
- data/db/migrate/amends/20210816060606_create_oembed_receivers.rb +21 -0
- data/db/migrate/amends/20210907070707_add_checksum_to_simple_images.rb +13 -0
- data/lib/biovision/base_methods.rb +17 -29
- data/lib/biovision/engine.rb +8 -13
- data/lib/biovision/version.rb +1 -1
- data/lib/tasks/components.rake +51 -0
- metadata +266 -27
- 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/biovision_component_user.rb +0 -21
- 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/links/_track.html.erb +0 -2
- data/app/views/admin/components/links/_users.html.erb +0 -11
- data/app/views/admin/components/privileges/_component_user.html.erb +0 -17
- data/app/views/admin/components/privileges/_links.html.erb +0 -35
- data/app/views/admin/components/privileges/_privilege_flag.html.erb +0 -28
- data/app/views/admin/components/privileges/_users.html.erb +0 -23
- data/app/views/admin/components/privileges.html.erb +0 -20
- 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
@@ -4,18 +4,22 @@ module Biovision
|
|
4
4
|
module Components
|
5
5
|
# Base biovision component
|
6
6
|
class BaseComponent
|
7
|
-
extend ComponentSettings
|
7
|
+
extend Base::ComponentSettings
|
8
|
+
include Base::ComponentPrivileges
|
9
|
+
include Base::ComponentParameters
|
10
|
+
include Base::EntityLinks
|
11
|
+
include Base::ImageHandling
|
8
12
|
|
9
|
-
attr_reader :component, :slug, :name
|
13
|
+
attr_reader :component, :slug, :name
|
14
|
+
attr_accessor :user
|
10
15
|
|
11
16
|
# @param [BiovisionComponent] component
|
12
|
-
# @param [User] user
|
17
|
+
# @param [User|nil] user
|
13
18
|
def initialize(component, user = nil)
|
14
19
|
@component = component
|
15
|
-
|
20
|
+
self.slug = component&.slug || 'base'
|
16
21
|
self.user = user
|
17
|
-
|
18
|
-
@name = I18n.t("biovision.components.#{@slug}.name", default: @slug)
|
22
|
+
self.name = I18n.t("biovision.components.#{slug}.name", default: slug)
|
19
23
|
end
|
20
24
|
|
21
25
|
# Receive component-specific handler by component slug
|
@@ -29,7 +33,11 @@ module Biovision
|
|
29
33
|
end
|
30
34
|
|
31
35
|
def self.slug
|
32
|
-
to_s.demodulize.underscore.gsub('_component', '')
|
36
|
+
to_s.demodulize.to_s.underscore.gsub('_component', '')
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.active?
|
40
|
+
BiovisionComponent[slug]&.active?
|
33
41
|
end
|
34
42
|
|
35
43
|
# Receive component-specific handler by class name for component.
|
@@ -47,72 +55,32 @@ module Biovision
|
|
47
55
|
handler_name.safe_constantize || BaseComponent
|
48
56
|
end
|
49
57
|
|
50
|
-
#
|
51
|
-
def self.
|
58
|
+
# Model list for automatic role creation
|
59
|
+
def self.dependent_models
|
52
60
|
[]
|
53
61
|
end
|
54
62
|
|
55
|
-
|
56
|
-
|
57
|
-
return false if user.nil? || user.banned?
|
58
|
-
return true if user.super_user?
|
59
|
-
|
60
|
-
BiovisionComponentUser.owned_by(user).each do |link|
|
61
|
-
return true if link.administrator? || !link.data['privileges'].blank?
|
62
|
-
end
|
63
|
-
|
64
|
-
false
|
63
|
+
def self.create
|
64
|
+
BiovisionComponent.create(slug: slug, settings: default_settings)
|
65
65
|
end
|
66
66
|
|
67
|
-
# @param [
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
criteria = { biovision_component: @component, user: user }
|
79
|
-
@user_link = BiovisionComponentUser.new(criteria)
|
80
|
-
@user_link.save if force_create
|
81
|
-
end
|
82
|
-
|
83
|
-
@user_link
|
84
|
-
end
|
85
|
-
|
86
|
-
def use_parameters?
|
87
|
-
false
|
67
|
+
# @param [ApplicationRecord] entity
|
68
|
+
# @param [Symbol|nil] scope
|
69
|
+
# @param [Hash] options
|
70
|
+
def self.form_options(entity, scope = :admin, options = {})
|
71
|
+
table_name = entity.class.table_name
|
72
|
+
prefix = scope.nil? ? '' : "/#{scope}"
|
73
|
+
{
|
74
|
+
model: scope.nil? ? entity : [scope, entity],
|
75
|
+
id: "#{entity.class.to_s.underscore}-form",
|
76
|
+
data: { check_url: "#{prefix}/#{table_name}/check" }
|
77
|
+
}.merge(options)
|
88
78
|
end
|
89
79
|
|
90
80
|
def use_settings?
|
91
81
|
use_parameters? || @component.settings.any?
|
92
82
|
end
|
93
83
|
|
94
|
-
def administrator?
|
95
|
-
return false if user.nil?
|
96
|
-
|
97
|
-
user.super_user? || @user_link&.administrator?
|
98
|
-
end
|
99
|
-
|
100
|
-
# @param [String|Array] privileges
|
101
|
-
def allow?(*privileges)
|
102
|
-
return false if user.nil?
|
103
|
-
return true if administrator? || (component.nil? && privileges.blank?)
|
104
|
-
return false if @user_link.nil?
|
105
|
-
|
106
|
-
result = privileges.blank?
|
107
|
-
privileges.flatten.each { |slug| result |= privilege?(slug) }
|
108
|
-
result
|
109
|
-
end
|
110
|
-
|
111
|
-
# @param [String] privilege_name
|
112
|
-
def privilege?(privilege_name)
|
113
|
-
privilege_handler.privilege?(privilege_name)
|
114
|
-
end
|
115
|
-
|
116
84
|
# @param [Hash] data
|
117
85
|
def settings=(data)
|
118
86
|
@component.settings.merge!(self.class.normalize_settings(data))
|
@@ -123,40 +91,10 @@ module Biovision
|
|
123
91
|
@component.settings
|
124
92
|
end
|
125
93
|
|
126
|
-
# Receive parameter value with default
|
127
|
-
#
|
128
|
-
# Returns value of component's parameter or default value
|
129
|
-
# when it's not found
|
130
|
-
#
|
131
|
-
# @param [String] key
|
132
|
-
# @param [String] default
|
133
|
-
# @return [String]
|
134
|
-
def receive(key, default = '')
|
135
|
-
@component.get(key, default)
|
136
|
-
end
|
137
|
-
|
138
|
-
# Receive parameter value or nil
|
139
|
-
#
|
140
|
-
# Returns value of component's parameter of nil when it's not found
|
141
|
-
#
|
142
|
-
# @param [String] key
|
143
|
-
# @return [String]
|
144
|
-
def [](key)
|
145
|
-
@component.get(key)
|
146
|
-
end
|
147
|
-
|
148
|
-
# Set parameter
|
149
|
-
#
|
150
|
-
# @param [String] key
|
151
|
-
# @param [String] value
|
152
|
-
def []=(key, value)
|
153
|
-
@component[key] = value unless key.blank?
|
154
|
-
end
|
155
|
-
|
156
94
|
# @param [String] name
|
157
95
|
# @param [Integer] quantity
|
158
96
|
def register_metric(name, quantity = 1)
|
159
|
-
metric = Metric
|
97
|
+
metric = Metric[name]
|
160
98
|
if metric.nil?
|
161
99
|
attributes = {
|
162
100
|
biovision_component: @component,
|
@@ -169,8 +107,38 @@ module Biovision
|
|
169
107
|
metric << quantity
|
170
108
|
end
|
171
109
|
|
172
|
-
|
173
|
-
|
110
|
+
# @param [User] user
|
111
|
+
# @param [String] code_type
|
112
|
+
# @param [Integer] quantity
|
113
|
+
def find_or_create_code(user, code_type, quantity = 1)
|
114
|
+
@component.find_or_create_code(user, code_type, quantity)
|
115
|
+
end
|
116
|
+
|
117
|
+
# @param [String|Symbol] key
|
118
|
+
# @param default_value
|
119
|
+
def data_value(key, default_value = '')
|
120
|
+
data = user.component_data(slug)
|
121
|
+
data.key?(key.to_s) ? data[key.to_s] : default_value
|
122
|
+
end
|
123
|
+
|
124
|
+
# @param [String|Symbol] key
|
125
|
+
# @param new_value
|
126
|
+
def update_data_value(key, new_value)
|
127
|
+
data = user.component_data(slug)
|
128
|
+
data[key.to_s] = new_value
|
129
|
+
user.new_component_data(data)
|
130
|
+
end
|
131
|
+
|
132
|
+
# @param [ApplicationRecord] entity
|
133
|
+
# @param [Hash] new_attributes
|
134
|
+
def update_entity(entity, new_attributes)
|
135
|
+
entity.update(new_attributes)
|
136
|
+
end
|
137
|
+
|
138
|
+
# @param [Class] model_class
|
139
|
+
# @param [Hash] parameters
|
140
|
+
def new_entity(model_class, parameters)
|
141
|
+
model_class.new(parameters)
|
174
142
|
end
|
175
143
|
end
|
176
144
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
# Contact and feedback
|
6
|
+
class ContactComponent < BaseComponent
|
7
|
+
SETTING_FEEDBACK_MAIL = 'feedback_email'
|
8
|
+
|
9
|
+
def self.settings_strings
|
10
|
+
[SETTING_FEEDBACK_MAIL]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.default_settings
|
14
|
+
{ SETTING_FEEDBACK_MAIL => '' }
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.dependent_models
|
18
|
+
[FeedbackMessage, FeedbackResponse, ContactType, ContactMethod]
|
19
|
+
end
|
20
|
+
|
21
|
+
def use_parameters?
|
22
|
+
true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Receiver for OEmbed-wrapped content
|
4
|
+
module Biovision
|
5
|
+
module Components
|
6
|
+
module Content
|
7
|
+
module Oembed
|
8
|
+
# Default receiver for embedded media
|
9
|
+
class Receiver
|
10
|
+
PATTERN = %r{<oembed url="([^"]+)"></oembed>}
|
11
|
+
|
12
|
+
# @param [String] url
|
13
|
+
def initialize(url = '')
|
14
|
+
@url = url
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param [String] url
|
18
|
+
def self.[](url)
|
19
|
+
host = URI.parse(url).host
|
20
|
+
slug = OembedDomain[host]&.receiver_slug
|
21
|
+
receiver_path = "biovision/components/content/oembed/#{slug}_receiver"
|
22
|
+
receiver_class = receiver_path.classify.safe_constantize
|
23
|
+
|
24
|
+
receiver_class.nil? ? new(url) : receiver_class.new(url)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] text
|
28
|
+
def self.convert(text)
|
29
|
+
text.gsub(PATTERN) do |fragment|
|
30
|
+
url = fragment.match(PATTERN)[1].to_s
|
31
|
+
return '' if url.blank?
|
32
|
+
|
33
|
+
receiver = self[url]
|
34
|
+
receiver.code
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.slug
|
39
|
+
to_s.demodulize.to_s.underscore.gsub('_receiver', '')
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.domains
|
43
|
+
%w[]
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.seed
|
47
|
+
receiver_entity = OembedReceiver.find_or_create_by(slug: slug)
|
48
|
+
domains.each do |domain|
|
49
|
+
receiver_entity.oembed_domains.create(name: domain)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def code
|
54
|
+
@link = OembedLink[@url]
|
55
|
+
@link.code || receive_and_update
|
56
|
+
end
|
57
|
+
|
58
|
+
def fallback
|
59
|
+
attributes = %(rel="external nofollow noreferrer" target="_blank")
|
60
|
+
%(<a href="#{@url}" #{attributes}>#{URI.parse(@url).host}</a>)
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def receive_and_update
|
66
|
+
code = receive(code_url)
|
67
|
+
@link.code = code
|
68
|
+
@link.save
|
69
|
+
|
70
|
+
code
|
71
|
+
end
|
72
|
+
|
73
|
+
# @param [String] embed_url
|
74
|
+
def receive(embed_url)
|
75
|
+
response = RestClient.get(embed_url)
|
76
|
+
parse(response.body)
|
77
|
+
rescue RestClient::Exception => e
|
78
|
+
Rails.logger.warn("Cannot receive data for #{embed_url}: #{e}")
|
79
|
+
fallback
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param [String] response
|
83
|
+
def parse(response)
|
84
|
+
json = JSON.parse(response)
|
85
|
+
json['html'] || fallback
|
86
|
+
rescue JSON::ParserError => e
|
87
|
+
Rails.logger.warn("Cannot parse response #{response}: #{e}")
|
88
|
+
fallback
|
89
|
+
end
|
90
|
+
|
91
|
+
def code_url
|
92
|
+
"https://#{@host}/oembed?url=#{CGI.escape(@url)}&format=json"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
module Content
|
6
|
+
module Oembed
|
7
|
+
# OEmbed receiver for Twitter
|
8
|
+
class TwitterReceiver < Receiver
|
9
|
+
def code_url
|
10
|
+
"https://publish.twitter.com/oembed?url=#{CGI.escape(@url)}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.domains
|
14
|
+
%w[twitter.com www.twitter.com]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
module Content
|
6
|
+
module Oembed
|
7
|
+
# OEmbed receiver for vimeo.com
|
8
|
+
class VimeoReceiver < Receiver
|
9
|
+
def code_url
|
10
|
+
"https://vimeo.com/api/oembed.json?url=#{CGI.escape(@url)}&responsive=true"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.domains
|
14
|
+
%w[www.vimeo.com vimeo.com]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
module Content
|
6
|
+
module Oembed
|
7
|
+
# OEmbed receiver for YouTube
|
8
|
+
class YoutubeReceiver < Receiver
|
9
|
+
def code_url
|
10
|
+
"https://www.youtube.com/oembed?url=#{CGI.escape(@url)}&format=json"
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.domains
|
14
|
+
%w[www.youtube.com youtube.com youtu.be]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
# Content
|
6
|
+
class ContentComponent < BaseComponent
|
7
|
+
def self.dependent_models
|
8
|
+
[
|
9
|
+
DynamicPage, NavigationGroup, NavigationGroupPage, DynamicBlock,
|
10
|
+
OembedReceiver, OembedDomain, OembedLink
|
11
|
+
]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.seed
|
15
|
+
[
|
16
|
+
Biovision::Components::Content::Oembed::VimeoReceiver,
|
17
|
+
Biovision::Components::Content::Oembed::YoutubeReceiver,
|
18
|
+
Biovision::Components::Content::Oembed::TwitterReceiver
|
19
|
+
].each(&:seed)
|
20
|
+
end
|
21
|
+
|
22
|
+
def use_parameters?
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def use_images?
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def crud_table_names
|
31
|
+
super - %w[navigation_group_pages oembed_receivers oembed_domains]
|
32
|
+
end
|
33
|
+
|
34
|
+
def administrative_parts
|
35
|
+
%w[navigation_groups dynamic_blocks dynamic_pages oembed_links]
|
36
|
+
end
|
37
|
+
|
38
|
+
def navigation
|
39
|
+
@navigation ||= prepare_navigation
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def prepare_navigation
|
45
|
+
result = {}
|
46
|
+
NavigationGroup.connection.execute(grouped_links_query).each do |row|
|
47
|
+
result[row['slug']] = [] unless result.key?(row['slug'])
|
48
|
+
result[row['slug']] << { text: row['name'], url: row['url'] }
|
49
|
+
end
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
53
|
+
def grouped_links_query
|
54
|
+
<<~SQL
|
55
|
+
select g.slug, p.name, p.url
|
56
|
+
from "#{NavigationGroupPage.table_name}" gp
|
57
|
+
join "#{NavigationGroup.table_name}" g on gp.navigation_group_id = g.id
|
58
|
+
join "#{DynamicPage.table_name}" p on gp.dynamic_page_id = p.id
|
59
|
+
where p.visible = true
|
60
|
+
order by g.slug asc, gp.priority asc
|
61
|
+
SQL
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -11,18 +11,20 @@ module Biovision
|
|
11
11
|
let_user_in?
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
private
|
15
15
|
|
16
16
|
def let_user_in?
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
if user.nil? || user.banned?
|
18
|
+
register_failure && false
|
19
|
+
else
|
20
|
+
too_many_attempts? ? (log_attempt && false) : try_password
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
def too_many_attempts?
|
23
|
-
timeout = settings[
|
24
|
-
limit = settings[
|
25
|
-
LoginAttempt.owned_by(user).since(timeout).count > limit
|
25
|
+
timeout = settings[self.class::SETTING_BOUNCE_TIMEOUT].to_i.abs
|
26
|
+
limit = settings[self.class::SETTING_BOUNCE_COUNT].to_i
|
27
|
+
LoginAttempt.owned_by(user).since(timeout.minutes.ago).count > limit
|
26
28
|
end
|
27
29
|
|
28
30
|
def log_attempt
|
@@ -35,12 +37,18 @@ module Biovision
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def count_attempt
|
40
|
+
register_failure
|
38
41
|
log_attempt
|
39
42
|
return unless too_many_attempts?
|
40
43
|
|
41
44
|
notifier = Biovision::Notifiers::UsersNotifier.new(user)
|
42
45
|
notifier.new_login_attempt(@track)
|
43
46
|
end
|
47
|
+
|
48
|
+
def register_failure
|
49
|
+
metric = Biovision::Components::UsersComponent::METRIC_AUTH_FAILURE
|
50
|
+
register_metric(metric)
|
51
|
+
end
|
44
52
|
end
|
45
53
|
end
|
46
54
|
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
module Users
|
6
|
+
# Handling user-related codes
|
7
|
+
module Codes
|
8
|
+
# @param [Code] code
|
9
|
+
# @param [String] code_type
|
10
|
+
def valid_code?(code, code_type)
|
11
|
+
return false if code.nil? || code.biovision_component != @component
|
12
|
+
|
13
|
+
code.type?(code_type) && code.active?
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param [Code] code
|
17
|
+
def valid_email_confirmation?(code)
|
18
|
+
return false if code.nil? || code.biovision_component != @component
|
19
|
+
return false unless code.active?
|
20
|
+
|
21
|
+
code_type = self.class::CODE_EMAIL_CONFIRMATION
|
22
|
+
code.type?(code_type) && code.data['email'] == user.email
|
23
|
+
end
|
24
|
+
|
25
|
+
# @param [Code] code
|
26
|
+
def valid_invitation?(code)
|
27
|
+
valid_code?(code, self.class::CODE_INVITATION)
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [Code] code
|
31
|
+
def valid_recovery?(code)
|
32
|
+
valid_code?(code, self.class::CODE_RECOVERY)
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param [User] user
|
36
|
+
def create_email_confirmation(user)
|
37
|
+
code_type = self.class::CODE_EMAIL_CONFIRMATION
|
38
|
+
code = @component.codes.new(user: user, code_type: code_type)
|
39
|
+
code.data['email'] = user.email
|
40
|
+
code.save
|
41
|
+
code
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [User] user
|
45
|
+
def create_phone_confirmation(user)
|
46
|
+
code_type = self.class::CODE_PHONE_CONFIRMATION
|
47
|
+
code = @component.codes.new(user: user, code_type: code_type)
|
48
|
+
code.data['phone'] = user.phone
|
49
|
+
code.save
|
50
|
+
code
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param [User] user
|
54
|
+
def send_email_confirmation(user)
|
55
|
+
code_type = self.class::CODE_EMAIL_CONFIRMATION
|
56
|
+
codes = @component.codes.active.owned_by(user).with_type(code_type)
|
57
|
+
code = codes.find_by("data->>'email' = ?", user.email)
|
58
|
+
code = create_email_confirmation(user) if code.nil?
|
59
|
+
|
60
|
+
CodeSender.email(code.id).deliver_later
|
61
|
+
end
|
62
|
+
|
63
|
+
# @param [User] user
|
64
|
+
def send_phone_confirmation(user)
|
65
|
+
code_type = self.class::CODE_PHONE_CONFIRMATION
|
66
|
+
codes = @component.codes.active.owned_by(user).with_type(code_type)
|
67
|
+
code = codes.find_by("data->>'phone' = ?", user.email)
|
68
|
+
code = create_phone_confirmation(user) if code.nil?
|
69
|
+
|
70
|
+
SendPhoneConfirmationJob.perform_later(code.id)
|
71
|
+
end
|
72
|
+
|
73
|
+
# @param [Code] code
|
74
|
+
def activate_email_confirmation(code)
|
75
|
+
return unless valid_email_confirmation?(code)
|
76
|
+
|
77
|
+
code.user.update(email_confirmed: true)
|
78
|
+
end
|
79
|
+
|
80
|
+
# @param [Code] code
|
81
|
+
# @param [User] user
|
82
|
+
def activate_invitation(code, user)
|
83
|
+
return if code.nil? || !code.active? || user.nil?
|
84
|
+
|
85
|
+
code.decrement!(:quantity)
|
86
|
+
user.update(inviter_id: code.user_id)
|
87
|
+
|
88
|
+
register_metric(self.class::METRIC_USED_INVITATION)
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param [User] user
|
92
|
+
def create_invitations_for_user(user)
|
93
|
+
quantity = settings[self.class::SETTING_INVITE_COUNT].to_i
|
94
|
+
|
95
|
+
return if quantity < 1
|
96
|
+
|
97
|
+
code = @component.codes.new(user: user, quantity: quantity)
|
98
|
+
code.code_type = self.class::CODE_INVITATION
|
99
|
+
code.save
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Biovision
|
4
|
+
module Components
|
5
|
+
module Users
|
6
|
+
# Helper methods for checking user flags
|
7
|
+
module FlagHelpers
|
8
|
+
def needs_email_confirmation?
|
9
|
+
return false if user&.email_confirmed?
|
10
|
+
|
11
|
+
confirm_email? && !user.email.blank?
|
12
|
+
end
|
13
|
+
|
14
|
+
def needs_phone_confirmation?
|
15
|
+
return false if user&.phone_confirmed?
|
16
|
+
|
17
|
+
confirm_phone? && !user.phone.blank?
|
18
|
+
end
|
19
|
+
|
20
|
+
def registration_open?
|
21
|
+
key = Biovision::Components::UsersComponent::SETTING_OPEN
|
22
|
+
settings[key]
|
23
|
+
end
|
24
|
+
|
25
|
+
def email_as_login?
|
26
|
+
key = Biovision::Components::UsersComponent::SETTING_EMAIL_AS_LOGIN
|
27
|
+
settings[key]
|
28
|
+
end
|
29
|
+
|
30
|
+
def phone_as_login?
|
31
|
+
key = Biovision::Components::UsersComponent::SETTING_PHONE_AS_LOGIN
|
32
|
+
settings[key]
|
33
|
+
end
|
34
|
+
|
35
|
+
def require_email?
|
36
|
+
key = Biovision::Components::UsersComponent::SETTING_REQUIRE_EMAIL
|
37
|
+
settings[key] || email_as_login?
|
38
|
+
end
|
39
|
+
|
40
|
+
def require_phone?
|
41
|
+
key = Biovision::Components::UsersComponent::SETTING_REQUIRE_PHONE
|
42
|
+
settings[key] || phone_as_login?
|
43
|
+
end
|
44
|
+
|
45
|
+
def confirm_email?
|
46
|
+
key = Biovision::Components::UsersComponent::SETTING_CONFIRM_EMAIL
|
47
|
+
settings[key]
|
48
|
+
end
|
49
|
+
|
50
|
+
def confirm_phone?
|
51
|
+
key = Biovision::Components::UsersComponent::SETTING_CONFIRM_PHONE
|
52
|
+
settings[key]
|
53
|
+
end
|
54
|
+
|
55
|
+
def invite_only?
|
56
|
+
key = Biovision::Components::UsersComponent::SETTING_INVITE_ONLY
|
57
|
+
settings[key]
|
58
|
+
end
|
59
|
+
|
60
|
+
def use_invites?
|
61
|
+
key = Biovision::Components::UsersComponent::SETTING_USE_INVITES
|
62
|
+
settings[key] || invite_only?
|
63
|
+
end
|
64
|
+
|
65
|
+
def use_phone?
|
66
|
+
key = Biovision::Components::UsersComponent::SETTING_USE_PHONE
|
67
|
+
settings[key]
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|