Added CMS_API.request: WSF_REQUEST to ease dev of ROC CMS code.
- Removed CMS_REQUEST_UTIL - centralize a few request related code into CMS_API Added CMS_API.user, CMS_API.set_user (CMS_USER), ... and user related routines. Refactored Auth related code - added various abstractions to factorize implementation and harmonize solutions. - revisited the logout strategy. - updated the account info page, and remove info user should not care about. - simplified the process, and encourage auth module to follow same design. Added CMS_LINK helper routines to modify the related query string. Removed CMS_USER.profile (and related routines) - It was not used so far. - it will probably a specific module later, if needed. Update various module to avoid fetching user from sql directly, and let this task to CMS_USER_API. Removed CMS_NODE_API.node_author (a_node: CMS_NODE): detachable CMS_USER, - as the info is already in CMS_NODE.author Added CMS_RESPONSE.redirection_delay, if ever one code want to redirect after a few seconds. Added the request uri info to the not found cms response.
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
note
|
||||
description: "Set of helper features related to CMS Request needs."
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
deferred class
|
||||
CMS_REQUEST_UTIL
|
||||
|
||||
inherit
|
||||
CMS_ENCODERS
|
||||
|
||||
REFACTORING_HELPER
|
||||
|
||||
feature -- User
|
||||
|
||||
current_user_name (req: WSF_REQUEST): detachable READABLE_STRING_32
|
||||
-- Current user name or Void in case of Guest users.
|
||||
note
|
||||
EIS: "src=eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
|
||||
do
|
||||
if attached {CMS_USER} current_user (req) as l_user then
|
||||
Result := l_user.name
|
||||
end
|
||||
end
|
||||
|
||||
current_user (req: WSF_REQUEST): detachable CMS_USER
|
||||
-- Current user or Void in case of Guest user.
|
||||
-- note: if a CMS_RESPONSE is available, always prefer {CMS_RESPONSE}.user if relevant.
|
||||
note
|
||||
EIS: "eiffel:?class=AUTHENTICATION_FILTER&feature=execute"
|
||||
do
|
||||
if attached {CMS_USER} req.execution_variable (current_user_execution_variable_name) as l_user then
|
||||
Result := l_user
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_current_user (req: WSF_REQUEST; a_user: detachable CMS_USER)
|
||||
-- Set `a_user' as `current_user'.
|
||||
do
|
||||
if a_user = Void then
|
||||
req.unset_execution_variable (current_user_execution_variable_name)
|
||||
else
|
||||
req.set_execution_variable (current_user_execution_variable_name, a_user)
|
||||
end
|
||||
ensure
|
||||
user_set: current_user (req) ~ a_user
|
||||
end
|
||||
|
||||
unset_current_user (req: WSF_REQUEST)
|
||||
-- Unset current user.
|
||||
do
|
||||
req.unset_execution_variable (current_user_execution_variable_name)
|
||||
ensure
|
||||
user_unset: current_user (req) = Void
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: current user
|
||||
|
||||
current_user_execution_variable_name: STRING = "_cms_active_user_"
|
||||
-- Execution variable name used to keep current user data.
|
||||
|
||||
feature -- Media Type
|
||||
|
||||
current_media_type (req: WSF_REQUEST): detachable READABLE_STRING_32
|
||||
-- Current media type or Void if it's not acceptable.
|
||||
do
|
||||
if attached {STRING} req.execution_variable ("media_type") as l_type then
|
||||
Result := l_type
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -1,6 +1,5 @@
|
||||
note
|
||||
description: "Summary description for {CMS_URL_UTILITIES}."
|
||||
author: ""
|
||||
description: "Collection of helper routines to manipulate URL for CMS."
|
||||
date: "$Date: 2015-02-13 13:08:13 +0100 (ven., 13 févr. 2015) $"
|
||||
revision: "$Revision: 96616 $"
|
||||
|
||||
@@ -8,7 +7,7 @@ deferred class
|
||||
CMS_URL_UTILITIES
|
||||
|
||||
inherit
|
||||
CMS_REQUEST_UTIL
|
||||
CMS_ENCODERS
|
||||
|
||||
feature -- Core
|
||||
|
||||
@@ -43,12 +42,16 @@ feature -- Core
|
||||
feature -- Link
|
||||
|
||||
link (a_text: detachable READABLE_STRING_GENERAL; a_path: READABLE_STRING_8; opts: detachable CMS_API_OPTIONS): STRING
|
||||
-- HTML link with title `a_text' and href `a_path'.
|
||||
-- `opts' is used for additional settings.
|
||||
do
|
||||
create Result.make (32)
|
||||
append_link_to_html (a_text, a_path, opts, Result)
|
||||
end
|
||||
|
||||
link_with_raw_text (a_raw_text: detachable READABLE_STRING_8; a_path: READABLE_STRING_8; opts: detachable CMS_API_OPTIONS): STRING
|
||||
-- HTML link with title the html code `a_raw_text' and href `a_path'.
|
||||
-- `opts' is used for additional settings.
|
||||
do
|
||||
create Result.make (32)
|
||||
append_link_with_raw_text_to_html (a_raw_text, a_path, opts, Result)
|
||||
@@ -180,6 +183,7 @@ feature -- Url
|
||||
|
||||
checked_url (a_url: READABLE_STRING_8): READABLE_STRING_8
|
||||
do
|
||||
-- FIXME: implement a way to check if `a_url' is safe, and does not reveal security issue.
|
||||
Result := a_url
|
||||
end
|
||||
|
||||
@@ -189,6 +193,6 @@ feature -- Url
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user