Added system info admin page.
This commit is contained in:
@@ -27,6 +27,7 @@ feature -- Security
|
||||
-- List of permission ids, used by this module, and declared.
|
||||
do
|
||||
Result := Precursor
|
||||
Result.force (perm_view_system_info)
|
||||
Result.force ("access admin")
|
||||
Result.force ("admin users")
|
||||
Result.force ("admin roles")
|
||||
@@ -39,6 +40,8 @@ feature -- Security
|
||||
Result.force ("admin formats")
|
||||
end
|
||||
|
||||
perm_view_system_info: STRING = "view system info"
|
||||
|
||||
feature {NONE} -- Router/administration
|
||||
|
||||
setup_administration_router (a_router: WSF_ROUTER; a_api: CMS_API)
|
||||
@@ -46,6 +49,8 @@ feature {NONE} -- Router/administration
|
||||
local
|
||||
l_admin_handler: CMS_ADMIN_HANDLER
|
||||
|
||||
l_info_handler: CMS_ADMIN_INFO_HANDLER
|
||||
|
||||
l_modules_handler: CMS_ADMIN_MODULES_HANDLER
|
||||
l_users_handler: CMS_ADMIN_USERS_HANDLER
|
||||
l_roles_handler: CMS_ADMIN_ROLES_HANDLER
|
||||
@@ -67,6 +72,10 @@ feature {NONE} -- Router/administration
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("", l_admin_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
|
||||
create l_info_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/info", l_info_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get)
|
||||
|
||||
create l_modules_handler.make (a_api)
|
||||
create l_uri_mapping.make_trailing_slash_ignored ("/modules", l_modules_handler)
|
||||
a_router.map (l_uri_mapping, a_router.methods_get_post)
|
||||
@@ -146,27 +155,39 @@ feature -- Hooks
|
||||
if l_api.user_is_authenticated then
|
||||
admin_lnk := a_menu_system.management_menu.new_composite_item ("Admin", l_api.administration_path_location (""))
|
||||
|
||||
-- Global system information
|
||||
create lnk.make ("Info", l_api.administration_path_location ("info"))
|
||||
lnk.set_permission_arguments (<<"view system info">>)
|
||||
lnk.set_weight (-1)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
create lnk.make ("Module", l_api.administration_path_location ("modules"))
|
||||
lnk.set_permission_arguments (<<"manage module">>)
|
||||
lnk.set_weight (1)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
create lnk.make ("Formats", l_api.administration_path_location ("formats"))
|
||||
lnk.set_permission_arguments (<<"admin formats">>)
|
||||
lnk.set_weight (2)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module cache permission!
|
||||
create lnk.make ("Cache", l_api.administration_path_location ("cache"))
|
||||
lnk.set_permission_arguments (<<"admin cache">>)
|
||||
lnk.set_weight (3)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
-- Per module export permission!
|
||||
create lnk.make ("Export", l_api.administration_path_location ("export"))
|
||||
lnk.set_permission_arguments (<<"admin export">>)
|
||||
lnk.set_weight (8)
|
||||
admin_lnk.extend (lnk)
|
||||
-- Per module import permission!
|
||||
create lnk.make ("Import", l_api.administration_path_location ("import"))
|
||||
lnk.set_permission_arguments (<<"admin import">>)
|
||||
lnk.set_weight (9)
|
||||
admin_lnk.extend (lnk)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
80
modules/admin/handler/cms_admin_info_handler.e
Normal file
80
modules/admin/handler/cms_admin_info_handler.e
Normal file
@@ -0,0 +1,80 @@
|
||||
note
|
||||
description: "Display information about ROC CMS installation."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_ADMIN_INFO_HANDLER
|
||||
|
||||
inherit
|
||||
CMS_HANDLER
|
||||
|
||||
WSF_URI_HANDLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Execution
|
||||
|
||||
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
|
||||
-- Execute request handler
|
||||
local
|
||||
r: like new_generic_response
|
||||
s: STRING
|
||||
do
|
||||
if req.is_get_request_method then
|
||||
if api.has_permission ({CMS_ADMIN_MODULE_ADMINISTRATION}.perm_view_system_info) then
|
||||
r := new_generic_response (req, res)
|
||||
create s.make_empty
|
||||
r.set_title ("System Information")
|
||||
r.add_to_primary_tabs (api.administration_link ("Administration", ""))
|
||||
append_system_info_to (s)
|
||||
r.set_main_content (s)
|
||||
r.execute
|
||||
else
|
||||
send_access_denied (req, res)
|
||||
end
|
||||
else
|
||||
send_bad_request (req, res)
|
||||
end
|
||||
end
|
||||
|
||||
append_system_info_to (s: STRING)
|
||||
local
|
||||
n: INTEGER
|
||||
do
|
||||
s.append ("<ul>")
|
||||
s.append ("<li><strong>Current direction:</strong> ")
|
||||
s.append (html_encoded ((create {EXECUTION_ENVIRONMENT}).current_working_path.name))
|
||||
s.append ("</li>")
|
||||
s.append ("<li><strong>Site:</strong> ")
|
||||
s.append (html_encoded (api.setup.site_location.name))
|
||||
s.append ("</li>")
|
||||
s.append ("<li><strong>Cache:</strong> ")
|
||||
s.append (html_encoded (api.setup.cache_location.name))
|
||||
s.append ("</li>")
|
||||
s.append ("<li><strong>Files:</strong> ")
|
||||
s.append (html_encoded (api.setup.files_location.name))
|
||||
s.append ("</li>")
|
||||
s.append ("<li><strong>Temp:</strong> ")
|
||||
s.append (html_encoded (api.setup.temp_location.name))
|
||||
s.append ("</li>")
|
||||
s.append ("<li><strong>Storage:</strong>")
|
||||
n := s.count
|
||||
across
|
||||
api.setup.storage_drivers as ic
|
||||
loop
|
||||
if s.count > n then
|
||||
s.append (", ")
|
||||
else
|
||||
s.append (" ")
|
||||
end
|
||||
s.append (html_encoded (ic.key))
|
||||
end
|
||||
s.append (" -> ")
|
||||
s.append (api.storage.generator)
|
||||
s.append ("</li>")
|
||||
s.append ("</ul>")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user