anoubis 1.0.0 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/app/controllers/anoubis/application_controller.rb +22 -6
  4. data/app/controllers/anoubis/core/application_controller.rb +6 -6
  5. data/app/controllers/anoubis/core/index/actions.rb +3 -3
  6. data/app/controllers/anoubis/core/index/callbacks.rb +1 -1
  7. data/app/controllers/anoubis/core/index_controller.rb +7 -7
  8. data/app/controllers/anoubis/data/actions.rb +956 -0
  9. data/app/controllers/anoubis/data/callbacks.rb +66 -0
  10. data/app/controllers/anoubis/data/convert.rb +405 -0
  11. data/app/controllers/anoubis/data/defaults.rb +215 -0
  12. data/app/controllers/anoubis/data/get.rb +529 -0
  13. data/app/controllers/anoubis/data/load.rb +87 -0
  14. data/app/controllers/anoubis/data/set.rb +47 -0
  15. data/app/controllers/anoubis/data/setup.rb +102 -0
  16. data/app/controllers/anoubis/data_controller.rb +21 -0
  17. data/app/controllers/anoubis/etc/base.rb +16 -11
  18. data/app/controllers/anoubis/etc/data.rb +1 -1
  19. data/app/controllers/anoubis/etc/field.rb +10 -10
  20. data/app/controllers/anoubis/etc/field_options.rb +1 -1
  21. data/app/controllers/anoubis/etc/field_order.rb +1 -1
  22. data/app/controllers/anoubis/etc/filter.rb +2 -2
  23. data/app/controllers/anoubis/etc/menu.rb +2 -2
  24. data/app/controllers/anoubis/etc/model.rb +1 -1
  25. data/app/controllers/anoubis/etc/tab_item.rb +1 -1
  26. data/app/controllers/anoubis/etc.rb +1 -1
  27. data/app/controllers/anoubis/export.rb +1 -1
  28. data/app/controllers/anoubis/output/autocomplete.rb +1 -1
  29. data/app/controllers/anoubis/output/basic.rb +2 -2
  30. data/app/controllers/anoubis/output/data.rb +1 -1
  31. data/app/controllers/anoubis/output/delete.rb +1 -1
  32. data/app/controllers/anoubis/output/edit.rb +1 -1
  33. data/app/controllers/anoubis/output/frame.rb +5 -5
  34. data/app/controllers/anoubis/output/login.rb +1 -1
  35. data/app/controllers/anoubis/output/menu.rb +3 -3
  36. data/app/controllers/anoubis/output/update.rb +1 -1
  37. data/app/controllers/anoubis/sso/client/application_controller.rb +2 -2
  38. data/app/controllers/anoubis/sso/client/index/actions.rb +6 -6
  39. data/app/controllers/anoubis/sso/client/index/callbacks.rb +1 -1
  40. data/app/controllers/anoubis/sso/client/index_controller.rb +5 -5
  41. data/app/controllers/anoubis/sso/server/application_controller.rb +2 -2
  42. data/app/controllers/anoubis/sso/server/login_controller.rb +6 -6
  43. data/app/controllers/anoubis/sso/server/user_controller.rb +3 -3
  44. data/app/controllers/anoubis/tenant/application_controller.rb +4 -4
  45. data/app/controllers/anoubis/tenant/index/actions.rb +15 -15
  46. data/app/controllers/anoubis/tenant/index/callbacks.rb +2 -2
  47. data/app/controllers/anoubis/tenant/index_controller.rb +7 -7
  48. data/app/models/anoubis/application_record.rb +90 -2
  49. data/app/models/anoubis/core/application_record.rb +3 -3
  50. data/app/models/anoubis/sso/client/group_menu.rb +6 -6
  51. data/app/models/anoubis/sso/client/menu.rb +8 -8
  52. data/app/models/anoubis/sso/client/user.rb +3 -3
  53. data/app/models/anoubis/sso/server/user.rb +1 -1
  54. data/app/models/anoubis/tenant/group_menu.rb +5 -5
  55. data/app/models/anoubis/tenant/menu.rb +13 -13
  56. data/app/models/anoubis/tenant/system.rb +5 -5
  57. data/app/models/anoubis/tenant/user.rb +4 -4
  58. data/app/services/anoubis/log_service.rb +97 -0
  59. data/app/services/anoubis/request_service.rb +134 -0
  60. data/app/services/anoubis/session_service.rb +1 -1
  61. data/config/locales/en.yml +31 -2
  62. data/config/locales/ru.yml +32 -5
  63. data/config/routes.rb +19 -19
  64. data/db/seeds.rb +30 -30
  65. data/lib/anoubis/version.rb +1 -1
  66. data/lib/anoubis.rb +1 -1
  67. data/spec/controllers/anoubis/index_controller_spec.rb +1 -1
  68. data/spec/dummy/log/development.log +0 -0
  69. data/spec/dummy/log/test.log +0 -0
  70. data/spec/dummy/tmp/development_secret.txt +1 -0
  71. data/spec/models/anoubis/group_locale_spec.rb +1 -1
  72. data/spec/models/anoubis/group_menu_spec.rb +6 -6
  73. data/spec/models/anoubis/group_spec.rb +3 -3
  74. data/spec/models/anoubis/menu_locale_spec.rb +1 -1
  75. data/spec/models/anoubis/menu_spec.rb +1 -1
  76. data/spec/models/anoubis/system_locale_spec.rb +1 -1
  77. data/spec/models/anoubis/system_menu_spec.rb +5 -5
  78. data/spec/models/anoubis/system_spec.rb +4 -4
  79. data/spec/models/anoubis/tenant_spec.rb +4 -4
  80. data/spec/models/anoubis/user_spec.rb +2 -2
  81. metadata +92 -87
  82. data/app/controllers/anoubis/core/data/actions.rb +0 -962
  83. data/app/controllers/anoubis/core/data/callbacks.rb +0 -68
  84. data/app/controllers/anoubis/core/data/convert.rb +0 -407
  85. data/app/controllers/anoubis/core/data/defaults.rb +0 -217
  86. data/app/controllers/anoubis/core/data/get.rb +0 -531
  87. data/app/controllers/anoubis/core/data/load.rb +0 -89
  88. data/app/controllers/anoubis/core/data/set.rb +0 -49
  89. data/app/controllers/anoubis/core/data/setup.rb +0 -104
  90. data/app/controllers/anoubis/core/data_controller.rb +0 -28
  91. data/app/controllers/anoubis/sso/client/data/actions.rb +0 -5
  92. data/app/controllers/anoubis/sso/client/data/callbacks.rb +0 -5
  93. data/app/controllers/anoubis/sso/client/data/convert.rb +0 -5
  94. data/app/controllers/anoubis/sso/client/data/defaults.rb +0 -5
  95. data/app/controllers/anoubis/sso/client/data/get.rb +0 -5
  96. data/app/controllers/anoubis/sso/client/data/load.rb +0 -26
  97. data/app/controllers/anoubis/sso/client/data/set.rb +0 -5
  98. data/app/controllers/anoubis/sso/client/data/setup.rb +0 -5
  99. data/app/controllers/anoubis/sso/client/data_controller.rb +0 -21
  100. data/app/controllers/anoubis/tenant/data/actions.rb +0 -11
  101. data/app/controllers/anoubis/tenant/data/callbacks.rb +0 -11
  102. data/app/controllers/anoubis/tenant/data/convert.rb +0 -11
  103. data/app/controllers/anoubis/tenant/data/defaults.rb +0 -11
  104. data/app/controllers/anoubis/tenant/data/get.rb +0 -11
  105. data/app/controllers/anoubis/tenant/data/load.rb +0 -52
  106. data/app/controllers/anoubis/tenant/data/set.rb +0 -11
  107. data/app/controllers/anoubis/tenant/data/setup.rb +0 -11
  108. data/app/controllers/anoubis/tenant/data_controller.rb +0 -28
  109. data/app/controllers/anoubis/tenants_controller.rb +0 -7
  110. data/app/controllers/anoubis/users_controller.rb +0 -7
  111. data/app/mailers/anoubis/application_mailer.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2ef6417845dbb20f56a6bb3bdd5e304b442f681928f9f64765d68d1bf5f4c57
