Merge pull request #10 from jocelyn/copyright_20141113

Added copyright, note, and minor improvements.
This commit is contained in:
jvelilla
2014-11-13 09:00:21 -03:00
33 changed files with 547 additions and 281 deletions

4
README.md Normal file
View 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.

View File

@@ -10,7 +10,7 @@
<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="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="text_filter" location="$ISE_LIBRARY\unstable\library\text\text_filter\text_filter-safe.ecf"/>

3
cms/layout/license.lic Normal file
View 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)"

View File

@@ -1,7 +1,18 @@
note
description: "[API Layout, to provide paths(config, application, log, documentation, www, html cj)]"
date: "$Date: 2014-08-20 15:21:15 -0300 (mi., 20 ago. 2014) $"
revision: "$Revision: 95678 $"
description: "[
Application layout
Related to file system locations such as
- configuration locations
- application
- log
- documentation
- www
- assets
- templates (html, Collection+JSON, ...)
- ...
]"
date: "$Date$"
revision: "$Revision$"
class
APPLICATION_LAYOUT
@@ -31,6 +42,7 @@ feature {NONE} -- Initialization
feature -- Access
path: PATH
-- Root location.
feature -- Access: internal
@@ -150,4 +162,7 @@ feature {NONE} -- Implementation
internal_template_path: detachable like template_path
-- 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

View File

@@ -36,4 +36,7 @@ feature -- Access
Result := "Driver={"+driver+"};" + database_string;
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

View File

@@ -97,4 +97,7 @@ feature {NONE} -- JSON
create Result.make_parser (a_string)
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

View File

@@ -1,5 +1,5 @@
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) $"
revision: "$Revision: 95678 $"
@@ -42,7 +42,7 @@ feature -- Access
-- When non-zero, the value specifies the maximum number of backup files.
level: INTEGER
-- Logger level.
-- Logger level.
feature -- Element Change
@@ -77,4 +77,7 @@ feature -- Element Change
level := 0
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

View File

@@ -48,4 +48,7 @@ feature -- Change Element
error_location_set: error_location = a_location
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

View File

@@ -102,4 +102,7 @@ feature -- Element Settings
last_error__reset: last_error = Void
successful: successful
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

View File

@@ -134,4 +134,7 @@ feature -- Output
l_retry := True
retry
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

View File

@@ -106,4 +106,7 @@ feature {NONE} -- JSON
create Result.make_parser (a_string)
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

3
cms/license.lic Normal file
View 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)"

View File

@@ -1,6 +1,6 @@
<?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">
<target name="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="cms_model">
<root all_classes="True"/>
<option warning="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"/>
<library name="base" location="$ISE_LIBRARY/library/base/base-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>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>

3
cms/model/license.lic Normal file
View 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)"

View File

