anoubis 1.0.0 → 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/README.md +10 -0
- data/app/controllers/anoubis/application_controller.rb +22 -6
- data/app/controllers/anoubis/core/application_controller.rb +6 -6
- data/app/controllers/anoubis/core/index/actions.rb +3 -3
- data/app/controllers/anoubis/core/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/core/index_controller.rb +7 -7
- 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 +21 -0
- data/app/controllers/anoubis/etc/base.rb +16 -11
- data/app/controllers/anoubis/etc/data.rb +1 -1
- data/app/controllers/anoubis/etc/field.rb +10 -10
- data/app/controllers/anoubis/etc/field_options.rb +1 -1
- data/app/controllers/anoubis/etc/field_order.rb +1 -1
- data/app/controllers/anoubis/etc/filter.rb +2 -2
- data/app/controllers/anoubis/etc/menu.rb +2 -2
- data/app/controllers/anoubis/etc/model.rb +1 -1
- data/app/controllers/anoubis/etc/tab_item.rb +1 -1
- data/app/controllers/anoubis/etc.rb +1 -1
- data/app/controllers/anoubis/export.rb +1 -1
- data/app/controllers/anoubis/output/autocomplete.rb +1 -1
- data/app/controllers/anoubis/output/basic.rb +2 -2
- data/app/controllers/anoubis/output/data.rb +1 -1
- data/app/controllers/anoubis/output/delete.rb +1 -1
- data/app/controllers/anoubis/output/edit.rb +1 -1
- data/app/controllers/anoubis/output/frame.rb +5 -5
- data/app/controllers/anoubis/output/login.rb +1 -1
- data/app/controllers/anoubis/output/menu.rb +3 -3
- data/app/controllers/anoubis/output/update.rb +1 -1
- data/app/controllers/anoubis/sso/client/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/client/index/actions.rb +6 -6
- data/app/controllers/anoubis/sso/client/index/callbacks.rb +1 -1
- data/app/controllers/anoubis/sso/client/index_controller.rb +5 -5
- data/app/controllers/anoubis/sso/server/application_controller.rb +2 -2
- data/app/controllers/anoubis/sso/server/login_controller.rb +6 -6
- data/app/controllers/anoubis/sso/server/user_controller.rb +3 -3
- data/app/controllers/anoubis/tenant/application_controller.rb +4 -4
- data/app/controllers/anoubis/tenant/index/actions.rb +15 -15
- data/app/controllers/anoubis/tenant/index/callbacks.rb +2 -2
- data/app/controllers/anoubis/tenant/index_controller.rb +7 -7
- data/app/models/anoubis/application_record.rb +90 -2
- data/app/models/anoubis/core/application_record.rb +3 -3
- data/app/models/anoubis/sso/client/group_menu.rb +6 -6
- data/app/models/anoubis/sso/client/menu.rb +8 -8
- data/app/models/anoubis/sso/client/user.rb +3 -3
- data/app/models/anoubis/sso/server/user.rb +1 -1
- data/app/models/anoubis/tenant/group_menu.rb +5 -5
- data/app/models/anoubis/tenant/menu.rb +13 -13
- data/app/models/anoubis/tenant/system.rb +5 -5
- data/app/models/anoubis/tenant/user.rb +4 -4
- data/app/services/anoubis/log_service.rb +97 -0
- data/app/services/anoubis/request_service.rb +134 -0
- data/app/services/anoubis/session_service.rb +1 -1
- data/config/locales/en.yml +31 -2
- data/config/locales/ru.yml +32 -5
- data/config/routes.rb +19 -19
- data/db/seeds.rb +30 -30
- data/lib/anoubis/version.rb +1 -1
- data/lib/anoubis.rb +1 -1
- data/spec/controllers/anoubis/index_controller_spec.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +0 -0
- data/spec/dummy/tmp/development_secret.txt +1 -0
- data/spec/models/anoubis/group_locale_spec.rb +1 -1
- data/spec/models/anoubis/group_menu_spec.rb +6 -6
- data/spec/models/anoubis/group_spec.rb +3 -3
- data/spec/models/anoubis/menu_locale_spec.rb +1 -1
- data/spec/models/anoubis/menu_spec.rb +1 -1
- data/spec/models/anoubis/system_locale_spec.rb +1 -1
- data/spec/models/anoubis/system_menu_spec.rb +5 -5
- data/spec/models/anoubis/system_spec.rb +4 -4
- data/spec/models/anoubis/tenant_spec.rb +4 -4
- data/spec/models/anoubis/user_spec.rb +2 -2
- metadata +92 -87
- 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
- data/app/controllers/anoubis/tenants_controller.rb +0 -7
- data/app/controllers/anoubis/users_controller.rb +0 -7
- data/app/mailers/anoubis/application_mailer.rb +0 -8
@@ -0,0 +1,102 @@
|
|
1
|
+
module Anoubis
|
2
|
+
##
|
3
|
+
# Module consists all procedures and functons of {DataController}
|
4
|
+
module Data
|
5
|
+
##
|
6
|
+
# Module setups system parameters for {DataController}
|
7
|
+
module Setup
|
8
|
+
##
|
9
|
+
# Setups frame data information. It loads menu data, sets titles and tabs of the frame.
|
10
|
+
def setup_frame
|
11
|
+
self.load_menu_data
|
12
|
+
if self.etc.menu
|
13
|
+
self.get_parent_data
|
14
|
+
if self.etc.data.parent
|
15
|
+
self.output.title = self.etc.menu.page_title.sub '%{title}', self.etc.data.parent.sys_title.to_s
|
16
|
+
else
|
17
|
+
self.output.title = self.etc.menu.page_title
|
18
|
+
end
|
19
|
+
self.output.short = self.etc.menu.short_title
|
20
|
+
self.output.mode = self.etc.menu.mode
|
21
|
+
self.output.access = self.etc.menu.access
|
22
|
+
end
|
23
|
+
tabs = self.tabs
|
24
|
+
tabs.each do |key, item|
|
25
|
+
item = self.get_tab key, item
|
26
|
+
self.output.addTab(item)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
# Setups order for current tab. Parameters is set into {Anoubis::Etc::TabItem#sort self.etc.tab.sort} and
|
32
|
+
# {Anoubis::Etc::TabItem#order self.etc.tab.order} attributes.
|
33
|
+
def setup_order
|
34
|
+
sort = nil
|
35
|
+
first = nil
|
36
|
+
self.etc.data.fields.each do |key, field|
|
37
|
+
if field.order
|
38
|
+
first = key if !first
|
39
|
+
first = key if field.order.default
|
40
|
+
if params.key? :sort
|
41
|
+
sort = key if params[:sort] == key.to_s
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
sort = first if !sort
|
46
|
+
if sort
|
47
|
+
self.etc.tab.sort = sort.to_s
|
48
|
+
self.etc.tab.order = self.etc.data.fields[sort].order.order
|
49
|
+
if params.key? :order
|
50
|
+
self.etc.tab.order = :desc if params[:order] == 'desc'
|
51
|
+
self.etc.tab.order = :asc if params[:order] == 'asc'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @!group Block of fields setup functions
|
58
|
+
|
59
|
+
##
|
60
|
+
# Setups defined fields and places it into attribute {Anoubis::Etc::Data#fields self.etc.data.fields}
|
61
|
+
def setup_fields
|
62
|
+
if !self.etc.data.fields
|
63
|
+
self.etc.data.fields = {}
|
64
|
+
|
65
|
+
fields = self.fields
|
66
|
+
|
67
|
+
fields.each_key do |key|
|
68
|
+
if fields[key].key? :edit
|
69
|
+
if self.menu_access fields[key][:edit], false
|
70
|
+
fields[key][:editable] = fields[key][:edit]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
self.etc.data.fields[key] = Anoubis::Etc::Field.new(key, self.get_model, fields[key].merge(action: self.etc.action))
|
74
|
+
end
|
75
|
+
self.setup_order if %w[index export].include? self.etc.action
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Setups additional parameters for table field with type 'datetime'
|
81
|
+
# Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
|
82
|
+
# @param key [Symbol] key of table field.
|
83
|
+
def setup_fields_datetime (key)
|
84
|
+
self.etc.data.fields[key][:format] = 'full' if !self.etc.data.fields[key].has_key? :format
|
85
|
+
self.etc.data.fields[key][:format] = 'full' if !['full', 'month', 'date', 'datetime'].include? self.etc.data.fields[key][:format]
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
##
|
91
|
+
# Setups additional parameters for table field with type 'float'
|
92
|
+
# Resulting data placed in {Etc::Data#fields self.etc.data.fields} (Hash)
|
93
|
+
# @param key [Symbol] key of table field.
|
94
|
+
def setup_fields_float (key)
|
95
|
+
self.etc.data.fields[key][:precision] = 2 if !self.etc.data.fields[key][:precision]
|
96
|
+
self.etc.data.fields[key][:point] = ',' if !self.etc.data.fields[key][:point]
|
97
|
+
self.etc.data.fields[key][:separator] = '' if !self.etc.data.fields[key][:separator]
|
98
|
+
end
|
99
|
+
# @!endgroup
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_dependency "anoubis/data/actions"
|
2
|
+
require_dependency "anoubis/data/load"
|
3
|
+
require_dependency "anoubis/data/get"
|
4
|
+
require_dependency "anoubis/data/set"
|
5
|
+
require_dependency "anoubis/data/setup"
|
6
|
+
require_dependency "anoubis/data/defaults"
|
7
|
+
require_dependency "anoubis/data/convert"
|
8
|
+
require_dependency "anoubis/data/callbacks"
|
9
|
+
|
10
|
+
##
|
11
|
+
# Main data controller class
|
12
|
+
class Anoubis::DataController < Anoubis::ApplicationController
|
13
|
+
include Anoubis::Data::Actions
|
14
|
+
include Anoubis::Data::Load
|
15
|
+
include Anoubis::Data::Get
|
16
|
+
include Anoubis::Data::Set
|
17
|
+
include Anoubis::Data::Setup
|
18
|
+
include Anoubis::Data::Defaults
|
19
|
+
include Anoubis::Data::Convert
|
20
|
+
include Anoubis::Data::Callbacks
|
21
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Etc
|
3
3
|
##
|
4
4
|
# Basic system variables class
|
@@ -6,27 +6,32 @@ module Anubis
|
|
6
6
|
# @!attribute [rw]
|
7
7
|
# @return [Data, nil] current loaded data or nil if data not loaded.
|
8
8
|
# @note In this attribute placed data when loaded from the model by actions 'table', 'edit', 'update', 'create' etc.
|
9
|
-
|
9
|
+
attr_accessor :data
|
10
10
|
|
11
11
|
# @!attribute [rw]
|
12
12
|
# @return [Menu, nil] menu information for current controller
|
13
13
|
# Returns menu information for current controller. By default sets to <i>nil</i>.
|
14
|
-
|
14
|
+
attr_accessor :menu
|
15
15
|
|
16
16
|
# @!attribute [rw]
|
17
17
|
# @return [TabItem, nil] tab information for current controller
|
18
18
|
# Returns tab information for current controller. By default sets to <i>nil</i>.
|
19
|
-
|
19
|
+
attr_accessor :tab
|
20
20
|
|
21
21
|
# @!attribute [rw]
|
22
22
|
# @return [String] current controller action.
|
23
23
|
# Returns current controller action. By default sets to controller action or ''.
|
24
|
-
|
24
|
+
attr_accessor :action
|
25
25
|
|
26
26
|
# @!attribute [rw]
|
27
27
|
# @return [Number] time of request.
|
28
28
|
# Returns time that was requested from client. By default sets to <i>0</i>.
|
29
|
-
|
29
|
+
attr_accessor :time
|
30
|
+
|
31
|
+
# @!attribute [rw] version
|
32
|
+
# @return [Number] Specifies the api version.
|
33
|
+
# Returns API version received from URL. By default sets to <i>0</i>.
|
34
|
+
attr_accessor :version
|
30
35
|
|
31
36
|
##
|
32
37
|
# Sets default system parameters
|
@@ -37,14 +42,14 @@ module Anubis
|
|
37
42
|
self.menu = nil
|
38
43
|
self.tab = nil
|
39
44
|
self.action = ''
|
45
|
+
self.time = 0
|
46
|
+
self.version = 0
|
47
|
+
|
40
48
|
|
41
49
|
if options.key? :params
|
42
50
|
self.action = options[:params][:action] if options[:params].key? :action
|
43
|
-
if options[:params].key? :time
|
44
|
-
|
45
|
-
else
|
46
|
-
self.time = 0
|
47
|
-
end
|
51
|
+
self.time = options[:params][:time].to_s.to_i if options[:params].key? :time
|
52
|
+
self.version = options[:params][:version].to_s.to_i if options[:params].key? :version
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Etc
|
3
3
|
##
|
4
4
|
# Definitions of field options for table column or new (edit) form field.
|
@@ -62,7 +62,7 @@ module Anubis
|
|
62
62
|
class_attribute :options, default: nil
|
63
63
|
|
64
64
|
# @!attribute [rw]
|
65
|
-
# Describes if this field could return data for {
|
65
|
+
# Describes if this field could return data for {Anoubis::Data::Actions#autocomplete autocomplete} action.
|
66
66
|
# @return [Boolean] possibility for return data on autocomplete action.
|
67
67
|
#
|
68
68
|
# <b>Options:</b>
|
@@ -139,21 +139,21 @@ module Anubis
|
|
139
139
|
end
|
140
140
|
|
141
141
|
##
|
142
|
-
# Initialize additional parameters for {
|
142
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'string' field type} for controller actions.
|
143
143
|
# @param options [Hash] field's initial options
|
144
144
|
def initialize_string (options)
|
145
145
|
|
146
146
|
end
|
147
147
|
|
148
148
|
##
|
149
|
-
# Initialize additional parameters for {
|
149
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'boolean' field type} for controller actions.
|
150
150
|
# @param options [Hash] field's initial options
|
151
151
|
def initialize_boolean (options)
|
152
152
|
|
153
153
|
end
|
154
154
|
|
155
155
|
##
|
156
|
-
# Initialize additional parameters for {
|
156
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'number' field type} for controller actions.
|
157
157
|
# @param options [Hash] field's initial options
|
158
158
|
def initialize_number (options)
|
159
159
|
if options.key? :error_text
|
@@ -167,21 +167,21 @@ module Anubis
|
|
167
167
|
end
|
168
168
|
|
169
169
|
##
|
170
|
-
# Initialize additional parameters for {
|
170
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'text' field type} for controller actions.
|
171
171
|
# @param options [Hash] field's initial options
|
172
172
|
def initialize_text (options)
|
173
173
|
|
174
174
|
end
|
175
175
|
|
176
176
|
##
|
177
|
-
# Initialize additional parameters for {
|
177
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'html' field type} for controller actions.
|
178
178
|
# @param options [Hash] field's initial options
|
179
179
|
def initialize_html (options)
|
180
180
|
|
181
181
|
end
|
182
182
|
|
183
183
|
##
|
184
|
-
# Initialize additional parameters for {
|
184
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'datetime' field type} for controller actions.
|
185
185
|
# @param options [Hash] field's initial options
|
186
186
|
def initialize_datetime (options)
|
187
187
|
options[:format] = 'datetime' if !options.key? :format
|
@@ -190,7 +190,7 @@ module Anubis
|
|
190
190
|
end
|
191
191
|
|
192
192
|
##
|
193
|
-
# Setups additional parameters for {
|
193
|
+
# Setups additional parameters for {Anoubis::Etc::Field#type 'listbox' field type} for controller actions.
|
194
194
|
# @param options [Hash] field's initial options
|
195
195
|
def initialize_listbox (options)
|
196
196
|
self.options = FieldOptions.new if !self.options
|
@@ -220,7 +220,7 @@ module Anubis
|
|
220
220
|
end
|
221
221
|
|
222
222
|
##
|
223
|
-
# Initialize additional parameters for {
|
223
|
+
# Initialize additional parameters for {Anoubis::Etc::Field#type 'key' field type} for controller actions.
|
224
224
|
# @param options [Hash] field's initial options
|
225
225
|
def initialize_key (options)
|
226
226
|
if self.model
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Etc
|
3
3
|
##
|
4
4
|
# Definitions of filter options for data.
|
@@ -20,7 +20,7 @@ module Anubis
|
|
20
20
|
|
21
21
|
# @!attribute [rw]
|
22
22
|
# Defines reference for fields
|
23
|
-
# @return [Hash<
|
23
|
+
# @return [Hash<Anoubis::Etc::Field>] hash of fields
|
24
24
|
class_attribute :fields, default: nil
|
25
25
|
|
26
26
|
##
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Etc
|
3
3
|
##
|
4
4
|
# Class stores main menu parameters and variables
|
@@ -83,7 +83,7 @@ module Anubis
|
|
83
83
|
self.state = options[:state] if options.has_key? :state
|
84
84
|
self.access = options[:access] if options.has_key? :access
|
85
85
|
end
|
86
|
-
if options.class ==
|
86
|
+
if options.class == Anoubis::Sso::Client::Menu
|
87
87
|
self.title = options.title
|
88
88
|
self.page_title = options.page_title
|
89
89
|
self.short_title = options.short_title
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
##
|
3
3
|
# Module contains all procedures and function for output data. Module consists from {Basic}, {Frame}, {Login} and
|
4
4
|
# {Menu} classes.
|
@@ -30,7 +30,7 @@ module Anubis
|
|
30
30
|
self.result = 0
|
31
31
|
self.tab = ''
|
32
32
|
self.messages = {
|
33
|
-
'0': I18n.t('success'),
|
33
|
+
'0': I18n.t('anoubis.success'),
|
34
34
|
'-1': I18n.t('errors.access_not_allowed'),
|
35
35
|
'-2': I18n.t('errors.incorrect_parameters')
|
36
36
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Output
|
3
3
|
##
|
4
4
|
# Output subclass that represents data for frame action
|
@@ -16,11 +16,11 @@ module Anubis
|
|
16
16
|
class_attribute :access
|
17
17
|
|
18
18
|
# @!attribute [rw] tab_items
|
19
|
-
# @return [Array] the array of tab elements {
|
19
|
+
# @return [Array] the array of tab elements {Anoubis::Output::TabItem}.
|
20
20
|
class_attribute :tab_items
|
21
21
|
|
22
22
|
# @!attribute [rw] tabs
|
23
|
-
# @return [Hash] the hash of menu elements {
|
23
|
+
# @return [Hash] the hash of menu elements {Anoubis::Output::TabItem} with 'mode' as a key.
|
24
24
|
class_attribute :tabs
|
25
25
|
|
26
26
|
##
|
@@ -80,11 +80,11 @@ module Anubis
|
|
80
80
|
class_attribute :hint
|
81
81
|
|
82
82
|
# @!attribute [rw] button_items
|
83
|
-
# @return [Array] the array of tab elements {
|
83
|
+
# @return [Array] the array of tab elements {Anoubis::Output::FrameButtonItem}.
|
84
84
|
class_attribute :button_items
|
85
85
|
|
86
86
|
# @!attribute [rw] buttons
|
87
|
-
# @return [Hash] the hash of menu elements {
|
87
|
+
# @return [Hash] the hash of menu elements {Anoubis::Output::FrameButtonItem} with 'key' as a key.
|
88
88
|
class_attribute :buttons
|
89
89
|
|
90
90
|
# @!attribute [rw] filter
|
@@ -1,14 +1,14 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis
|
2
2
|
module Output
|
3
3
|
##
|
4
4
|
# Output subclass that represents data for menu action
|
5
5
|
class Menu < Basic
|
6
6
|
# @!attribute [rw] items
|
7
|
-
# @return [Array] the array of menu elements {
|
7
|
+
# @return [Array] the array of menu elements {Anoubis::Output::MenuItem}.
|
8
8
|
class_attribute :items
|
9
9
|
|
10
10
|
# @!attribute [rw] keys
|
11
|
-
# @return [Hash] the hash of menu elements {
|
11
|
+
# @return [Hash] the hash of menu elements {Anoubis::Output::MenuItem} with 'mode' as a key.
|
12
12
|
class_attribute :keys
|
13
13
|
|
14
14
|
# @!attribute [rw] user
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Anoubis::Sso::Client::ApplicationController < Anoubis::Core::ApplicationController
|
2
2
|
|
3
3
|
def sso_server
|
4
4
|
Rails.configuration.sso_server
|
@@ -16,7 +16,7 @@ class Anubis::Sso::Client::ApplicationController < Anubis::Core::ApplicationCont
|
|
16
16
|
begin
|
17
17
|
model = Rails.configuration.user_model.classify.constantize
|
18
18
|
rescue
|
19
|
-
model =
|
19
|
+
model = Anoubis::Sso::Server::User
|
20
20
|
end
|
21
21
|
|
22
22
|
model
|
@@ -1,6 +1,6 @@
|
|
1
|
-
module
|
1
|
+
module Anoubis::Sso::Client::Index::Actions
|
2
2
|
def menu
|
3
|
-
self.output =
|
3
|
+
self.output = Anoubis::Output::Menu.new
|
4
4
|
|
5
5
|
if self.current_user
|
6
6
|
self.output.user = {
|
@@ -10,7 +10,7 @@ module Anubis::Sso::Client::Index::Actions
|
|
10
10
|
}
|
11
11
|
end
|
12
12
|
|
13
|
-
access =
|
13
|
+
access = Anoubis::Sso::Client::GroupMenu.accesses[:read].to_s+','+Anoubis::Sso::Client::GroupMenu.accesses[:write].to_s
|
14
14
|
query = <<-SQL
|
15
15
|
SELECT `t`.* FROM
|
16
16
|
(
|
@@ -32,7 +32,7 @@ module Anubis::Sso::Client::Index::Actions
|
|
32
32
|
)
|
33
33
|
ORDER BY `t`.`menu_id`, `t`.`position`
|
34
34
|
SQL
|
35
|
-
|
35
|
+
Anoubis::Sso::Client::GroupMenu.find_by_sql(query).each do |data|
|
36
36
|
self.output.addElement({
|
37
37
|
mode: data.mode,
|
38
38
|
title: data.title,
|
@@ -42,7 +42,7 @@ module Anubis::Sso::Client::Index::Actions
|
|
42
42
|
tab: data.tab,
|
43
43
|
action: data.action,
|
44
44
|
access: data.access,
|
45
|
-
state:
|
45
|
+
state: Anoubis::Sso::Client::Menu.states.invert[data.state],
|
46
46
|
parent: data.parent_mode
|
47
47
|
})
|
48
48
|
#self.output[:data].push menu_id[data.id.to_s.to_sym]
|
@@ -56,7 +56,7 @@ module Anubis::Sso::Client::Index::Actions
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def logout
|
59
|
-
self.output =
|
59
|
+
self.output = Anoubis::Output::Basic.new
|
60
60
|
self.output.result = 0
|
61
61
|
|
62
62
|
begin
|
@@ -1,9 +1,9 @@
|
|
1
|
-
require_dependency "
|
2
|
-
require_dependency "
|
1
|
+
require_dependency "anoubis/sso/client/index/actions"
|
2
|
+
require_dependency "anoubis/sso/client/index/callbacks"
|
3
3
|
|
4
|
-
class
|
5
|
-
include
|
6
|
-
include
|
4
|
+
class Anoubis::Sso::Client::IndexController < Anoubis::Sso::Client::ApplicationController
|
5
|
+
include Anoubis::Sso::Client::Index::Actions
|
6
|
+
include Anoubis::Sso::Client::Index::Callbacks
|
7
7
|
|
8
8
|
##
|
9
9
|
# Check if authentication required
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class
|
1
|
+
class Anoubis::Sso::Server::ApplicationController < Anoubis::Core::ApplicationController
|
2
2
|
def user_model
|
3
3
|
begin
|
4
4
|
model = Rails.configuration.user_model.classify.constantize
|
5
5
|
rescue
|
6
|
-
model =
|
6
|
+
model = Anoubis::Sso::Server::User
|
7
7
|
end
|
8
8
|
|
9
9
|
model
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Anoubis::Sso::Server::LoginController < Anoubis::Sso::Server::ApplicationController
|
2
2
|
include ActionController::Cookies
|
3
3
|
|
4
4
|
def authenticate?
|
@@ -23,7 +23,7 @@ class Anubis::Sso::Server::LoginController < Anubis::Sso::Server::ApplicationCon
|
|
23
23
|
|
24
24
|
result = {
|
25
25
|
result: 0,
|
26
|
-
message: I18n.t('
|
26
|
+
message: I18n.t('anoubis.success')
|
27
27
|
}
|
28
28
|
code = 200
|
29
29
|
|
@@ -107,7 +107,7 @@ class Anubis::Sso::Server::LoginController < Anubis::Sso::Server::ApplicationCon
|
|
107
107
|
def create
|
108
108
|
result = {
|
109
109
|
result: 0,
|
110
|
-
message: I18n.t('
|
110
|
+
message: I18n.t('anoubis.success')
|
111
111
|
}
|
112
112
|
code = 200
|
113
113
|
|
@@ -155,7 +155,7 @@ class Anubis::Sso::Server::LoginController < Anubis::Sso::Server::ApplicationCon
|
|
155
155
|
def update
|
156
156
|
result = {
|
157
157
|
result: 0,
|
158
|
-
message: I18n.t('
|
158
|
+
message: I18n.t('anoubis.success')
|
159
159
|
}
|
160
160
|
|
161
161
|
if self.system
|
@@ -213,7 +213,7 @@ class Anubis::Sso::Server::LoginController < Anubis::Sso::Server::ApplicationCon
|
|
213
213
|
def destroy
|
214
214
|
result = {
|
215
215
|
result: 0,
|
216
|
-
message: I18n.t('
|
216
|
+
message: I18n.t('anoubis.success')
|
217
217
|
}
|
218
218
|
|
219
219
|
begin
|
@@ -263,7 +263,7 @@ class Anubis::Sso::Server::LoginController < Anubis::Sso::Server::ApplicationCon
|
|
263
263
|
def show
|
264
264
|
result = {
|
265
265
|
result: 0,
|
266
|
-
message: I18n.t('
|
266
|
+
message: I18n.t('anoubis.success')
|
267
267
|
}
|
268
268
|
|
269
269
|
if self.system
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Anoubis::Sso::Server::UserController < Anoubis::Sso::Server::ApplicationController
|
2
2
|
def authenticate?
|
3
3
|
false
|
4
4
|
end
|
@@ -6,7 +6,7 @@ class Anubis::Sso::Server::UserController < Anubis::Sso::Server::ApplicationCont
|
|
6
6
|
def show
|
7
7
|
result = {
|
8
8
|
result: 0,
|
9
|
-
message: I18n.t('
|
9
|
+
message: I18n.t('anoubis.success')
|
10
10
|
}
|
11
11
|
code = 200
|
12
12
|
|
@@ -25,7 +25,7 @@ class Anubis::Sso::Server::UserController < Anubis::Sso::Server::ApplicationCont
|
|
25
25
|
def update
|
26
26
|
result = {
|
27
27
|
result: 0,
|
28
|
-
message: I18n.t('
|
28
|
+
message: I18n.t('anoubis.success')
|
29
29
|
}
|
30
30
|
code = 200
|
31
31
|
|