Splitted administration and normal web site interfaces.
This optimises a bit the routing map, and make cleaner separation. Make the base url for admin pages customizable via `administration.base_path` variable in cms.ini note: could be /admin, /roc-admin, or .. It is possible to have a specific theme for administration via the variable "administration.admin"
This commit is contained in:
@@ -204,10 +204,10 @@ feature -- Execution
|
||||
|
||||
create l_mods_to_install.make (0)
|
||||
across
|
||||
a_response.api.setup.modules as ic
|
||||
api.setup.modules as ic
|
||||
loop
|
||||
mod := ic.item
|
||||
if not a_response.api.is_module_installed (mod) then
|
||||
if not api.is_module_installed (mod) then
|
||||
l_mods_to_install.extend (mod)
|
||||
else
|
||||
create l_extra.make_empty
|
||||
@@ -286,10 +286,10 @@ feature -- Execution
|
||||
create Result.make (a_response.url (a_response.location, Void), "modules_collection")
|
||||
create l_mods_to_install.make (0)
|
||||
across
|
||||
a_response.api.setup.modules as ic
|
||||
api.setup.modules as ic
|
||||
loop
|
||||
mod := ic.item
|
||||
if not a_response.api.is_module_installed (mod) then
|
||||
if not api.is_module_installed (mod) then
|
||||
l_mods_to_install.extend (mod)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,14 +23,14 @@ feature -- Process
|
||||
l_package: READABLE_STRING_8
|
||||
do
|
||||
create l_admin_links.make (5)
|
||||
l_admin_links.force (["core", <<"admin users">>, local_link ("Users", "admin/users"), "View/Edit/Add Users"])
|
||||
l_admin_links.force (["core", <<"admin roles">>, local_link ("Roles", "admin/roles"), "View/Edit/Add Roles"])
|
||||
l_admin_links.force (["core", <<"admin modules">>, local_link ("Modules", "admin/modules"), "(un)Install modules"])
|
||||
l_admin_links.force (["core", <<"view logs">>, local_link ("Logs", "admin/logs"), "View logs"])
|
||||
l_admin_links.force (["core", <<"admin path_alias">>, local_link ("Path Alias", "admin/path_alias"), "Manage path aliases"])
|
||||
l_admin_links.force (["support", <<"admin cache">>, local_link ("Cache", "admin/cache"), "Clear caches"])
|
||||
l_admin_links.force (["support", <<"admin export">>, local_link ("Export", "admin/export"), "Export CMS contents, and modules contents."])
|
||||
l_admin_links.force (["support", <<"admin import">>, local_link ("Import", "admin/import"), "Import CMS contents, and modules contents."])
|
||||
l_admin_links.force (["core", <<"admin users">>, administration_link ("Users", "users"), "View/Edit/Add Users"])
|
||||
l_admin_links.force (["core", <<"admin roles">>, administration_link ("Roles", "roles"), "View/Edit/Add Roles"])
|
||||
l_admin_links.force (["core", <<"admin modules">>, administration_link ("Modules", "modules"), "(un)Install modules"])
|
||||
l_admin_links.force (["core", <<"view logs">>, administration_link ("Logs", "logs"), "View logs"])
|
||||
l_admin_links.force (["core", <<"admin path_alias">>, administration_link ("Path Alias", "path_alias"), "Manage path aliases"])
|
||||
l_admin_links.force (["support", <<"admin cache">>, administration_link ("Cache", "cache"), "Clear caches"])
|
||||
l_admin_links.force (["support", <<"admin export">>, administration_link ("Export", "export"), "Export CMS contents, and modules contents."])
|
||||
l_admin_links.force (["support", <<"admin import">>, administration_link ("Import", "import"), "Import CMS contents, and modules contents."])
|
||||
create categories.make_caseless (3)
|
||||
across
|
||||
l_admin_links as ic
|
||||
|
||||
@@ -91,7 +91,7 @@ feature -- HTTP Methods
|
||||
u := ic.item
|
||||
s.append ("<li class=%"cms_role%">")
|
||||
s.append ("<a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/role/" + u.id.out))
|
||||
s.append (req.absolute_script_url (api.administration_path ("/role/") + u.id.out))
|
||||
s.append ("%">")
|
||||
s.append (html_encoded (u.name))
|
||||
s.append ("</a>")
|
||||
@@ -101,7 +101,7 @@ feature -- HTTP Methods
|
||||
end
|
||||
|
||||
if l_response.has_permission ("admin roles") then
|
||||
s.append (l_response.link ("Add Role", "admin/add/role", Void))
|
||||
s.append (l_response.link ("Add Role", api.administration_path_location ("add/role"), Void))
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ feature -- Process Edit
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_role.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), "admin/role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -103,9 +103,9 @@ feature -- Process Delete
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_role.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void), "admin/role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "role/" + a_role.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "role/" + a_role.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "role/" + a_role.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -283,7 +283,7 @@ feature -- Form
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Cancel")
|
||||
ts.set_formmethod ("GET")
|
||||
ts.set_formaction ("/admin/role/" + a_role.id.out)
|
||||
ts.set_formaction (api.administration_path ("/role/" + a_role.id.out))
|
||||
f.extend (ts)
|
||||
end
|
||||
Result := f
|
||||
@@ -434,7 +434,7 @@ feature -- Form
|
||||
api.user_api.save_user_role (a_role)
|
||||
if not api.user_api.has_error then
|
||||
add_success_message ("Permissions updated")
|
||||
set_redirection (absolute_url ("admin/role/" + a_role.id.out, Void))
|
||||
set_redirection (absolute_url (api.administration_path_location ("role/" + a_role.id.out), Void))
|
||||
else
|
||||
add_error_message ("Error during permissions update operation.")
|
||||
end
|
||||
@@ -458,8 +458,8 @@ feature -- Form
|
||||
if api.user_api.has_error then
|
||||
-- handle error
|
||||
else
|
||||
add_success_message ("Created Role " + link (l_role, "admin/role/" + u.id.out, Void))
|
||||
set_redirection (absolute_url ("admin/role/" + u.id.out, Void))
|
||||
add_success_message ("Created Role " + link (l_role, api.administration_path_location ("role/" + u.id.out), Void))
|
||||
set_redirection (absolute_url (api.administration_path_location ("role/" + u.id.out), Void))
|
||||
end
|
||||
else
|
||||
a_form_data.report_invalid_field ("username", "Missing role!")
|
||||
|
||||
@@ -86,11 +86,11 @@ feature -- HTTP Methods
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
if r.has_permission ("admin roles") then
|
||||
if req.percent_encoded_path_info.ends_with_general ("/edit") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/role/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/role/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
elseif req.percent_encoded_path_info.ends_with_general ("/delete") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/role/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/role/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
@@ -192,7 +192,7 @@ feature {NONE} -- New role
|
||||
local
|
||||
edit_response: CMS_ROLE_FORM_RESPONSE
|
||||
do
|
||||
if req.percent_encoded_path_info.starts_with_general ("/admin/add/role") then
|
||||
if req.percent_encoded_path_info.starts_with_general (api.administration_path ("/add/role")) then
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
|
||||
@@ -52,16 +52,17 @@ feature -- Execution
|
||||
s: STRING
|
||||
do
|
||||
a_response.set_value (a_role, "role")
|
||||
create lnk.make (a_response.translation ("View", Void), "admin/role/" + a_role.id.out)
|
||||
lnk := api.administration_link (a_response.translation ("View", Void), "role/" + a_role.id.out)
|
||||
lnk.set_is_active (True)
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
create lnk.make (a_response.translation ("Edit", Void), "admin/role/" + a_role.id.out + "/edit")
|
||||
|
||||
lnk := api.administration_link (a_response.translation ("Edit", Void), "role/" + a_role.id.out + "/edit")
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if a_role /= Void and then a_role.id > 0 then
|
||||
create lnk.make (a_response.translation ("Delete", Void), "admin/role/" + a_role.id.out + "/delete")
|
||||
lnk := api.administration_link (a_response.translation ("Delete", Void), "role/" + a_role.id.out + "/delete")
|
||||
lnk.set_weight (3)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
|
||||
@@ -89,7 +89,7 @@ feature -- HTTP Methods
|
||||
end
|
||||
|
||||
create s_pager.make_empty
|
||||
create l_page_helper.make ("admin/users/?page={page}&size={size}", user_api.users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
create l_page_helper.make (api.administration_path_location ("users/?page={page}&size={size}"), user_api.users_count.as_natural_64, 25) -- FIXME: Make this default page size a global CMS settings
|
||||
l_page_helper.get_setting_from_request (req)
|
||||
if l_page_helper.has_upper_limit and then l_page_helper.pages_count > 1 then
|
||||
l_page_helper.append_to_html (l_response, s_pager)
|
||||
@@ -107,7 +107,7 @@ feature -- HTTP Methods
|
||||
u := ic.item
|
||||
s.append ("<li class=%"user%">")
|
||||
s.append ("<span class=%"identifier%"><a href=%"")
|
||||
s.append (req.absolute_script_url ("/admin/user/"+u.id.out))
|
||||
s.append (req.absolute_script_url (api.administration_path ("/user/" + u.id.out)))
|
||||
s.append ("%">")
|
||||
l_display_name := user_api.user_display_name (u)
|
||||
s.append (html_encoded (l_display_name))
|
||||
@@ -151,7 +151,7 @@ feature -- HTTP Methods
|
||||
s.append (s_pager)
|
||||
|
||||
if l_response.has_permission ("manage " + {CMS_ADMIN_MODULE}.name) then
|
||||
s.append (l_response.link ("Add User", "admin/add/user", Void))
|
||||
s.append (api.link ("Add User", api.administration_path_location ("add/user"), Void))
|
||||
end
|
||||
|
||||
l_response.set_main_content (s)
|
||||
|
||||
@@ -72,9 +72,9 @@ feature -- Process Edit
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_user.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void),"admin/user/" + a_user.id.out), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void),"admin/user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void),"admin/user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void), "user/" + a_user.id.out), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void), "user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void), "user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -103,9 +103,9 @@ feature -- Process Delete
|
||||
fd := f.last_data
|
||||
end
|
||||
if a_user.has_id then
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("View", Void),"admin/user/" + a_user.id.out ), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Edit", Void),"admin/user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (create {CMS_LOCAL_LINK}.make (translation ("Delete", Void),"admin/user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("View", Void),"user/" + a_user.id.out ), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Edit", Void),"user/" + a_user.id.out + "/edit"), primary_tabs)
|
||||
add_to_menu (api.administration_link (translation ("Delete", Void),"user/" + a_user.id.out + "/delete"), primary_tabs)
|
||||
end
|
||||
if attached redirection as l_location then
|
||||
-- FIXME: Hack for now
|
||||
@@ -180,7 +180,7 @@ feature -- Form
|
||||
if a_user /= Void then
|
||||
l_user := a_user
|
||||
if l_user.has_id then
|
||||
create {CMS_LOCAL_LINK} lnk.make (translation ("View", Void),"admin/user/" + l_user.id.out )
|
||||
lnk := api.administration_link (translation ("View", Void),"user/" + l_user.id.out)
|
||||
change_user (fd, a_user)
|
||||
s := "modified"
|
||||
set_redirection (lnk.location)
|
||||
@@ -302,7 +302,7 @@ feature -- Form
|
||||
create ts.make ("op")
|
||||
ts.set_default_value ("Cancel")
|
||||
ts.set_formmethod ("GET")
|
||||
ts.set_formaction ("/admin/user/" + a_user.id.out)
|
||||
ts.set_formaction (api.administration_path ("/user/" + a_user.id.out))
|
||||
f.extend (ts)
|
||||
end
|
||||
|
||||
|
||||
@@ -86,11 +86,11 @@ feature -- HTTP Methods
|
||||
create {FORBIDDEN_ERROR_CMS_RESPONSE} r.make (req, res, api)
|
||||
if r.has_permission ("admin users") then
|
||||
if req.percent_encoded_path_info.ends_with_general ("/edit") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/user/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/user/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
elseif req.percent_encoded_path_info.ends_with_general ("/delete") then
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general ("/admin/user/") end
|
||||
check valid_url: req.percent_encoded_path_info.starts_with_general (api.administration_path ("/user/")) end
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
@@ -192,7 +192,7 @@ feature {NONE} -- New User
|
||||
local
|
||||
edit_response: CMS_USER_FORM_RESPONSE
|
||||
do
|
||||
if req.percent_encoded_path_info.starts_with ("/admin/add/user") then
|
||||
if req.percent_encoded_path_info.starts_with (api.administration_path ("/add/user")) then
|
||||
create edit_response.make (req, res, api)
|
||||
edit_response.execute
|
||||
else
|
||||
|
||||
@@ -53,17 +53,17 @@ feature -- Execution
|
||||
ago: DATE_TIME_AGO_CONVERTER
|
||||
do
|
||||
a_response.set_value (a_user, "user")
|
||||
create lnk.make (a_response.translation ("View", Void), "admin/user/" + a_user.id.out)
|
||||
lnk := api.administration_link (a_response.translation ("View", Void), "user/" + a_user.id.out)
|
||||
lnk.set_is_active (True)
|
||||
lnk.set_weight (1)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
create lnk.make (a_response.translation ("Edit", Void), "admin/user/" + a_user.id.out + "/edit")
|
||||
lnk := api.administration_link (a_response.translation ("Edit", Void), "user/" + a_user.id.out + "/edit")
|
||||
lnk.set_permission_arguments (<<"manage admin", "manage users", "manage own user">>)
|
||||
lnk.set_weight (2)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
|
||||
if a_user /= Void and then a_user.id > 0 then
|
||||
create lnk.make (a_response.translation ("Delete", Void), "admin/user/" + a_user.id.out + "/delete")
|
||||
lnk := api.administration_link (a_response.translation ("Delete", Void), "user/" + a_user.id.out + "/delete")
|
||||
lnk.set_weight (3)
|
||||
a_response.add_to_primary_tabs (lnk)
|
||||
end
|
||||
@@ -102,7 +102,7 @@ feature -- Execution
|
||||
across l_roles as ic loop
|
||||
l_role := ic.item
|
||||
s.append ("<li>")
|
||||
s.append (link (l_role.name, "admin/role/" + l_role.id.out, Void))
|
||||
s.append (link (l_role.name, api.administration_path_location ("role/" + l_role.id.out), Void))
|
||||
s.append ("</li>")
|
||||
if request.query_parameter ("debug") /= Void then
|
||||
s.append ("<h5>Permissions:</h5>")
|
||||
|
||||
Reference in New Issue
Block a user