@@ -1,10 +0,0 @@
note
description: "Summary description for {CMS_CONTENT_TYPE}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
CMS_CONTENT_TYPE
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -1,5 +1,8 @@
note
description: "Summary description for {NODE}."
description: "[
CMS abstraction for CMS content entity, named "node".
]"
status: "draft"
date: "$Date$"
revision: "$Revision$"
@@ -14,7 +17,9 @@ create
make
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
l_time: DATE_TIME
do
@@ -25,12 +30,14 @@ feature{NONE} -- Initialization
set_creation_date (l_time)
set_modification_date (l_time)
set_publication_date (l_time)
debug ("refactor_fixme")
fixme ("Remove harcode format")
fixme ("Remove default harcoded format")
end
set_format ("HTML")
debug ("refactor_fixme")
fixme ("Remove harcode content type")
fixme ("Remove default harcoded content type")
end
set_content_type ("Page")
ensure
@@ -41,6 +48,9 @@ feature{NONE} -- Initialization
feature -- Access
id: INTEGER_64 assign set_id
-- Unique id.
content: READABLE_STRING_32
-- Content of the node.
@@ -62,10 +72,7 @@ feature -- Access
publication_date_output: READABLE_STRING_32
-- Formatted output.
id: INTEGER_64 assign set_id
-- Unique id.
format: READABLE_STRING_32
format: READABLE_STRING_32
-- Format associated with `body'.
-- For example: text, mediawiki, html, etc
@@ -73,19 +80,20 @@ feature -- Access
-- Associated content type name.
-- 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
has_id: BOOLEAN
-- Has unique identifier?
do
Result := id > 0
end
author: detachable CMS_USER
-- Node's author.
collaborators: detachable LIST[CMS_USER]
-- Node's collaborators.
feature -- Element change
set_content (a_content: like content)
@@ -182,4 +190,7 @@ feature -- Element change
lst.force (a_user)
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

View 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

View File

@@ -1,6 +1,7 @@
note
description: "Summary description for {CMS_MENU}."
author: ""
description: "[
Abstraction to represent a URI link in the CMS system.
]"
date: "$Date$"
revision: "$Revision$"
@@ -17,14 +18,16 @@ inherit
feature -- Access
title: READABLE_STRING_32
-- link's title.
-- Associated title.
location: READABLE_STRING_8
-- link's location.
-- Associated url location.
feature -- status report
is_active: BOOLEAN
-- Is current link active?
-- i.e: related to requested url.
deferred
end
@@ -44,16 +47,20 @@ feature -- status report
-- Is expandable?
deferred
end
has_children: BOOLEAN
-- Has sub link?
deferred
end
feature -- Query
parent: detachable CMS_LINK
-- Optional parent link.
children: detachable LIST [CMS_LINK]
-- Optional children links.
-- Useful to have a non flat menu.
deferred
end
@@ -71,10 +78,15 @@ feature -- Access
feature -- Status report
debug_output: STRING
debug_output: STRING_32
-- String that should be displayed in debugger to represent `Current'.
do
Result := title.as_string_8 + " -> " + location
create Result.make_from_string (title)
Result.append_string_general (" -> ")
Result.append_string_general (location)
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

View 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

View File

@@ -1,5 +1,7 @@
note
description: "Summary description for {CMS_LOCAL_MENU}."
description: "[
Abstraction to represent a link to a CMS resource.
]"
date: "$Date$"
revision: "$Revision$"
@@ -22,6 +24,7 @@ create
feature {NONE} -- Initialization
make (a_title: detachable like title; a_location: like location)
-- Create current local link with optional title `a_title' and location `a_location'.
do
if a_title /= Void then
title := a_title
@@ -31,44 +34,47 @@ feature {NONE} -- Initialization
location := a_location
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
is_active: BOOLEAN
-- <Precursor>
is_expanded: BOOLEAN
-- <Precursor>
do
Result := is_expandable and then internal_is_expanded
end
is_collapsed: BOOLEAN
-- Is expanded, but visually collapsed?
-- <Precursor>
do
Result := is_expandable and then internal_is_collapsed
end
is_expandable: BOOLEAN
-- <Precursor>
do
Result := internal_is_expandable or internal_is_expanded or has_children
end
has_children: BOOLEAN
-- <Precursor>
do
Result := attached children as l_children and then not l_children.is_empty
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
add_link (lnk: CMS_LINK)
-- <Precursor>
local
lst: like children
do
@@ -81,6 +87,7 @@ feature -- Element change
end
remove_link (lnk: CMS_LINK)
-- <Precursor>
local
lst: like children
do
@@ -94,8 +101,19 @@ feature -- Element change
end
set_children (lst: like children)
-- Set `children' to `lst'.
do
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
feature -- Status change
@@ -104,33 +122,52 @@ feature -- Status change
-- Set `is_active' to `b'.
do
is_active := b
ensure
is_active: is_active = b
end
set_expanded (b: like is_expanded)
-- Set `is_expanded' to `b'.
do
if b then
set_expandable (True)
set_collapsed (False)
end
internal_is_expanded := b
ensure
is_expanded: is_expanded = b
end
set_collapsed (b: like is_collapsed)
-- Set `is_collapsed' to `b'.
do
if b then
set_expanded (False)
end
internal_is_collapsed := b
ensure
is_collapsed: is_collapsed= b
end
set_expandable (b: like is_expandable)
-- Set `is_expandable' to `b'.
do
internal_is_expandable := b
ensure
is_expandable: is_expandable = b
end
set_permission_arguments (args: like permission_arguments)
do
permission_arguments := args
end
feature {NONE} -- Implementation
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

View File

