Merge pull request #10 from jocelyn/copyright_20141113
Added copyright, note, and minor improvements.
This commit is contained in:
4
README.md
Normal file
4
README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
ROC: The "REST On CMS" solution
|
||||||
|
|
||||||
|
Simple content management system built with Eiffel, and the Eiffel Web Framework, with REST API in mind.
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||||
<library name="layout" location=".\layout\layout-safe.ecf"/>
|
<library name="layout" location=".\layout\layout-safe.ecf"/>
|
||||||
<library name="model" location=".\model\model-safe.ecf" readonly="false"/>
|
<library name="model" location=".\model\cms_model-safe.ecf" readonly="false"/>
|
||||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf" readonly="false"/>
|
||||||
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
<library name="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>
|
||||||
|
|
||||||
|
|||||||
3
cms/layout/license.lic
Normal file
3
cms/layout/license.lic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
${NOTE_KEYWORD}
|
||||||
|
copyright: "2011-${YEAR}, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
@@ -1,7 +1,18 @@
|
|||||||
note
|
note
|
||||||
description: "[API Layout, to provide paths(config, application, log, documentation, www, html cj)]"
|
description: "[
|
||||||
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
|
Application layout
|
||||||
revision: "$Revision: 95678 $"
|
Related to file system locations such as
|
||||||
|
- configuration locations
|
||||||
|
- application
|
||||||
|
- log
|
||||||
|
- documentation
|
||||||
|
- www
|
||||||
|
- assets
|
||||||
|
- templates (html, Collection+JSON, ...)
|
||||||
|
- ...
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
class
|
class
|
||||||
APPLICATION_LAYOUT
|
APPLICATION_LAYOUT
|
||||||
@@ -31,6 +42,7 @@ feature {NONE} -- Initialization
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
path: PATH
|
path: PATH
|
||||||
|
-- Root location.
|
||||||
|
|
||||||
feature -- Access: internal
|
feature -- Access: internal
|
||||||
|
|
||||||
@@ -150,4 +162,7 @@ feature {NONE} -- Implementation
|
|||||||
internal_template_path: detachable like template_path
|
internal_template_path: detachable like template_path
|
||||||
-- Directory for templates (HTML, etc).
|
-- Directory for templates (HTML, etc).
|
||||||
|
|
||||||
|
;note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -36,4 +36,7 @@ feature -- Access
|
|||||||
Result := "Driver={"+driver+"};" + database_string;
|
Result := "Driver={"+driver+"};" + database_string;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -97,4 +97,7 @@ feature {NONE} -- JSON
|
|||||||
create Result.make_parser (a_string)
|
create Result.make_parser (a_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
note
|
note
|
||||||
description: "Object that represent Logger configuration settings"
|
description: "Object that represents Logger configuration settings"
|
||||||
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
|
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
|
||||||
revision: "$Revision: 95678 $"
|
revision: "$Revision: 95678 $"
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ feature -- Access
|
|||||||
-- When non-zero, the value specifies the maximum number of backup files.
|
-- When non-zero, the value specifies the maximum number of backup files.
|
||||||
|
|
||||||
level: INTEGER
|
level: INTEGER
|
||||||
-- Logger level.
|
-- Logger level.
|
||||||
|
|
||||||
feature -- Element Change
|
feature -- Element Change
|
||||||
|
|
||||||
@@ -77,4 +77,7 @@ feature -- Element Change
|
|||||||
level := 0
|
level := 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -48,4 +48,7 @@ feature -- Change Element
|
|||||||
error_location_set: error_location = a_location
|
error_location_set: error_location = a_location
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -102,4 +102,7 @@ feature -- Element Settings
|
|||||||
last_error__reset: last_error = Void
|
last_error__reset: last_error = Void
|
||||||
successful: successful
|
successful: successful
|
||||||
end
|
end
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -134,4 +134,7 @@ feature -- Output
|
|||||||
l_retry := True
|
l_retry := True
|
||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -106,4 +106,7 @@ feature {NONE} -- JSON
|
|||||||
create Result.make_parser (a_string)
|
create Result.make_parser (a_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
|
|||||||
3
cms/license.lic
Normal file
3
cms/license.lic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
${NOTE_KEYWORD}
|
||||||
|
copyright: "2011-${YEAR}, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="model" uuid="57C6F407-E894-4554-8A59-C8D1F3BBC5D7" library_target="model">
|
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-13-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-13-0 http://www.eiffel.com/developers/xml/configuration-1-13-0.xsd" name="cms_model" uuid="57C6F407-E894-4554-8A59-C8D1F3BBC5D7" library_target="cms_model">
|
||||||
<target name="model">
|
<target name="cms_model">
|
||||||
<root all_classes="True"/>
|
<root all_classes="True"/>
|
||||||
<option warning="true">
|
<option warning="true">
|
||||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<setting name="console_application" value="true"/>
|
<setting name="console_application" value="true"/>
|
||||||
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
<cluster name="model" location=".\src" recursive="true">
|
<cluster name="cms_model" location=".\src" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/EIFGENs$</exclude>
|
<exclude>/EIFGENs$</exclude>
|
||||||
<exclude>/.svn$</exclude>
|
<exclude>/.svn$</exclude>
|
||||||
3
cms/model/license.lic
Normal file
3
cms/model/license.lic
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
${NOTE_KEYWORD}
|
||||||
|
copyright: "2011-${YEAR}, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {CMS_CONTENT_TYPE}."
|
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
CMS_CONTENT_TYPE
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {CMS_LINK_COMPOSITE}."
|
|
||||||
author: ""
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
deferred class
|
|
||||||
CMS_LINK_COMPOSITE
|
|
||||||
|
|
||||||
inherit
|
|
||||||
ITERABLE [CMS_LINK]
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
items: detachable LIST [CMS_LINK]
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
extend (lnk: CMS_LINK)
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
remove (lnk: CMS_LINK)
|
|
||||||
deferred
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {CMS_USER_PROFILE}."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
CMS_USER_PROFILE
|
|
||||||
|
|
||||||
inherit
|
|
||||||
TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_8]
|
|
||||||
|
|
||||||
create
|
|
||||||
make
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make
|
|
||||||
do
|
|
||||||
create items.make (0)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
item (k: READABLE_STRING_8): detachable READABLE_STRING_8
|
|
||||||
do
|
|
||||||
Result := items.item (k.as_string_8)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Change
|
|
||||||
|
|
||||||
force (v: READABLE_STRING_8; k: READABLE_STRING_8)
|
|
||||||
do
|
|
||||||
items.force (v, k.as_string_8)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
new_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
|
|
||||||
-- Fresh cursor associated with current structure
|
|
||||||
do
|
|
||||||
Result := items.new_cursor
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
|
||||||
items: HASH_TABLE [READABLE_STRING_8, STRING_8]
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
note
|
|
||||||
description: "Summary description for {CMS_USER_ROLE}."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
CMS_USER_ROLE
|
|
||||||
|
|
||||||
inherit
|
|
||||||
ANY
|
|
||||||
redefine
|
|
||||||
is_equal
|
|
||||||
end
|
|
||||||
|
|
||||||
create
|
|
||||||
make,
|
|
||||||
make_with_id
|
|
||||||
|
|
||||||
feature {NONE} -- Initialization
|
|
||||||
|
|
||||||
make_with_id (a_id: like id; a_name: like name)
|
|
||||||
do
|
|
||||||
id := a_id
|
|
||||||
make (a_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
make (a_name: like name)
|
|
||||||
do
|
|
||||||
name := a_name
|
|
||||||
create {ARRAYED_LIST [READABLE_STRING_8]} permissions.make (0)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Status report
|
|
||||||
|
|
||||||
has_id: BOOLEAN
|
|
||||||
do
|
|
||||||
Result := id > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
has_permission (p: READABLE_STRING_8): BOOLEAN
|
|
||||||
do
|
|
||||||
Result := across permissions as c some c.item.is_case_insensitive_equal (p) end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Access
|
|
||||||
|
|
||||||
id: INTEGER
|
|
||||||
|
|
||||||
name: READABLE_STRING_8
|
|
||||||
|
|
||||||
permissions: LIST [READABLE_STRING_8]
|
|
||||||
|
|
||||||
feature -- Comparison
|
|
||||||
|
|
||||||
same_user_role (r: CMS_USER_ROLE): BOOLEAN
|
|
||||||
do
|
|
||||||
Result := r.id = id
|
|
||||||
end
|
|
||||||
|
|
||||||
is_equal (other: like Current): BOOLEAN
|
|
||||||
-- Is `other' attached to an object considered
|
|
||||||
-- equal to current object?
|
|
||||||
do
|
|
||||||
Result := id = other.id
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Change
|
|
||||||
|
|
||||||
set_id (a_id: like id)
|
|
||||||
-- Set `id' with `a_id'.
|
|
||||||
do
|
|
||||||
id := a_id
|
|
||||||
ensure
|
|
||||||
set_id: id = a_id
|
|
||||||
end
|
|
||||||
|
|
||||||
set_name (a_name: like name)
|
|
||||||
-- Set `name' with `a_name'.
|
|
||||||
do
|
|
||||||
name := a_name
|
|
||||||
ensure
|
|
||||||
name_set: name = a_name
|
|
||||||
end
|
|
||||||
|
|
||||||
add_permission (n: READABLE_STRING_8)
|
|
||||||
do
|
|
||||||
permissions.force (n)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
15
cms/model/src/content/cms_content_type.e
Normal file
15
cms/model/src/content/cms_content_type.e
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Interface defining a CMS content type.
|
||||||
|
]"
|
||||||
|
status: "draft"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_CONTENT_TYPE
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {NODE}."
|
description: "[
|
||||||
|
CMS abstraction for CMS content entity, named "node".
|
||||||
|
]"
|
||||||
|
status: "draft"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -14,7 +17,9 @@ create
|
|||||||
make
|
make
|
||||||
|
|
||||||
feature{NONE} -- Initialization
|
feature{NONE} -- Initialization
|
||||||
make (a_content: READABLE_STRING_32; a_summary:READABLE_STRING_32; a_title: READABLE_STRING_32)
|
|
||||||
|
make (a_content: READABLE_STRING_32; a_summary: READABLE_STRING_32; a_title: READABLE_STRING_32)
|
||||||
|
-- Create current node with `a_content', `a_summary' and `a_title'.
|
||||||
local
|
local
|
||||||
l_time: DATE_TIME
|
l_time: DATE_TIME
|
||||||
do
|
do
|
||||||
@@ -25,12 +30,14 @@ feature{NONE} -- Initialization
|
|||||||
set_creation_date (l_time)
|
set_creation_date (l_time)
|
||||||
set_modification_date (l_time)
|
set_modification_date (l_time)
|
||||||
set_publication_date (l_time)
|
set_publication_date (l_time)
|
||||||
|
|
||||||
debug ("refactor_fixme")
|
debug ("refactor_fixme")
|
||||||
fixme ("Remove harcode format")
|
fixme ("Remove default harcoded format")
|
||||||
end
|
end
|
||||||
set_format ("HTML")
|
set_format ("HTML")
|
||||||
|
|
||||||
debug ("refactor_fixme")
|
debug ("refactor_fixme")
|
||||||
fixme ("Remove harcode content type")
|
fixme ("Remove default harcoded content type")
|
||||||
end
|
end
|
||||||
set_content_type ("Page")
|
set_content_type ("Page")
|
||||||
ensure
|
ensure
|
||||||
@@ -41,6 +48,9 @@ feature{NONE} -- Initialization
|
|||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
|
id: INTEGER_64 assign set_id
|
||||||
|
-- Unique id.
|
||||||
|
|
||||||
content: READABLE_STRING_32
|
content: READABLE_STRING_32
|
||||||
-- Content of the node.
|
-- Content of the node.
|
||||||
|
|
||||||
@@ -62,10 +72,7 @@ feature -- Access
|
|||||||
publication_date_output: READABLE_STRING_32
|
publication_date_output: READABLE_STRING_32
|
||||||
-- Formatted output.
|
-- Formatted output.
|
||||||
|
|
||||||
id: INTEGER_64 assign set_id
|
format: READABLE_STRING_32
|
||||||
-- Unique id.
|
|
||||||
|
|
||||||
format: READABLE_STRING_32
|
|
||||||
-- Format associated with `body'.
|
-- Format associated with `body'.
|
||||||
-- For example: text, mediawiki, html, etc
|
-- For example: text, mediawiki, html, etc
|
||||||
|
|
||||||
@@ -73,19 +80,20 @@ feature -- Access
|
|||||||
-- Associated content type name.
|
-- Associated content type name.
|
||||||
-- Page, Article, Blog, News, etc.
|
-- Page, Article, Blog, News, etc.
|
||||||
|
|
||||||
|
author: detachable CMS_USER
|
||||||
|
-- Author of current node.
|
||||||
|
|
||||||
|
collaborators: detachable LIST[CMS_USER]
|
||||||
|
-- Users contributed to current Node.
|
||||||
|
|
||||||
feature -- status report
|
feature -- status report
|
||||||
|
|
||||||
has_id: BOOLEAN
|
has_id: BOOLEAN
|
||||||
|
-- Has unique identifier?
|
||||||
do
|
do
|
||||||
Result := id > 0
|
Result := id > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
author: detachable CMS_USER
|
|
||||||
-- Node's author.
|
|
||||||
|
|
||||||
collaborators: detachable LIST[CMS_USER]
|
|
||||||
-- Node's collaborators.
|
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
set_content (a_content: like content)
|
set_content (a_content: like content)
|
||||||
@@ -182,4 +190,7 @@ feature -- Element change
|
|||||||
lst.force (a_user)
|
lst.force (a_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
53
cms/model/src/link/cms_external_link.e
Normal file
53
cms/model/src/link/cms_external_link.e
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Abstraction to represent a link outside current CMS system.
|
||||||
|
For instance, a web url.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision: 95883 $"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_EXTERNAL_LINK
|
||||||
|
|
||||||
|
inherit
|
||||||
|
CMS_LINK
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make (a_title: like title; a_location: like location)
|
||||||
|
-- Create current external link with optional title `a_title' and location `a_location'.
|
||||||
|
do
|
||||||
|
title := a_title
|
||||||
|
location := a_location
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
is_active: BOOLEAN = False
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
is_expanded: BOOLEAN = False
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
is_collapsed: BOOLEAN = False
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
is_expandable: BOOLEAN = False
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
has_children: BOOLEAN = False
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
children: detachable LIST [CMS_LINK]
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
invariant
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_MENU}."
|
description: "[
|
||||||
author: ""
|
Abstraction to represent a URI link in the CMS system.
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -17,14 +18,16 @@ inherit
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
title: READABLE_STRING_32
|
title: READABLE_STRING_32
|
||||||
-- link's title.
|
-- Associated title.
|
||||||
|
|
||||||
location: READABLE_STRING_8
|
location: READABLE_STRING_8
|
||||||
-- link's location.
|
-- Associated url location.
|
||||||
|
|
||||||
feature -- status report
|
feature -- status report
|
||||||
|
|
||||||
is_active: BOOLEAN
|
is_active: BOOLEAN
|
||||||
|
-- Is current link active?
|
||||||
|
-- i.e: related to requested url.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,16 +47,20 @@ feature -- status report
|
|||||||
-- Is expandable?
|
-- Is expandable?
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
has_children: BOOLEAN
|
has_children: BOOLEAN
|
||||||
|
-- Has sub link?
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Query
|
feature -- Query
|
||||||
|
|
||||||
parent: detachable CMS_LINK
|
parent: detachable CMS_LINK
|
||||||
|
-- Optional parent link.
|
||||||
|
|
||||||
children: detachable LIST [CMS_LINK]
|
children: detachable LIST [CMS_LINK]
|
||||||
|
-- Optional children links.
|
||||||
|
-- Useful to have a non flat menu.
|
||||||
deferred
|
deferred
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -71,10 +78,15 @@ feature -- Access
|
|||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
debug_output: STRING
|
debug_output: STRING_32
|
||||||
-- String that should be displayed in debugger to represent `Current'.
|
-- String that should be displayed in debugger to represent `Current'.
|
||||||
do
|
do
|
||||||
Result := title.as_string_8 + " -> " + location
|
create Result.make_from_string (title)
|
||||||
|
Result.append_string_general (" -> ")
|
||||||
|
Result.append_string_general (location)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
52
cms/model/src/link/cms_link_composite.e
Normal file
52
cms/model/src/link/cms_link_composite.e
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
Abstraction to represent a links container in the CMS system.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
deferred class
|
||||||
|
CMS_LINK_COMPOSITE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ITERABLE [CMS_LINK]
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
items: detachable LIST [CMS_LINK]
|
||||||
|
-- Children links.
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
|
extend (lnk: CMS_LINK)
|
||||||
|
-- Add `lnk' as a sub link.
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
remove (lnk: CMS_LINK)
|
||||||
|
-- Remove link `lnk' from Current container.
|
||||||
|
deferred
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- status report
|
||||||
|
|
||||||
|
is_empty: BOOLEAN
|
||||||
|
-- Is container empty?
|
||||||
|
do
|
||||||
|
Result := not attached items as l_items or else l_items.is_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
count: INTEGER
|
||||||
|
-- Number of immediate sub links.
|
||||||
|
do
|
||||||
|
if attached items as l_items then
|
||||||
|
Result := l_items.count
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_LOCAL_MENU}."
|
description: "[
|
||||||
|
Abstraction to represent a link to a CMS resource.
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -22,6 +24,7 @@ create
|
|||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_title: detachable like title; a_location: like location)
|
make (a_title: detachable like title; a_location: like location)
|
||||||
|
-- Create current local link with optional title `a_title' and location `a_location'.
|
||||||
do
|
do
|
||||||
if a_title /= Void then
|
if a_title /= Void then
|
||||||
title := a_title
|
title := a_title
|
||||||
@@ -31,44 +34,47 @@ feature {NONE} -- Initialization
|
|||||||
location := a_location
|
location := a_location
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
permission_arguments: detachable ITERABLE [READABLE_STRING_8]
|
||||||
|
-- Permissions required by current link resource.
|
||||||
|
|
||||||
|
children: detachable LIST [CMS_LINK]
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
feature -- Status report
|
feature -- Status report
|
||||||
|
|
||||||
is_active: BOOLEAN
|
is_active: BOOLEAN
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
is_expanded: BOOLEAN
|
is_expanded: BOOLEAN
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Result := is_expandable and then internal_is_expanded
|
Result := is_expandable and then internal_is_expanded
|
||||||
end
|
end
|
||||||
|
|
||||||
is_collapsed: BOOLEAN
|
is_collapsed: BOOLEAN
|
||||||
-- Is expanded, but visually collapsed?
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Result := is_expandable and then internal_is_collapsed
|
Result := is_expandable and then internal_is_collapsed
|
||||||
end
|
end
|
||||||
|
|
||||||
is_expandable: BOOLEAN
|
is_expandable: BOOLEAN
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Result := internal_is_expandable or internal_is_expanded or has_children
|
Result := internal_is_expandable or internal_is_expanded or has_children
|
||||||
end
|
end
|
||||||
|
|
||||||
has_children: BOOLEAN
|
has_children: BOOLEAN
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
Result := attached children as l_children and then not l_children.is_empty
|
Result := attached children as l_children and then not l_children.is_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
permission_arguments: detachable ITERABLE [READABLE_STRING_8]
|
|
||||||
|
|
||||||
children: detachable LIST [CMS_LINK]
|
|
||||||
|
|
||||||
internal_is_expandable: BOOLEAN
|
|
||||||
|
|
||||||
internal_is_expanded: BOOLEAN
|
|
||||||
|
|
||||||
internal_is_collapsed: BOOLEAN
|
|
||||||
|
|
||||||
feature -- Element change
|
feature -- Element change
|
||||||
|
|
||||||
add_link (lnk: CMS_LINK)
|
add_link (lnk: CMS_LINK)
|
||||||
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
lst: like children
|
lst: like children
|
||||||
do
|
do
|
||||||
@@ -81,6 +87,7 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
remove_link (lnk: CMS_LINK)
|
remove_link (lnk: CMS_LINK)
|
||||||
|
-- <Precursor>
|
||||||
local
|
local
|
||||||
lst: like children
|
lst: like children
|
||||||
do
|
do
|
||||||
@@ -94,8 +101,19 @@ feature -- Element change
|
|||||||
end
|
end
|
||||||
|
|
||||||
set_children (lst: like children)
|
set_children (lst: like children)
|
||||||
|
-- Set `children' to `lst'.
|
||||||
do
|
do
|
||||||
children := lst
|
children := lst
|
||||||
|
ensure
|
||||||
|
children_set: children = lst
|
||||||
|
end
|
||||||
|
|
||||||
|
set_permission_arguments (args: like permission_arguments)
|
||||||
|
-- Set `permission_arguments' to `args'.
|
||||||
|
do
|
||||||
|
permission_arguments := args
|
||||||
|
ensure
|
||||||
|
permission_arguments_set: permission_arguments = args
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Status change
|
feature -- Status change
|
||||||
@@ -104,33 +122,52 @@ feature -- Status change
|
|||||||
-- Set `is_active' to `b'.
|
-- Set `is_active' to `b'.
|
||||||
do
|
do
|
||||||
is_active := b
|
is_active := b
|
||||||
|
ensure
|
||||||
|
is_active: is_active = b
|
||||||
end
|
end
|
||||||
|
|
||||||
set_expanded (b: like is_expanded)
|
set_expanded (b: like is_expanded)
|
||||||
|
-- Set `is_expanded' to `b'.
|
||||||
do
|
do
|
||||||
if b then
|
if b then
|
||||||
set_expandable (True)
|
set_expandable (True)
|
||||||
set_collapsed (False)
|
set_collapsed (False)
|
||||||
end
|
end
|
||||||
internal_is_expanded := b
|
internal_is_expanded := b
|
||||||
|
ensure
|
||||||
|
is_expanded: is_expanded = b
|
||||||
end
|
end
|
||||||
|
|
||||||
set_collapsed (b: like is_collapsed)
|
set_collapsed (b: like is_collapsed)
|
||||||
|
-- Set `is_collapsed' to `b'.
|
||||||
do
|
do
|
||||||
if b then
|
if b then
|
||||||
set_expanded (False)
|
set_expanded (False)
|
||||||
end
|
end
|
||||||
internal_is_collapsed := b
|
internal_is_collapsed := b
|
||||||
|
ensure
|
||||||
|
is_collapsed: is_collapsed= b
|
||||||
end
|
end
|
||||||
|
|
||||||
set_expandable (b: like is_expandable)
|
set_expandable (b: like is_expandable)
|
||||||
|
-- Set `is_expandable' to `b'.
|
||||||
do
|
do
|
||||||
internal_is_expandable := b
|
internal_is_expandable := b
|
||||||
|
ensure
|
||||||
|
is_expandable: is_expandable = b
|
||||||
end
|
end
|
||||||
|
|
||||||
set_permission_arguments (args: like permission_arguments)
|
feature {NONE} -- Implementation
|
||||||
do
|
|
||||||
permission_arguments := args
|
|
||||||
end
|
|
||||||
|
|
||||||
|
internal_is_expandable: BOOLEAN
|
||||||
|
|
||||||
|
internal_is_expanded: BOOLEAN
|
||||||
|
|
||||||
|
internal_is_collapsed: BOOLEAN
|
||||||
|
|
||||||
|
invariant
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {CMS_MENU}."
|
description: "[
|
||||||
|
Abstraction to represent a MENU in the CMS system.
|
||||||
|
It has items as sub menu/link.
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -8,6 +11,9 @@ class
|
|||||||
|
|
||||||
inherit
|
inherit
|
||||||
CMS_LINK_COMPOSITE
|
CMS_LINK_COMPOSITE
|
||||||
|
redefine
|
||||||
|
is_empty
|
||||||
|
end
|
||||||
|
|
||||||
create
|
create
|
||||||
make,
|
make,
|
||||||
@@ -15,45 +21,53 @@ create
|
|||||||
|
|
||||||
feature {NONE} -- Initialization
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
make (a_name: like name; n: INTEGER)
|
make (a_name: like name; a_capacity: INTEGER)
|
||||||
|
-- Create menu with name `a_name' and a capacity of `a_capacity'.
|
||||||
do
|
do
|
||||||
name := a_name
|
name := a_name
|
||||||
create items.make (n)
|
create items.make (a_capacity)
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_title (a_name: like name; a_title: READABLE_STRING_32; n: INTEGER)
|
make_with_title (a_name: like name; a_title: READABLE_STRING_32; a_capacity: INTEGER)
|
||||||
|
-- Create menu with name `a_name' and a capacity of `a_capacity', and title `a_title'
|
||||||
do
|
do
|
||||||
make (a_name, n)
|
make (a_name, a_capacity)
|
||||||
set_title (a_title)
|
set_title (a_title)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
name: READABLE_STRING_8
|
name: READABLE_STRING_8
|
||||||
|
-- Identifier for Current menu.
|
||||||
|
|
||||||
title: detachable READABLE_STRING_32
|
title: detachable READABLE_STRING_32
|
||||||
|
-- Optional title.
|
||||||
|
|
||||||
items: ARRAYED_LIST [CMS_LINK]
|
items: ARRAYED_LIST [CMS_LINK]
|
||||||
|
-- <Precursor>
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
is_empty: BOOLEAN
|
||||||
|
-- <Precursor>
|
||||||
|
do
|
||||||
|
Result := items.is_empty
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Element change
|
||||||
|
|
||||||
extend (lnk: CMS_LINK)
|
extend (lnk: CMS_LINK)
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
items.extend (lnk)
|
items.extend (lnk)
|
||||||
end
|
end
|
||||||
|
|
||||||
remove (lnk: CMS_LINK)
|
remove (lnk: CMS_LINK)
|
||||||
|
-- <Precursor>
|
||||||
do
|
do
|
||||||
items.prune_all (lnk)
|
items.prune_all (lnk)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- status report
|
|
||||||
|
|
||||||
is_empty: BOOLEAN
|
|
||||||
do
|
|
||||||
Result := items.is_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
feature -- Element change
|
|
||||||
|
|
||||||
set_title (t: like title)
|
set_title (t: like title)
|
||||||
do
|
do
|
||||||
title := t
|
title := t
|
||||||
@@ -69,4 +83,7 @@ feature -- Access
|
|||||||
|
|
||||||
invariant
|
invariant
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
note
|
note
|
||||||
description: "Summary description for {USER}."
|
description: "[
|
||||||
|
Interface representing a USER in the CMS system.
|
||||||
|
]"
|
||||||
date: "$Date$"
|
date: "$Date$"
|
||||||
revision: "$Revision$"
|
revision: "$Revision$"
|
||||||
|
|
||||||
@@ -27,31 +29,33 @@ feature {NONE} -- Initialization
|
|||||||
feature -- Access
|
feature -- Access
|
||||||
|
|
||||||
id: INTEGER_64
|
id: INTEGER_64
|
||||||
-- Unique id.
|
-- Unique id.
|
||||||
|
|
||||||
name: READABLE_STRING_32
|
name: READABLE_STRING_32
|
||||||
-- User name.
|
-- User name.
|
||||||
|
|
||||||
password: detachable READABLE_STRING_32
|
password: detachable READABLE_STRING_32
|
||||||
-- User password.
|
-- User password.
|
||||||
|
|
||||||
email: detachable READABLE_STRING_32
|
email: detachable READABLE_STRING_32
|
||||||
-- User email.
|
-- User email.
|
||||||
|
|
||||||
profile: detachable CMS_USER_PROFILE
|
profile: detachable CMS_USER_PROFILE
|
||||||
-- User profile.
|
-- User profile.
|
||||||
|
|
||||||
creation_date: DATE_TIME
|
creation_date: DATE_TIME
|
||||||
-- Creation date.
|
-- Creation date.
|
||||||
|
|
||||||
last_login_date: detachable DATE_TIME
|
last_login_date: detachable DATE_TIME
|
||||||
-- User last login.
|
-- User last login.
|
||||||
|
|
||||||
|
feature -- Access: data
|
||||||
|
|
||||||
data: detachable STRING_TABLE [detachable ANY]
|
data: detachable STRING_TABLE [detachable ANY]
|
||||||
-- Additional user's data.
|
-- Additional data.
|
||||||
|
|
||||||
data_item (k: READABLE_STRING_GENERAL): detachable ANY
|
data_item (k: READABLE_STRING_GENERAL): detachable ANY
|
||||||
-- Additional item data.
|
-- Additional item data associated with key `k'.
|
||||||
do
|
do
|
||||||
if attached data as l_data then
|
if attached data as l_data then
|
||||||
Result := l_data.item (k)
|
Result := l_data.item (k)
|
||||||
@@ -70,14 +74,21 @@ feature -- Status report
|
|||||||
Result := attached email as e and then not e.is_empty
|
Result := attached email as e and then not e.is_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
debug_output: STRING
|
debug_output: STRING_32
|
||||||
do
|
do
|
||||||
Result := name
|
create Result.make_from_string (name)
|
||||||
|
if has_id then
|
||||||
|
Result.append_character (' ')
|
||||||
|
Result.append_character ('<')
|
||||||
|
Result.append_integer_64 (id)
|
||||||
|
Result.append_character ('>')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
same_as (u: detachable CMS_USER): BOOLEAN
|
same_as (other: detachable CMS_USER): BOOLEAN
|
||||||
|
-- Is Current same as `other'?
|
||||||
do
|
do
|
||||||
Result := u /= Void and then id = u.id
|
Result := other /= Void and then id = other.id
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Change element
|
feature -- Change element
|
||||||
@@ -98,20 +109,20 @@ feature -- Change element
|
|||||||
name_set: name = n
|
name_set: name = n
|
||||||
end
|
end
|
||||||
|
|
||||||
set_password (p: like password)
|
set_password (a_password: like password)
|
||||||
-- Set `password' with `p'.
|
-- Set `password' with `a_password'.
|
||||||
do
|
do
|
||||||
password := p
|
password := a_password
|
||||||
ensure
|
ensure
|
||||||
password_set: password = p
|
password_set: password = a_password
|
||||||
end
|
end
|
||||||
|
|
||||||
set_email (m: like email)
|
set_email (a_email: like email)
|
||||||
-- Set `email' with `m'.
|
-- Set `email' with `a_email'.
|
||||||
do
|
do
|
||||||
email := m
|
email := a_email
|
||||||
ensure
|
ensure
|
||||||
email_set: email = m
|
email_set: email = a_email
|
||||||
end
|
end
|
||||||
|
|
||||||
set_profile (prof: like profile)
|
set_profile (prof: like profile)
|
||||||
@@ -122,25 +133,6 @@ feature -- Change element
|
|||||||
profile_set: profile = prof
|
profile_set: profile = prof
|
||||||
end
|
end
|
||||||
|
|
||||||
set_data_item (k: READABLE_STRING_GENERAL; d: like data_item)
|
|
||||||
local
|
|
||||||
l_data: like data
|
|
||||||
do
|
|
||||||
l_data := data
|
|
||||||
if l_data = Void then
|
|
||||||
create l_data.make (1)
|
|
||||||
data := l_data
|
|
||||||
end
|
|
||||||
l_data.force (d, k)
|
|
||||||
end
|
|
||||||
|
|
||||||
remove_data_item (k: READABLE_STRING_GENERAL)
|
|
||||||
do
|
|
||||||
if attached data as l_data then
|
|
||||||
l_data.remove (k)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set_profile_item (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
set_profile_item (k: READABLE_STRING_8; v: READABLE_STRING_8)
|
||||||
local
|
local
|
||||||
prof: like profile
|
prof: like profile
|
||||||
@@ -163,4 +155,30 @@ feature -- Change element
|
|||||||
set_last_login_date (create {DATE_TIME}.make_now_utc)
|
set_last_login_date (create {DATE_TIME}.make_now_utc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature -- Change element: data
|
||||||
|
|
||||||
|
set_data_item (k: READABLE_STRING_GENERAL; d: like data_item)
|
||||||
|
-- Associate data item `d' with key `k'.
|
||||||
|
local
|
||||||
|
l_data: like data
|
||||||
|
do
|
||||||
|
l_data := data
|
||||||
|
if l_data = Void then
|
||||||
|
create l_data.make (1)
|
||||||
|
data := l_data
|
||||||
|
end
|
||||||
|
l_data.force (d, k)
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_data_item (k: READABLE_STRING_GENERAL)
|
||||||
|
-- Remove data item associated with key `k'.
|
||||||
|
do
|
||||||
|
if attached data as l_data then
|
||||||
|
l_data.remove (k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
end
|
end
|
||||||
56
cms/model/src/user/cms_user_profile.e
Normal file
56
cms/model/src/user/cms_user_profile.e
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
User profile used to extend information associated with a {CMS_USER}.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_USER_PROFILE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make
|
||||||
|
-- Create Current profile.
|
||||||
|
do
|
||||||
|
create items.make (0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
item (k: READABLE_STRING_GENERAL): detachable READABLE_STRING_8
|
||||||
|
-- Profile item associated with key `k'.
|
||||||
|
do
|
||||||
|
Result := items.item (k)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Change
|
||||||
|
|
||||||
|
force (v: READABLE_STRING_8; k: READABLE_STRING_GENERAL)
|
||||||
|
-- Associated value `v' with key `k'.
|
||||||
|
do
|
||||||
|
items.force (v, k)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
new_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||||
|
-- Fresh cursor associated with current structure
|
||||||
|
do
|
||||||
|
Result := items.new_cursor
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
|
items: STRING_TABLE [READABLE_STRING_8]
|
||||||
|
|
||||||
|
;note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
120
cms/model/src/user/cms_user_role.e
Normal file
120
cms/model/src/user/cms_user_role.e
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
The user roles are used for the CMS permission system.
|
||||||
|
A role has a list of permissions, that describes what users of current role
|
||||||
|
are authorized to operation.
|
||||||
|
]"
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
CMS_USER_ROLE
|
||||||
|
|
||||||
|
inherit
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
is_equal
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
make,
|
||||||
|
make_with_id
|
||||||
|
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
|
||||||
|
make_with_id (a_id: like id; a_name: like name)
|
||||||
|
do
|
||||||
|
id := a_id
|
||||||
|
make (a_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
make (a_name: like name)
|
||||||
|
do
|
||||||
|
name := a_name
|
||||||
|
create {ARRAYED_LIST [READABLE_STRING_8]} permissions.make (0)
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Status report
|
||||||
|
|
||||||
|
has_id: BOOLEAN
|
||||||
|
-- Has a unique identifier?
|
||||||
|
do
|
||||||
|
Result := id > 0
|
||||||
|
end
|
||||||
|
|
||||||
|
has_permission (p: READABLE_STRING_8): BOOLEAN
|
||||||
|
-- Has permission `p'?
|
||||||
|
do
|
||||||
|
Result := across permissions as c some c.item.is_case_insensitive_equal (p) end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
|
||||||
|
id: INTEGER
|
||||||
|
-- Unique id associated with Current role.
|
||||||
|
|
||||||
|
name: READABLE_STRING_8
|
||||||
|
-- Name of Current role.
|
||||||
|
|
||||||
|
permissions: LIST [READABLE_STRING_8]
|
||||||
|
-- List of permissions.
|
||||||
|
|
||||||
|
feature -- Comparison
|
||||||
|
|
||||||
|
same_user_role (other: CMS_USER_ROLE): BOOLEAN
|
||||||
|
-- Is Current role same as role `other' ?
|
||||||
|
do
|
||||||
|
Result := other.id = id
|
||||||
|
end
|
||||||
|
|
||||||
|
is_equal (other: like Current): BOOLEAN
|
||||||
|
-- Is `other' attached to an object considered
|
||||||
|
-- equal to current object?
|
||||||
|
do
|
||||||
|
Result := id = other.id
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Change
|
||||||
|
|
||||||
|
set_id (a_id: like id)
|
||||||
|
-- Set `id' with `a_id'.
|
||||||
|
do
|
||||||
|
id := a_id
|
||||||
|
ensure
|
||||||
|
set_id: id = a_id
|
||||||
|
end
|
||||||
|
|
||||||
|
set_name (a_name: like name)
|
||||||
|
-- Set `name' with `a_name'.
|
||||||
|
do
|
||||||
|
name := a_name
|
||||||
|
ensure
|
||||||
|
name_set: name = a_name
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Permission change
|
||||||
|
|
||||||
|
add_permission (a_permission_name: READABLE_STRING_8)
|
||||||
|
-- Add permission `a_permission_name' to Current role.
|
||||||
|
require
|
||||||
|
is_not_blank: not a_permission_name.is_whitespace
|
||||||
|
do
|
||||||
|
permissions.force (a_permission_name)
|
||||||
|
ensure
|
||||||
|
has_permission: has_permission (a_permission_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_permission (a_permission_name: READABLE_STRING_8)
|
||||||
|
-- Remove permission `a_permission_name' from Current role.
|
||||||
|
require
|
||||||
|
is_not_blank: not a_permission_name.is_whitespace
|
||||||
|
do
|
||||||
|
permissions.prune_all (a_permission_name)
|
||||||
|
ensure
|
||||||
|
not_has_permission: not has_permission (a_permission_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
note
|
||||||
|
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||||
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
|
end
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-safe.ecf"/>
|
||||||
|
|
||||||
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
||||||
<library name="model" location="..\..\..\model\model-safe.ecf"/>
|
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
||||||
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
<library name="store" location="$ISE_LIBRARY\library\store\store-safe.ecf" readonly="false"/>
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ feature -- Basic operations: User Profiles
|
|||||||
save_profile (a_user_id: INTEGER_64; a_user_profile: CMS_USER_PROFILE)
|
save_profile (a_user_id: INTEGER_64; a_user_profile: CMS_USER_PROFILE)
|
||||||
-- Save a profile item with (a_key and a_value) to the given user `user_id'.
|
-- Save a profile item with (a_key and a_value) to the given user `user_id'.
|
||||||
local
|
local
|
||||||
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
|
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_GENERAL]
|
||||||
do
|
do
|
||||||
error_handler.reset
|
error_handler.reset
|
||||||
log.write_information (generator + ".save_profile")
|
log.write_information (generator + ".save_profile")
|
||||||
@@ -224,7 +224,7 @@ feature -- Basic operations: User Profiles
|
|||||||
until
|
until
|
||||||
l_cursor.after
|
l_cursor.after
|
||||||
loop
|
loop
|
||||||
save_profile_item (a_user_id, l_cursor.key, l_cursor.item)
|
save_profile_item (a_user_id, l_cursor.key.as_string_32, l_cursor.item)
|
||||||
l_cursor.forth
|
l_cursor.forth
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<setting name="concurrency" value="thread"/>
|
<setting name="concurrency" value="thread"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="model" location="..\..\..\..\model\model-safe.ecf"/>
|
<library name="model" location="..\..\..\..\model\cms_model-safe.ecf"/>
|
||||||
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
<library name="crypto" location="$ISE_LIBRARY\unstable\library\text\encryption\crypto\crypto-safe.ecf"/>
|
||||||
<library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
|
<library name="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
|
||||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
<library name="encoder" location="$ISE_LIBRARY\contrib\library\web\framework\ewf\text\encoder\encoder-safe.ecf"/>
|
||||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||||
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
<library name="layout" location="..\..\..\layout\layout-safe.ecf"/>
|
||||||
|
<library name="model" location="..\..\..\model\cms_model-safe.ecf"/>
|
||||||
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
<library name="logging" location="$ISE_LIBRARY\library\runtime\logging\logging-safe.ecf"/>
|
||||||
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
<library name="mysql" location="$ISE_LIBRARY\library\store\dbms\rdbms\mysql\mysql-safe.ecf"/>
|
||||||
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>
|
<library name="odbc" location="$ISE_LIBRARY\library\store\dbms\rdbms\odbc\odbc-safe.ecf"/>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||||
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
<library name="base_extension" location="$ISE_LIBRARY\library\base_extension\base_extension-safe.ecf"/>
|
||||||
<library name="cms" location="..\..\..\..\cms\cms-safe.ecf" readonly="false"/>
|
<library name="cms" location="..\..\..\..\cms\cms-safe.ecf" readonly="false"/>
|
||||||
<library name="cms_model" location="..\..\..\..\cms\model\model-safe.ecf" readonly="false"/>
|
<library name="cms_model" location="..\..\..\..\cms\model\cms_model-safe.ecf" readonly="false"/>
|
||||||
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
<library name="http" location="$ISE_LIBRARY\contrib\library\network\protocol\http\http-safe.ecf"/>
|
||||||
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json-safe.ecf" readonly="false"/>
|
||||||
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user