4
- data.tar.gz: d2a87698442e6d1807ae9ed3104a706053f45654f80da248db873bc7a0a16a80
3
+ metadata.gz: 5464dccc282a05f485f875d7961916178f580dfb96957bde888ab61ec73f7276
4
+ data.tar.gz: 8cc6edd51976891558a02532f13b2d8613763f0f50075b2dcaa642f18707f268
5
5
  SHA512:
6
- metadata.gz: 9bba0811a68af029fbe976c8369372e7026d328386895892c9300d2e5f4f448863f3e5fb54e123d2987e1d214620cde0d7fa9d43244a64ab7438110949e91ad0
7
- data.tar.gz: a588b8aff9758aa25f20e709ceb2f86d72090a3d281b7cdb71ad97ac93fe9d771414b09daa571e7511c2049e723b8a32e92d894dc8c4cd4ec29c3af1eaecb470
6
+ metadata.gz: 7ff86708955579d2f88fa8f6492b7c9dc59f6d33e15e290578f046547bd921eb92dea83f0a16f3e97a6144e6c5f0775dc27bc478f1deb33441c140da4f5903a7
7
+ data.tar.gz: 32e3ce400a9838b7785a0fea0ba6f60e884c25dc4ece6d8e15a5ae940c05c4e6cb79931a0fc6f68dc47597655da1aa6d431eeff067218ff4db1488800a7afb77
data/README.md CHANGED
@@ -21,6 +21,16 @@ Or install it yourself as:
21
21
  $ gem install anoubis