@@ -1,5 +1,8 @@
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$"
revision: "$Revision$"
@@ -8,6 +11,9 @@ class
inherit
CMS_LINK_COMPOSITE
redefine
is_empty
end
create
make,
@@ -15,45 +21,53 @@ create
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
name := a_name
create items.make (n)
create items.make (a_capacity)
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
make (a_name, n)
make (a_name, a_capacity)
set_title (a_title)
end
feature -- Access
name: READABLE_STRING_8
-- Identifier for Current menu.
title: detachable READABLE_STRING_32
-- Optional title.
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)
-- <Precursor>
do
items.extend (lnk)
end
remove (lnk: CMS_LINK)
-- <Precursor>
do
items.prune_all (lnk)
end
feature -- status report
is_empty: BOOLEAN
do
Result := items.is_empty
end
feature -- Element change
set_title (t: like title)
do
title := t
@@ -69,4 +83,7 @@ feature -- Access
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

View File

@@ -1,5 +1,7 @@
note
description: "Summary description for {USER}."
description: "[
Interface representing a USER in the CMS system.
]"
date: "$Date$"
revision: "$Revision$"
@@ -27,31 +29,33 @@ feature {NONE} -- Initialization
feature -- Access
id: INTEGER_64
-- Unique id.
-- Unique id.
name: READABLE_STRING_32
-- User name.
-- User name.
password: detachable READABLE_STRING_32
-- User password.
-- User password.
email: detachable READABLE_STRING_32
-- User email.
-- User email.
profile: detachable CMS_USER_PROFILE
-- User profile.
-- User profile.
creation_date: DATE_TIME
-- Creation date.
-- Creation date.
last_login_date: detachable DATE_TIME
-- User last login.
-- User last login.
feature -- Access: data
data: detachable STRING_TABLE [detachable ANY]
-- Additional user's data.
-- Additional data.
data_item (k: READABLE_STRING_GENERAL): detachable ANY
-- Additional item data.
-- Additional item data associated with key `k'.
do
if attached data as l_data then
Result := l_data.item (k)
@@ -70,14 +74,21 @@ feature -- Status report
Result := attached email as e and then not e.is_empty
end
debug_output: STRING
debug_output: STRING_32
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
same_as (u: detachable CMS_USER): BOOLEAN
same_as (other: detachable CMS_USER): BOOLEAN
-- Is Current same as `other'?
do
Result := u /= Void and then id = u.id
Result := other /= Void and then id = other.id
end
feature -- Change element
@@ -98,20 +109,20 @@ feature -- Change element
name_set: name = n
end
set_password (p: like password)
-- Set `password' with `p'.
set_password (a_password: like password)
-- Set `password' with `a_password'.
do
password := p
password := a_password
ensure
password_set: password = p
password_set: password = a_password
end
set_email (m: like email)
-- Set `email' with `m'.
set_email (a_email: like email)
-- Set `email' with `a_email'.
do
email := m
email := a_email
ensure
email_set: email = m
email_set: email = a_email
end
set_profile (prof: like profile)
@@ -122,25 +133,6 @@ feature -- Change element
profile_set: profile = prof
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)
local
prof: like profile
@@ -163,4 +155,30 @@ feature -- Change element
set_last_login_date (create {DATE_TIME}.make_now_utc)
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

View 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

View 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

View File

@@ -13,7 +13,7 @@
<library name="error" location="$ISE_LIBRARY\contrib\library\utility\general\error\error-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="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"/>

View File

@@ -215,7 +215,7 @@ feature -- Basic operations: User Profiles
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'.
local
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_8]
l_cursor: TABLE_ITERATION_CURSOR [READABLE_STRING_8, READABLE_STRING_GENERAL]
do
error_handler.reset
log.write_information (generator + ".save_profile")
@@ -224,7 +224,7 @@ feature -- Basic operations: User Profiles
until
l_cursor.after
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
end

View File

@@ -7,7 +7,7 @@
</option>
<setting name="concurrency" value="thread"/>
<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="persitence_mysql" location="..\persistence_mysql-safe.ecf" readonly="false"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>

View File

@@ -11,6 +11,7 @@
<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="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="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"/>

View File

@@ -12,7 +12,7 @@
<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="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="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"/>