anoubis 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/anoubis/application_controller.rb +4 -0
- data/app/controllers/anoubis/data/actions.rb +956 -0
- data/app/controllers/anoubis/data/callbacks.rb +66 -0
- data/app/controllers/anoubis/data/convert.rb +405 -0
- data/app/controllers/anoubis/data/defaults.rb +215 -0
- data/app/controllers/anoubis/data/get.rb +529 -0
- data/app/controllers/anoubis/data/load.rb +87 -0
- data/app/controllers/anoubis/data/set.rb +47 -0
- data/app/controllers/anoubis/data/setup.rb +102 -0
- data/app/controllers/anoubis/data_controller.rb +17 -1
- data/app/controllers/anoubis/output/basic.rb +1 -1
- data/app/controllers/anoubis/sso/server/login_controller.rb +5 -5
- data/app/controllers/anoubis/sso/server/user_controller.rb +2 -2
- data/app/models/anoubis/application_record.rb +7 -0
- data/config/locales/ru.yml +3 -2
- data/lib/anoubis/version.rb +1 -1
- metadata +11 -30
- data/app/controllers/anoubis/core/data/actions.rb +0 -962
- data/app/controllers/anoubis/core/data/callbacks.rb +0 -68
- data/app/controllers/anoubis/core/data/convert.rb +0 -407
- data/app/controllers/anoubis/core/data/defaults.rb +0 -217
- data/app/controllers/anoubis/core/data/get.rb +0 -531
- data/app/controllers/anoubis/core/data/load.rb +0 -89
- data/app/controllers/anoubis/core/data/set.rb +0 -49
- data/app/controllers/anoubis/core/data/setup.rb +0 -104
- data/app/controllers/anoubis/core/data_controller.rb +0 -28
- data/app/controllers/anoubis/sso/client/data/actions.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/callbacks.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/convert.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/defaults.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/get.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/load.rb +0 -26
- data/app/controllers/anoubis/sso/client/data/set.rb +0 -5
- data/app/controllers/anoubis/sso/client/data/setup.rb +0 -5
- data/app/controllers/anoubis/sso/client/data_controller.rb +0 -21
- data/app/controllers/anoubis/tenant/data/actions.rb +0 -11
- data/app/controllers/anoubis/tenant/data/callbacks.rb +0 -11
- data/app/controllers/anoubis/tenant/data/convert.rb +0 -11
- data/app/controllers/anoubis/tenant/data/defaults.rb +0 -11
- data/app/controllers/anoubis/tenant/data/get.rb +0 -11
- data/app/controllers/anoubis/tenant/data/load.rb +0 -52
- data/app/controllers/anoubis/tenant/data/set.rb +0 -11
- data/app/controllers/anoubis/tenant/data/setup.rb +0 -11
- data/app/controllers/anoubis/tenant/data_controller.rb +0 -28
@@ -1,104 +0,0 @@
|
|
1
|
-
module Anoubis
|
2
|
-
##
|
3
|
-
# Module consists all procedures and functons of {DataController}
|
4
|
-
module Core
|
5
|
-
module Data
|
6
|
-
##
|
7
|
-
# Module setups system parameters for {DataController}
|
8
|
-
module Setup
|
9
|
-
##
|
10
|
-
# Setups frame data information. It loads menu data, sets titles and tabs of the frame.
|
11
|
-
def setup_frame
|
12
|
-
self.load_menu_data
|
13
|
-
if self.etc.menu
|
14
|
-
self.get_parent_data
|
15
|
-
if self.etc.data.parent
|
16
|
-
self.output.title = self.etc.menu.page_title.sub '%{title}', self.etc.data.parent.sys_title.to_s
|
17
|
-
else
|
18
|
-
self.output.title = self.etc.menu.page_title
|
19
|
-
end
|
20
|
-
self.output.short = self.etc.menu.short_title
|
21
|
-
self.output.mode = self.etc.menu.mode
|
22
|
-
self.output.access = self.etc.menu.access
|
23
|
-
end
|
24
|
-
tabs = self.tabs
|
25
|
-
tabs.each do |key, item|
|
26
|
-
item = self.get_tab key, item
|
27
|
-
self.output.addTab(item)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
##
|
32
|
-
# Setups order for current tab. Parameters is set into {Anoubis::Etc::TabItem#sort self.etc.tab.sort} and
|
33
|
-
# {Anoubis::Etc::TabItem#order self.etc.tab.order} attributes.
|
34
|
-
def setup_order
|
35
|
-
sort = nil
|
36
|
-
first = nil
|
37
|
-
self.etc.data.fields.each do |key, field|
|
38
|
-
if field.order
|
39
|
-
first = key if !first
|
40
|
-
first = key if field.order.default
|
41
|
-
if params.key? :sort
|
42
|
-
sort = key if params[:sort] == key.to_s
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
sort = first if !sort
|
47
|
-
if sort
|
48
|
-
self.etc.tab.sort = sort.to_s
|
49
|
-
self.etc.tab.order = self.etc.data.fields[sort].order.order
|
50
|
-
if params.key? :order
|
51
|
-
self.etc.tab.order = :desc if params[:order] == 'desc'
|
52
|
-
self.etc.tab.order = :asc if params[:order] == 'asc'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
##
|
58
|
-
# @!group Block of fields setup functions
|
59
|
-
|
60
|
-
##
|
61
|
-
# Setups defined fields and places it into attribute {Anoubis::Etc::Data#fields self.etc.data.fields}
|
62
|
-
def setup_fields
|
63
|
-
if !self.etc.data.fields
|
64
|
-
self.etc.data.fields = {}
|
65
|
-
|
66
|
-
fields = self.fields
|
67
|
-
|
68
|
-
fields.each_key do |key|
|
69
|
-
if fields[key].key? :edit
|
70
|
-
if self.menu_access fields[key][:edit], false
|
71
|
-
fields[key][:editable] = fields[key][:edit]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
self.etc.data.fields[key] = Anoubis::Etc::Field.new(key, self.get_model, fields[key].merge(action: self.etc.action))
|
75
|
-
end
|
76
|
-
self.setup_order if %w[index export].include? self.etc.action
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
##
|
81
|
-
# Setups additional parameters for table field with type 'datetime'
|
82
|
-
# Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
|
83
|
-
# @param key [Symbol] key of table field.
|
84
|
-
def setup_fields_datetime (key)
|
85
|
-
self.etc.data.fields[key][:format] = 'full' if !self.etc.data.fields[key].has_key? :format
|
86
|
-
self.etc.data.fields[key][:format] = 'full' if !['full', 'month', 'date', 'datetime'].include? self.etc.data.fields[key][:format]
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
##
|
92
|
-
# Setups additional parameters for table field with type 'float'
|
93
|
-
# Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
|
94
|
-
# @param key [Symbol] key of table field.
|
95
|
-
def setup_fields_float (key)
|
96
|
-
self.etc.data.fields[key][:precision] = 2 if !self.etc.data.fields[key][:precision]
|
97
|
-
self.etc.data.fields[key][:point] = ',' if !self.etc.data.fields[key][:point]
|
98
|
-
self.etc.data.fields[key][:separator] = '' if !self.etc.data.fields[key][:separator]
|
99
|
-
end
|
100
|
-
# @!endgroup
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require_dependency "anoubis/core/application_controller"
|
2
|
-
require_dependency "anoubis/core/data/actions"
|
3
|
-
require_dependency "anoubis/core/data/load"
|
4
|
-
require_dependency "anoubis/core/data/get"
|
5
|
-
require_dependency "anoubis/core/data/set"
|
6
|
-
require_dependency "anoubis/core/data/setup"
|
7
|
-
require_dependency "anoubis/core/data/defaults"
|
8
|
-
require_dependency "anoubis/core/data/convert"
|
9
|
-
require_dependency "anoubis/core/data/callbacks"
|
10
|
-
|
11
|
-
module Anoubis
|
12
|
-
##
|
13
|
-
# Module presents all core functions for Anubis Library
|
14
|
-
module Core
|
15
|
-
##
|
16
|
-
# Controller consists all procedures and function for presents and modify models data.
|
17
|
-
class DataController < Anoubis::Core::ApplicationController
|
18
|
-
include Anoubis::Core::Data::Actions
|
19
|
-
include Anoubis::Core::Data::Load
|
20
|
-
include Anoubis::Core::Data::Get
|
21
|
-
include Anoubis::Core::Data::Set
|
22
|
-
include Anoubis::Core::Data::Setup
|
23
|
-
include Anoubis::Core::Data::Defaults
|
24
|
-
include Anoubis::Core::Data::Convert
|
25
|
-
include Anoubis::Core::Data::Callbacks
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# Module loads data from external sources for {Anoubis::Sso::Client::DataController}
|
3
|
-
module Anoubis::Sso::Client::Data::Load
|
4
|
-
include Anoubis::Core::Data::Load
|
5
|
-
|
6
|
-
def load_menu_data
|
7
|
-
menu_json = self.redis.get(self.redis_prefix + 'menu:' + params[:controller])
|
8
|
-
|
9
|
-
unless menu_json
|
10
|
-
menu = Anoubis::Sso::Client::Menu.where(mode: params[:controller], status: 'enabled').first
|
11
|
-
self.redis.set(self.redis_prefix + 'menu:'+ params[:controller], menu.to_json) if menu
|
12
|
-
else
|
13
|
-
menu = Anoubis::Sso::Client::Menu.new(JSON.parse(menu_json, { :symbolize_names => true }))
|
14
|
-
end
|
15
|
-
|
16
|
-
if menu
|
17
|
-
self.etc.menu = Anoubis::Etc::Menu.new menu
|
18
|
-
|
19
|
-
if self.writer
|
20
|
-
self.etc.menu.access = 'write'
|
21
|
-
else
|
22
|
-
self.etc.menu.access = 'read'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require_dependency "anoubis/sso/client/application_controller"
|
2
|
-
require_dependency "anoubis/sso/client/data/actions"
|
3
|
-
require_dependency "anoubis/sso/client/data/load"
|
4
|
-
require_dependency "anoubis/sso/client/data/get"
|
5
|
-
require_dependency "anoubis/sso/client/data/set"
|
6
|
-
require_dependency "anoubis/sso/client/data/setup"
|
7
|
-
require_dependency "anoubis/sso/client/data/defaults"
|
8
|
-
require_dependency "anoubis/sso/client/data/convert"
|
9
|
-
require_dependency "anoubis/sso/client/data/callbacks"
|
10
|
-
|
11
|
-
# Controller consists all procedures and function for presents and modify models data.
|
12
|
-
class Anoubis::Sso::Client::DataController < Anoubis::Sso::Client::ApplicationController
|
13
|
-
include Anoubis::Sso::Client::Data::Actions
|
14
|
-
include Anoubis::Sso::Client::Data::Load
|
15
|
-
include Anoubis::Sso::Client::Data::Get
|
16
|
-
include Anoubis::Sso::Client::Data::Set
|
17
|
-
include Anoubis::Sso::Client::Data::Setup
|
18
|
-
include Anoubis::Sso::Client::Data::Defaults
|
19
|
-
include Anoubis::Sso::Client::Data::Convert
|
20
|
-
include Anoubis::Sso::Client::Data::Callbacks
|
21
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
module Anoubis
|
2
|
-
module Tenant
|
3
|
-
module Data
|
4
|
-
##
|
5
|
-
# Module loads data from external sources for {DataController}
|
6
|
-
module Load
|
7
|
-
include Anoubis::Core::Data::Load
|
8
|
-
|
9
|
-
##
|
10
|
-
# Loads current menu data. Procedure loads menu data from MySQL database or from Redis cache and places it in
|
11
|
-
# self.etc.menu {Anoubis::Etc#menu}
|
12
|
-
def load_menu_data
|
13
|
-
menu_json = self.redis.get(self.redis_prefix + 'menu_' + params[:controller])
|
14
|
-
menu_locale_json = self.redis.get(self.redis_prefix + 'menu_'+params[:controller]+'_'+self.locale)
|
15
|
-
if !menu_json || !menu_locale_json
|
16
|
-
menu = Anoubis::Tenant::MenuLocale.eager_load(menu: :menu).where(locale: Anoubis::Tenant::MenuLocale.locales[self.locale.to_sym]).where(['menus.mode = ? AND menus.status = 0', params[:controller]]).first
|
17
|
-
if menu
|
18
|
-
menu_json = {
|
19
|
-
mode: menu.menu.mode,
|
20
|
-
menu_id: menu.menu_id,
|
21
|
-
parent_menu_id: menu.menu.menu_id,
|
22
|
-
action: menu.menu.action,
|
23
|
-
tab: menu.menu.tab,
|
24
|
-
position: menu.menu.position,
|
25
|
-
state: menu.menu.state
|
26
|
-
}
|
27
|
-
if menu.menu.menu
|
28
|
-
menu_json[:parent_mode] = menu.menu.menu.mode
|
29
|
-
end
|
30
|
-
menu_json = menu_json.to_json
|
31
|
-
self.redis.set(self.redis_prefix + 'menu_'+params[:controller], menu_json)
|
32
|
-
menu_locale_json = {
|
33
|
-
title: menu.title,
|
34
|
-
page_title: menu.page_title,
|
35
|
-
short_title: menu.short_title
|
36
|
-
}.to_json
|
37
|
-
self.redis.set(self.redis_prefix + 'menu_'+params[:controller]+'_'+self.locale, menu_locale_json)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
if menu_json && menu_locale_json
|
41
|
-
self.etc.menu = Anoubis::Etc::Menu.new JSON.parse(menu_json, {:symbolize_names => true}).merge(JSON.parse(menu_locale_json, {:symbolize_names => true}))
|
42
|
-
if self.writer
|
43
|
-
self.etc.menu.access = 'write'
|
44
|
-
else
|
45
|
-
self.etc.menu.access = 'read'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require_dependency "anoubis/tenant/application_controller"
|
2
|
-
require_dependency "anoubis/tenant/data/actions"
|
3
|
-
require_dependency "anoubis/tenant/data/load"
|
4
|
-
require_dependency "anoubis/tenant/data/get"
|
5
|
-
require_dependency "anoubis/tenant/data/set"
|
6
|
-
require_dependency "anoubis/tenant/data/setup"
|
7
|
-
require_dependency "anoubis/tenant/data/defaults"
|
8
|
-
require_dependency "anoubis/tenant/data/convert"
|
9
|
-
require_dependency "anoubis/tenant/data/callbacks"
|
10
|
-
|
11
|
-
module Anoubis
|
12
|
-
##
|
13
|
-
# Module presents all core functions for Anubis Library
|
14
|
-
module Tenant
|
15
|
-
##
|
16
|
-
# Controller consists all procedures and function for presents and modify models data.
|
17
|
-
class DataController < Anoubis::Tenant::ApplicationController
|
18
|
-
include Anoubis::Tenant::Data::Actions
|
19
|
-
include Anoubis::Tenant::Data::Load
|
20
|
-
include Anoubis::Tenant::Data::Get
|
21
|
-
include Anoubis::Tenant::Data::Set
|
22
|
-
include Anoubis::Tenant::Data::Setup
|
23
|
-
include Anoubis::Tenant::Data::Defaults
|
24
|
-
include Anoubis::Tenant::Data::Convert
|
25
|
-
include Anoubis::Tenant::Data::Callbacks
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|