Class: Marty::MainAuthApp
Constant Summary
Constants included
from Permissions
Permissions::ALL_ROLES, Permissions::REQ_ROLES
Class Method Summary
collapse
Instance Method Summary
collapse
can_perform_action?, can_perform_actions, current_user_roles, has_any_perm?, has_marty_permissions
Methods inherited from AuthApp
#user_menu
Methods inherited from SimpleApp
#configure, #js_component_html, #js_component_render, #main_panel_config, #menu_bar_config, #status_bar_config
Class Method Details
.has_posting_perm? ⇒ Boolean
set of posting types user is allowed to post with
.has_scripting_perm? ⇒ Boolean
23
24
25
|
# File 'app/components/marty/main_auth_app.rb', line 23
def self.has_scripting_perm?
self.has_admin_perm?
end
|
Instance Method Details
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'app/components/marty/main_auth_app.rb', line 66
def
[
{
text: 'API Management',
icon: icon_hack(:wrench),
disabled: !self.class.has_admin_perm?,
menu: [
:api_auth_view,
:api_config_view,
:api_log_view,
]
}
]
end
|
#app_moniker ⇒ Object
129
130
131
|
# File 'app/components/marty/main_auth_app.rb', line 129
def app_moniker
warped ? 0x231B.chr('utf-8') : 0x03FB.chr('utf-8')
end
|
#app_title ⇒ Object
133
134
135
136
137
138
139
140
|
# File 'app/components/marty/main_auth_app.rb', line 133
def app_title
e = ENV['RAILS_ENV']
title = "#{app_moniker} #{Rails.application.class.parent_name.titleize}"
title += " - #{e.capitalize}" unless e == 'production'
title += ' [TIME WARPED]' if warped
title
end
|
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'app/components/marty/main_auth_app.rb', line 97
def
{
text: I18n.t("applications"),
icon: icon_hack(:application_cascade),
menu: [
:data_grid_view,
:reporting,
:scripting,
:promise_view,
],
}
end
|
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'app/components/marty/main_auth_app.rb', line 110
def
[
{
text: 'Background Jobs',
icon: icon_hack(:clock),
disabled: !self.class.has_admin_perm?,
menu: [
:bg_status,
:bg_stop,
:bg_restart,
]
},
]
end
|
#bg_command(param) ⇒ Object
299
300
301
302
303
304
305
306
307
308
|
# File 'app/components/marty/main_auth_app.rb', line 299
def bg_command(param)
e, root, p = ENV['RAILS_ENV'], Rails.root, Marty::Config["RUBY_PATH"]
dj_path = Marty::Config["DELAYED_JOB_PATH"] || 'bin/delayed_job'
cmd = "export RAILS_ENV=#{e};"
cmd += "export PATH=#{p}:$PATH;" if p
cmd += "#{root}/#{dj_path} #{param} 2>&1"
cmd
end
|
149
150
151
|
# File 'app/components/marty/main_auth_app.rb', line 149
def
[]
end
|
#icon_hack(name) ⇒ Object
31
32
33
34
35
|
# File 'app/components/marty/main_auth_app.rb', line 31
def icon_hack(name)
"#{Netzke::Core.ext_uri}/../icons/#{name}.png"
end
|
142
143
144
145
146
147
|
# File 'app/components/marty/main_auth_app.rb', line 142
def
"<span style='color:#3333FF;
background-color:#{warped ? '#FBDF4F' : ''};
font-size:120%;
font-weight:bold;'>#{app_title}</span>"
end
|
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/components/marty/main_auth_app.rb', line 52
def
[
{
text: 'Log Maintenance',
icon: icon_hack(:wrench),
disabled: !self.class.has_admin_perm?,
menu: [
:log_view,
:log_cleanup,
]
}
]
end
|
153
154
155
156
157
158
159
160
161
162
163
164
|
# File 'app/components/marty/main_auth_app.rb', line 153
def
return super unless self.class.has_any_perm?
[, sep] +
(self.class.has_admin_perm? ||
self.class.has_user_manager_perm? ? [, sep] : []) +
+
[
, sep,
, sep,
] + super
end
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'app/components/marty/main_auth_app.rb', line 37
def
{
text: warped ? "#{Marty::Util.get_posting.name}" : I18n.t("postings"),
name: "posting",
tooltip: "Postings",
icon: icon_hack(:time),
style: (warped ? "background-color: lightGrey;" : ""),
menu: [
:new_posting,
:select_posting,
:select_now,
],
}
end
|
#sep ⇒ Object
27
28
29
|
# File 'app/components/marty/main_auth_app.rb', line 27
def sep
{ xtype: 'tbseparator' }
end
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'app/components/marty/main_auth_app.rb', line 81
def
{
text: I18n.t("system"),
icon: icon_hack(:wrench),
style: "",
menu: [
:import_type_view,
:user_view,
:config_view,
:event_view,
:reload_scripts,
:load_seed,
] + + +
}
end
|
#warped ⇒ Object
125
126
127
|
# File 'app/components/marty/main_auth_app.rb', line 125
def warped
Marty::Util.warped?
end
|