22
22
  ```
23
23
 
24
+ ## Configuration parameters
25
+
26
+ This configuration parameters can be placed at files config/application.rb for global configuration or config/environments/<environment>.rb for custom environment configuration.
27
+
28
+ ```ruby
29
+ config.graylog_server = '127.0.0.1' # Graylog server (By default set as '127.0.0.1') (*optional)
30
+ config.graylog_port = 12201 # Graylog server port (By default set as 12201) (*optional)
31
+ config.graylog_facility = 'Graylog' # Graylog source identifier (By default set as 'Graylog') (*optional)
32
+ ```
33
+
24
34
  ## Contributing
25
35
  Contribution directions go here.
26
36
 
@@ -10,6 +10,10 @@ class Anoubis::ApplicationController < ActionController::API
10
10
  ## Current used locale
11
11
  attr_accessor :locale
12
12
 
13
+ # @!attribute [rw] output
14
+ # @return [Anoubis::Output] standard output.
15
+ attr_accessor :output
16
+
13
17
  ##
14
18
  # Returns default locale initialized in application configuration file. Variable is taken from {https://guides.rubyonrails.org/i18n.html Rails.configuration.i18n.default_locale} parameter
15
19
  # @return [String] default locale
@@ -55,18 +59,30 @@ class Anoubis::ApplicationController < ActionController::API
55
59
  rescue
56
60
  I18n.locale = default_locale
57
61
  end
62
+
63
+ after_anoubis_initialization
64
+ end
65
+
66
+ ##
67
+ # Procedure fires after initializes all parameters
68
+ def after_anoubis_initialization
69
+
58
70
  end
59
71
 
60
72
  ##
61
73
  # Generates options headers for CORS requests
62
74
  # @param methods [String] list of allowed HTTP actions separated by space <i>(e.g. 'GET POST DELETE')</i>
63
75
  def options(methods = 'POST')
64
- if check_origin
65
- headers['Access-Control-Allow-Origin'] = request.headers['origin']
66
- headers['Access-Control-Allow-Methods'] = methods
67
- headers['Access-Control-Max-Age'] = '1000'
68
- headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,Authorization'
69
- end
76
+ return unless check_origin
77
+ return unless request.origin
78
+
79
+ headers['Access-Control-Allow-Origin'] = request.headers['origin']
80
+ headers['Access-Control-Allow-Methods'] = methods
81
+
82
+ return if request.method != 'OPTIONS'
83
+
84
+ headers['Access-Control-Max-Age'] = '1000'
85
+ headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,Authorization'
70
86
  end
71
87
 
72
88
  ##
@@ -1,6 +1,6 @@
1
1
  ##
2
2
  # Application controller for Anubis library.
3
- class Anubis::Core::ApplicationController < ActionController::API
3
+ class Anoubis::Core::ApplicationController < ActionController::API
4
4
  prepend_before_action :anubis_core_initialization
5
5
 
6
6
  #include AbstractController::Translation
@@ -23,7 +23,7 @@ class Anubis::Core::ApplicationController < ActionController::API
23
23
  attr_accessor :current_user
24
24
 
25
25
  # @!attribute [rw] output
26
- # @return [Anubis::Output] standard output.
26
+ # @return [Anoubis::Output] standard output.
27
27
  attr_accessor :output
28
28
 
29
29
  # @!attribute [rw] writer
@@ -31,11 +31,11 @@ class Anubis::Core::ApplicationController < ActionController::API
31
31
  attr_accessor :writer
32
32
 
33
33
  # @!attribute [rw] etc
34
- # @return [Anubis::Etc::Base] global system parameters
34
+ # @return [Anoubis::Etc::Base] global system parameters
35
35
  attr_accessor :etc
36
36
 
37
37
  # @!attribute [rw] exports
38
- # @return [Anubis::Export] Export data class
38
+ # @return [Anoubis::Export] Export data class
39
39
  attr_accessor :exports
40
40
 
41
41
  ##
@@ -50,9 +50,9 @@ class Anubis::Core::ApplicationController < ActionController::API
50
50
  self.version = 0
51
51
 
52
52
  if defined? params
53
- self.etc = Anubis::Etc::Base.new({ params: params })
53
+ self.etc = Anoubis::Etc::Base.new({ params: params })
54
54
  else
55
- self.etc = Anubis::Etc::Base.new
55
+ self.etc = Anoubis::Etc::Base.new
56
56
  end
57
57
  self.output = nil
58
58
  self.exports = nil
@@ -1,6 +1,6 @@
1
- require_dependency "anubis/output/login"
1
+ require_dependency "anoubis/output/login"
2
2
 
3
- module Anubis
3
+ module Anoubis
4
4
  module Core
5
5
  ##
6
6
  # Module contains all procedures and function for {IndexController}. Consists of {Actions} and {Callbacks} module.
@@ -39,7 +39,7 @@ module Anubis
39
39
  # "message": "Session expired"
40
40
  # }
41
41
  def logout
42
- self.output = Anubis::Output::Basic.new
42
+ self.output = Anoubis::Output::Basic.new
43
43
  self.redis.del(self.redis_prefix + 'ses_'+self.token)
44
44
  respond_to do |format|
45
45
  format.json { render json: self.output.to_h }
@@ -1,4 +1,4 @@
1
- module Anubis
1
+ module Anoubis
2
2
  module Core
3
3
  ##
4
4
  # Module contains all procedures and function for {IndexController}. Consists of {Actions} and {Callbacks} module.
@@ -1,14 +1,14 @@
1
- require_dependency "anubis/core/application_controller"
2
- require_dependency "anubis/core/index/actions"
3
- require_dependency "anubis/core/index/callbacks"
1
+ require_dependency "anoubis/core/application_controller"
2
+ require_dependency "anoubis/core/index/actions"
3
+ require_dependency "anoubis/core/index/callbacks"
4
4
 
5
- module Anubis
5
+ module Anoubis
6
6
  module Core
7
7
  ##
8
8
  # Controller processes main system functions. Authenticates user, checks user access, outputs main menu and etc.
9
- class IndexController < Anubis::Core::ApplicationController
10
- include Anubis::Core::Index::Actions
11
- include Anubis::Core::Index::Callbacks
9
+ class IndexController < Anoubis::Core::ApplicationController
10
+ include Anoubis::Core::Index::Actions
11
+ include Anoubis::Core::Index::Callbacks
12
12
 
13
13
  ##
14
14
  # Check if authentication required