anoubis 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +38 -0
- data/app/controllers/anoubis/application_controller.rb +78 -0
- data/app/controllers/anoubis/core/application_controller.rb +343 -0
- data/app/controllers/anoubis/core/data/actions.rb +962 -0
- data/app/controllers/anoubis/core/data/callbacks.rb +68 -0
- data/app/controllers/anoubis/core/data/convert.rb +407 -0
- data/app/controllers/anoubis/core/data/defaults.rb +217 -0
- data/app/controllers/anoubis/core/data/get.rb +531 -0
- data/app/controllers/anoubis/core/data/load.rb +89 -0
- data/app/controllers/anoubis/core/data/set.rb +49 -0
- data/app/controllers/anoubis/core/data/setup.rb +104 -0
- data/app/controllers/anoubis/core/data_controller.rb +28 -0
- data/app/controllers/anoubis/core/index/actions.rb +53 -0
- data/app/controllers/anoubis/core/index/callbacks.rb +23 -0
- data/app/controllers/anoubis/core/index_controller.rb +36 -0
- data/app/controllers/anoubis/etc/base.rb +52 -0
- data/app/controllers/anoubis/etc/data.rb +89 -0
- data/app/controllers/anoubis/etc/field.rb +468 -0
- data/app/controllers/anoubis/etc/field_options.rb +83 -0
- data/app/controllers/anoubis/etc/field_order.rb +51 -0
- data/app/controllers/anoubis/etc/filter.rb +251 -0
- data/app/controllers/anoubis/etc/menu.rb +101 -0
- data/app/controllers/anoubis/etc/model.rb +67 -0
- data/app/controllers/anoubis/etc/tab_item.rb +91 -0
- data/app/controllers/anoubis/etc.rb +8 -0
- data/app/controllers/anoubis/export.rb +47 -0
- data/app/controllers/anoubis/output/autocomplete.rb +30 -0
- data/app/controllers/anoubis/output/basic.rb +86 -0
- data/app/controllers/anoubis/output/data.rb +101 -0
- data/app/controllers/anoubis/output/delete.rb +41 -0
- data/app/controllers/anoubis/output/edit.rb +55 -0
- data/app/controllers/anoubis/output/frame.rb +227 -0
- data/app/controllers/anoubis/output/login.rb +71 -0
- data/app/controllers/anoubis/output/menu.rb +220 -0
- data/app/controllers/anoubis/output/update.rb +43 -0
- data/app/controllers/anoubis/sso/client/application_controller.rb +139 -0
- data/app/controllers/anoubis/sso/client/data/actions.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/callbacks.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/convert.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/defaults.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/get.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/load.rb +26 -0
- data/app/controllers/anoubis/sso/client/data/set.rb +5 -0
- data/app/controllers/anoubis/sso/client/data/setup.rb +5 -0
- data/app/controllers/anoubis/sso/client/data_controller.rb +21 -0
- data/app/controllers/anoubis/sso/client/index/actions.rb +79 -0
- data/app/controllers/anoubis/sso/client/index/callbacks.rb +13 -0
- data/app/controllers/anoubis/sso/client/index_controller.rb +18 -0
- data/app/controllers/anoubis/sso/server/application_controller.rb +49 -0
- data/app/controllers/anoubis/sso/server/login_controller.rb +342 -0
- data/app/controllers/anoubis/sso/server/user_controller.rb +142 -0
- data/app/controllers/anoubis/tenant/application_controller.rb +54 -0
- data/app/controllers/anoubis/tenant/data/actions.rb +11 -0
- data/app/controllers/anoubis/tenant/data/callbacks.rb +11 -0
- data/app/controllers/anoubis/tenant/data/convert.rb +11 -0
- data/app/controllers/anoubis/tenant/data/defaults.rb +11 -0
- data/app/controllers/anoubis/tenant/data/get.rb +11 -0
- data/app/controllers/anoubis/tenant/data/load.rb +52 -0
- data/app/controllers/anoubis/tenant/data/set.rb +11 -0
- data/app/controllers/anoubis/tenant/data/setup.rb +11 -0
- data/app/controllers/anoubis/tenant/data_controller.rb +28 -0
- data/app/controllers/anoubis/tenant/index/actions.rb +191 -0
- data/app/controllers/anoubis/tenant/index/callbacks.rb +11 -0
- data/app/controllers/anoubis/tenant/index_controller.rb +38 -0
- data/app/controllers/anoubis/tenants_controller.rb +7 -0
- data/app/controllers/anoubis/users_controller.rb +7 -0
- data/app/jobs/anoubis/application_job.rb +6 -0
- data/app/mailers/anoubis/application_mailer.rb +8 -0
- data/app/models/anoubis/application_record.rb +45 -0
- data/app/models/anoubis/core/application_record.rb +250 -0
- data/app/models/anoubis/core/locales.rb +27 -0
- data/app/models/anoubis/sso/client/application_record.rb +3 -0
- data/app/models/anoubis/sso/client/group.rb +19 -0
- data/app/models/anoubis/sso/client/group_menu.rb +109 -0
- data/app/models/anoubis/sso/client/menu.rb +145 -0
- data/app/models/anoubis/sso/client/user.rb +81 -0
- data/app/models/anoubis/sso/client/user_group.rb +32 -0
- data/app/models/anoubis/sso/server/system.rb +36 -0
- data/app/models/anoubis/sso/server/user.rb +79 -0
- data/app/models/anoubis/tenant/application_record.rb +41 -0
- data/app/models/anoubis/tenant/group.rb +95 -0
- data/app/models/anoubis/tenant/group_locale.rb +19 -0
- data/app/models/anoubis/tenant/group_menu.rb +84 -0
- data/app/models/anoubis/tenant/menu.rb +156 -0
- data/app/models/anoubis/tenant/menu_locale.rb +27 -0
- data/app/models/anoubis/tenant/system.rb +127 -0
- data/app/models/anoubis/tenant/system_locale.rb +19 -0
- data/app/models/anoubis/tenant/system_menu.rb +51 -0
- data/app/models/anoubis/tenant/tenant.rb +107 -0
- data/app/models/anoubis/tenant/tenant_system.rb +19 -0
- data/app/models/anoubis/tenant/user.rb +225 -0
- data/app/models/anoubis/tenant/user_group.rb +32 -0
- data/app/services/anoubis/core_service.rb +16 -0
- data/app/services/anoubis/session_service.rb +17 -0
- data/app/validators/presence_in_tenant_validator.rb +20 -0
- data/config/initializers/mime_type.rb +1 -0
- data/config/locales/en.yml +120 -0
- data/config/locales/ru.yml +245 -0
- data/config/routes.rb +74 -0
- data/db/migrate/20181018085843_create_tenants.rb +13 -0
- data/db/migrate/20181018111217_create_systems.rb +10 -0
- data/db/migrate/20181018111713_create_tenant_systems.rb +11 -0
- data/db/migrate/20181018111925_create_groups.rb +13 -0
- data/db/migrate/20181018112151_create_users.rb +25 -0
- data/db/migrate/20181018115737_add_title_to_users.rb +10 -0
- data/db/migrate/20181022060211_create_menus.rb +18 -0
- data/db/migrate/20181115055245_create_group_menus.rb +12 -0
- data/db/migrate/20181115060830_create_system_menus.rb +11 -0
- data/db/migrate/20181122062131_create_user_groups.rb +11 -0
- data/db/migrate/20181221060727_create_menu_locales.rb +14 -0
- data/db/migrate/20181225062303_create_system_locales.rb +11 -0
- data/db/migrate/20181225062339_create_group_locales.rb +11 -0
- data/db/seeds.rb +268 -0
- data/lib/anoubis/engine.rb +13 -0
- data/lib/anoubis/version.rb +5 -0
- data/lib/anoubis.rb +213 -0
- data/lib/tasks/anubis_tasks.rake +10 -0
- data/lib/tasks/sessions/clear_sessions.rake +10 -0
- data/spec/anubis_spec.rb +5 -0
- data/spec/controllers/anoubis/index_controller_spec.rb +77 -0
- data/spec/dummy/Rakefile +3 -0
- data/spec/dummy/app/assets/config/manifest.js +2 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +33 -0
- data/spec/dummy/bin/update +28 -0
- data/spec/dummy/config/application.rb +14 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +54 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +54 -0
- data/spec/dummy/config/environments/production.rb +85 -0
- data/spec/dummy/config/environments/test.rb +46 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cors.rb +16 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/db/schema.rb +167 -0
- data/spec/dummy/db/seeds.rb +1 -0
- data/spec/factories/anubis_group_locales.rb +7 -0
- data/spec/factories/anubis_group_menus.rb +7 -0
- data/spec/factories/anubis_groups.rb +6 -0
- data/spec/factories/anubis_menu_locales.rb +9 -0
- data/spec/factories/anubis_menus.rb +6 -0
- data/spec/factories/anubis_system_locales.rb +7 -0
- data/spec/factories/anubis_system_menus.rb +6 -0
- data/spec/factories/anubis_systems.rb +5 -0
- data/spec/factories/anubis_tenants.rb +7 -0
- data/spec/factories/anubis_users.rb +10 -0
- data/spec/integration/navigation_test.rb +7 -0
- data/spec/models/anoubis/group_locale_spec.rb +25 -0
- data/spec/models/anoubis/group_menu_spec.rb +50 -0
- data/spec/models/anoubis/group_spec.rb +52 -0
- data/spec/models/anoubis/menu_locale_spec.rb +31 -0
- data/spec/models/anoubis/menu_spec.rb +48 -0
- data/spec/models/anoubis/system_locale_spec.rb +20 -0
- data/spec/models/anoubis/system_menu_spec.rb +49 -0
- data/spec/models/anoubis/system_spec.rb +53 -0
- data/spec/models/anoubis/tenant_spec.rb +67 -0
- data/spec/models/anoubis/user_spec.rb +57 -0
- data/spec/rails_helper.rb +32 -0
- data/spec/requests/anoubis/users_request_spec.rb +5 -0
- data/spec/spec_helper.rb +13 -0
- metadata +408 -0
@@ -0,0 +1,85 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
18
|
+
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
19
|
+
# config.require_master_key = true
|
20
|
+
|
21
|
+
# Disable serving static files from the `/public` folder by default since
|
22
|
+
# Apache or NGINX already handles this.
|
23
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
24
|
+
|
25
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
26
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
27
|
+
|
28
|
+
# Specifies the header that your server uses for sending files.
|
29
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
30
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
31
|
+
|
32
|
+
# Store uploaded files on the local file system (see config/storage.yml for options)
|
33
|
+
config.active_storage.service = :local
|
34
|
+
|
35
|
+
# Mount Action Cable outside main process or domain
|
36
|
+
# config.action_cable.mount_path = nil
|
37
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
38
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
39
|
+
|
40
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
41
|
+
# config.force_ssl = true
|
42
|
+
|
43
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
44
|
+
# when problems arise.
|
45
|
+
config.log_level = :debug
|
46
|
+
|
47
|
+
# Prepend all log lines with the following tags.
|
48
|
+
config.log_tags = [ :request_id ]
|
49
|
+
|
50
|
+
# Use a different cache store in production.
|
51
|
+
# config.cache_store = :mem_cache_store
|
52
|
+
|
53
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
54
|
+
# config.active_job.queue_adapter = :resque
|
55
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
56
|
+
|
57
|
+
config.action_mailer.perform_caching = false
|
58
|
+
|
59
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
60
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
61
|
+
# config.action_mailer.raise_delivery_errors = false
|
62
|
+
|
63
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
64
|
+
# the I18n.default_locale when a translation cannot be found).
|
65
|
+
config.i18n.fallbacks = true
|
66
|
+
|
67
|
+
# Send deprecation notices to registered listeners.
|
68
|
+
config.active_support.deprecation = :notify
|
69
|
+
|
70
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
71
|
+
config.log_formatter = ::Logger::Formatter.new
|
72
|
+
|
73
|
+
# Use a different logger for distributed setups.
|
74
|
+
# require 'syslog/logger'
|
75
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
76
|
+
|
77
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
78
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
79
|
+
logger.formatter = config.log_formatter
|
80
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Do not dump schema after migrations.
|
84
|
+
config.active_record.dump_schema_after_migration = false
|
85
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure public file server for tests with Cache-Control for performance.
|
16
|
+
config.public_file_server.enabled = true
|
17
|
+
config.public_file_server.headers = {
|
18
|
+
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
|
19
|
+
}
|
20
|
+
|
21
|
+
# Show full error reports and disable caching.
|
22
|
+
config.consider_all_requests_local = true
|
23
|
+
config.action_controller.perform_caching = false
|
24
|
+
|
25
|
+
# Raise exceptions instead of rendering exception templates.
|
26
|
+
config.action_dispatch.show_exceptions = false
|
27
|
+
|
28
|
+
# Disable request forgery protection in test environment.
|
29
|
+
config.action_controller.allow_forgery_protection = false
|
30
|
+
|
31
|
+
# Store uploaded files on the local file system in a temporary directory
|
32
|
+
config.active_storage.service = :test
|
33
|
+
|
34
|
+
config.action_mailer.perform_caching = false
|
35
|
+
|
36
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
37
|
+
# The :test delivery method accumulates sent emails in the
|
38
|
+
# ActionMailer::Base.deliveries array.
|
39
|
+
config.action_mailer.delivery_method = :test
|
40
|
+
|
41
|
+
# Print deprecation notices to the stderr.
|
42
|
+
config.active_support.deprecation = :stderr
|
43
|
+
|
44
|
+
# Raises error for missing translations
|
45
|
+
# config.action_view.raise_on_missing_translations = true
|
46
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Avoid CORS issues when API is called from the frontend app.
|
4
|
+
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
|
5
|
+
|
6
|
+
# Read more: https://github.com/cyu/rack-cors
|
7
|
+
|
8
|
+
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
9
|
+
# allow do
|
10
|
+
# origins 'example.com'
|
11
|
+
#
|
12
|
+
# resource '*',
|
13
|
+
# headers: :any,
|
14
|
+
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
15
|
+
# end
|
16
|
+
# end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json]
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# The following keys must be escaped otherwise they will not be retrieved by
|
20
|
+
# the default I18n backend:
|
21
|
+
#
|
22
|
+
# true, false, on, off, yes, no
|
23
|
+
#
|
24
|
+
# Instead, surround them with single quotes.
|
25
|
+
#
|
26
|
+
# en:
|
27
|
+
# 'true': 'foo'
|
28
|
+
#
|
29
|
+
# To learn more, please read the Rails Internationalization guide
|
30
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
31
|
+
|
32
|
+
en:
|
33
|
+
hello: "Hello world"
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Puma can serve each request in a thread from an internal thread pool.
|
2
|
+
# The `threads` method setting takes two numbers: a minimum and maximum.
|
3
|
+
# Any libraries that use thread pools should be configured to match
|
4
|
+
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
5
|
+
# and maximum; this matches the default thread size of Active Record.
|
6
|
+
#
|
7
|
+
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
8
|
+
threads threads_count, threads_count
|
9
|
+
|
10
|
+
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
11
|
+
#
|
12
|
+
port ENV.fetch("PORT") { 3000 }
|
13
|
+
|
14
|
+
# Specifies the `environment` that Puma will run in.
|
15
|
+
#
|
16
|
+
environment ENV.fetch("RAILS_ENV") { "development" }
|
17
|
+
|
18
|
+
# Specifies the number of `workers` to boot in clustered mode.
|
19
|
+
# Workers are forked webserver processes. If using threads and workers together
|
20
|
+
# the concurrency of the application would be max `threads` * `workers`.
|
21
|
+
# Workers do not work on JRuby or Windows (both of which do not support
|
22
|
+
# processes).
|
23
|
+
#
|
24
|
+
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
|
25
|
+
|
26
|
+
# Use the `preload_app!` method when specifying a `workers` number.
|
27
|
+
# This directive tells Puma to first boot the application and load code
|
28
|
+
# before forking the application. This takes advantage of Copy On Write
|
29
|
+
# process behavior so workers use less memory.
|
30
|
+
#
|
31
|
+
# preload_app!
|
32
|
+
|
33
|
+
# Allow puma to be restarted by `rails restart` command.
|
34
|
+
plugin :tmp_restart
|
@@ -0,0 +1,34 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket
|
23
|
+
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# storage_account_name: your_account_name
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
29
|
+
# container: your_container_name
|
30
|
+
|
31
|
+
# mirror:
|
32
|
+
# service: Mirror
|
33
|
+
# primary: local
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
@@ -0,0 +1,167 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 2018_12_25_062339) do
|
14
|
+
|
15
|
+
create_table "group_locales", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
16
|
+
t.bigint "group_id"
|
17
|
+
t.string "title", limit: 100
|
18
|
+
t.integer "locale"
|
19
|
+
t.datetime "created_at", null: false
|
20
|
+
t.datetime "updated_at", null: false
|
21
|
+
t.index ["group_id"], name: "index_group_locales_on_group_id"
|
22
|
+
end
|
23
|
+
|
24
|
+
create_table "group_menus", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
25
|
+
t.bigint "menu_id", default: 0
|
26
|
+
t.bigint "group_id", default: 0
|
27
|
+
t.integer "access"
|
28
|
+
t.datetime "created_at", null: false
|
29
|
+
t.datetime "updated_at", null: false
|
30
|
+
t.index ["group_id"], name: "index_group_menus_on_group_id"
|
31
|
+
t.index ["menu_id", "group_id"], name: "index_group_menus_on_menu_id_and_group_id", unique: true
|
32
|
+
t.index ["menu_id"], name: "index_group_menus_on_menu_id"
|
33
|
+
end
|
34
|
+
|
35
|
+
create_table "groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
36
|
+
t.string "ident", limit: 50
|
37
|
+
t.bigint "system_id"
|
38
|
+
t.string "full_ident", limit: 70
|
39
|
+
t.datetime "created_at", null: false
|
40
|
+
t.datetime "updated_at", null: false
|
41
|
+
t.index ["full_ident"], name: "index_groups_on_full_ident", unique: true
|
42
|
+
t.index ["ident", "system_id"], name: "index_groups_on_ident_and_system_id", unique: true
|
43
|
+
t.index ["system_id"], name: "index_groups_on_system_id"
|
44
|
+
end
|
45
|
+
|
46
|
+
create_table "menu_locales", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
47
|
+
t.bigint "menu_id"
|
48
|
+
t.integer "locale", default: 0, null: false
|
49
|
+
t.string "title", limit: 200
|
50
|
+
t.string "page_title", limit: 200
|
51
|
+
t.string "short_title", limit: 200
|
52
|
+
t.datetime "created_at", null: false
|
53
|
+
t.datetime "updated_at", null: false
|
54
|
+
t.index ["menu_id", "locale"], name: "index_menu_locales_on_menu_id_and_locale", unique: true
|
55
|
+
t.index ["menu_id"], name: "index_menu_locales_on_menu_id"
|
56
|
+
end
|
57
|
+
|
58
|
+
create_table "menus", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
59
|
+
t.string "mode", limit: 200
|
60
|
+
t.string "action", limit: 50
|
61
|
+
t.bigint "menu_id"
|
62
|
+
t.integer "tab", default: 0, null: false
|
63
|
+
t.integer "position", default: 0, null: false
|
64
|
+
t.integer "page_size", default: 0, null: false
|
65
|
+
t.integer "state", default: 0, null: false
|
66
|
+
t.integer "status", default: 0, null: false
|
67
|
+
t.datetime "created_at", null: false
|
68
|
+
t.datetime "updated_at", null: false
|
69
|
+
t.index ["menu_id"], name: "index_menus_on_menu_id"
|
70
|
+
t.index ["mode"], name: "index_menus_on_mode", unique: true
|
71
|
+
t.index ["tab"], name: "index_menus_on_tab"
|
72
|
+
end
|
73
|
+
|
74
|
+
create_table "system_locales", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
75
|
+
t.bigint "system_id"
|
76
|
+
t.string "title", limit: 100
|
77
|
+
t.integer "locale"
|
78
|
+
t.datetime "created_at", null: false
|
79
|
+
t.datetime "updated_at", null: false
|
80
|
+
t.index ["system_id"], name: "index_system_locales_on_system_id"
|
81
|
+
end
|
82
|
+
|
83
|
+
create_table "system_menus", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
84
|
+
t.bigint "system_id"
|
85
|
+
t.bigint "menu_id"
|
86
|
+
t.datetime "created_at", null: false
|
87
|
+
t.datetime "updated_at", null: false
|
88
|
+
t.index ["menu_id"], name: "index_system_menus_on_menu_id"
|
89
|
+
t.index ["system_id", "menu_id"], name: "index_system_menus_on_system_id_and_menu_id", unique: true
|
90
|
+
t.index ["system_id"], name: "index_system_menus_on_system_id"
|
91
|
+
end
|
92
|
+
|
93
|
+
create_table "systems", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
94
|
+
t.string "ident", limit: 15
|
95
|
+
t.datetime "created_at", null: false
|
96
|
+
t.datetime "updated_at", null: false
|
97
|
+
t.index ["ident"], name: "index_systems_on_ident", unique: true
|
98
|
+
end
|
99
|
+
|
100
|
+
create_table "tenant_systems", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
101
|
+
t.bigint "tenant_id"
|
102
|
+
t.bigint "system_id"
|
103
|
+
t.datetime "created_at", null: false
|
104
|
+
t.datetime "updated_at", null: false
|
105
|
+
t.index ["system_id"], name: "index_tenant_systems_on_system_id"
|
106
|
+
t.index ["tenant_id", "system_id"], name: "index_tenant_systems_on_tenant_id_and_system_id", unique: true
|
107
|
+
t.index ["tenant_id"], name: "index_tenant_systems_on_tenant_id"
|
108
|
+
end
|
109
|
+
|
110
|
+
create_table "tenants", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
111
|
+
t.string "title", limit: 100
|
112
|
+
t.string "ident", limit: 10
|
113
|
+
t.integer "state", default: 0
|
114
|
+
t.datetime "created_at", null: false
|
115
|
+
t.datetime "updated_at", null: false
|
116
|
+
t.index ["ident"], name: "index_tenants_on_ident", unique: true
|
117
|
+
t.index ["title"], name: "index_tenants_on_title", unique: true
|
118
|
+
end
|
119
|
+
|
120
|
+
create_table "user_groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
121
|
+
t.bigint "user_id"
|
122
|
+
t.bigint "group_id"
|
123
|
+
t.datetime "created_at", null: false
|
124
|
+
t.datetime "updated_at", null: false
|
125
|
+
t.index ["group_id"], name: "index_user_groups_on_group_id"
|
126
|
+
t.index ["user_id", "group_id"], name: "index_user_groups_on_user_id_and_group_id", unique: true
|
127
|
+
t.index ["user_id"], name: "index_user_groups_on_user_id"
|
128
|
+
end
|
129
|
+
|
130
|
+
create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
|
131
|
+
t.string "login", limit: 65, null: false
|
132
|
+
t.string "email", limit: 50, null: false
|
133
|
+
t.string "name", limit: 100, null: false
|
134
|
+
t.string "surname", limit: 100, null: false
|
135
|
+
t.string "timezone", limit: 30, null: false
|
136
|
+
t.integer "timeout", default: 3600, null: false
|
137
|
+
t.string "phone", limit: 30
|
138
|
+
t.string "password_digest", limit: 60, null: false
|
139
|
+
t.string "auth_key", limit: 32
|
140
|
+
t.string "recover_key", limit: 32
|
141
|
+
t.integer "status", default: 0, null: false
|
142
|
+
t.bigint "tenant_id"
|
143
|
+
t.binary "uuid_bin", limit: 16
|
144
|
+
t.datetime "created_at", null: false
|
145
|
+
t.datetime "updated_at", null: false
|
146
|
+
t.virtual "title", type: :string, limit: 250, as: "concat(`name`,' ',`surname`,' (',`email`,')')"
|
147
|
+
t.index ["email", "tenant_id"], name: "index_users_on_email_and_tenant_id", unique: true
|
148
|
+
t.index ["login"], name: "index_users_on_login", unique: true
|
149
|
+
t.index ["tenant_id"], name: "index_users_on_tenant_id"
|
150
|
+
t.index ["uuid_bin"], name: "index_users_on_uuid_bin", unique: true
|
151
|
+
end
|
152
|
+
|
153
|
+
add_foreign_key "group_locales", "groups"
|
154
|
+
add_foreign_key "group_menus", "groups"
|
155
|
+
add_foreign_key "group_menus", "menus"
|
156
|
+
add_foreign_key "groups", "systems"
|
157
|
+
add_foreign_key "menu_locales", "menus"
|
158
|
+
add_foreign_key "menus", "menus"
|
159
|
+
add_foreign_key "system_locales", "systems"
|
160
|
+
add_foreign_key "system_menus", "menus"
|
161
|
+
add_foreign_key "system_menus", "systems"
|
162
|
+
add_foreign_key "tenant_systems", "systems"
|
163
|
+
add_foreign_key "tenant_systems", "tenants"
|
164
|
+
add_foreign_key "user_groups", "groups"
|
165
|
+
add_foreign_key "user_groups", "users"
|
166
|
+
add_foreign_key "users", "tenants"
|
167
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Anoubis::Engine.load_seed
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
module Anubis
|
4
|
+
RSpec.describe GroupLocale, type: :model do
|
5
|
+
it "has short title" do
|
6
|
+
expect(build_stubbed(:group_locale, title: 'T'*2)).to be_invalid
|
7
|
+
end
|
8
|
+
|
9
|
+
it "has long title" do
|
10
|
+
expect(build_stubbed(:group_locale, title: 'T'*101)).to be_invalid
|
11
|
+
end
|
12
|
+
|
13
|
+
it "can change title" do
|
14
|
+
group_locale = create :group_locale
|
15
|
+
group_locale.title = 'Work Group Test'
|
16
|
+
expect(group_locale.save).to eq true
|
17
|
+
end
|
18
|
+
|
19
|
+
it "can destroy" do
|
20
|
+
group_locale = create :group_locale, title: 'Destroy'
|
21
|
+
group_locale.destroy
|
22
|
+
expect(group_locale.destroyed?).to eq true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|