Implemented CMS storage for user and nodes.
Implemented role and permission storage.
Introduced the CMS_PARTIAL_NODE and CMS_PARTIAL_USER.
Added support for node storage extension
- storage of data specific to each node content type,
- in addition to the core CMS_NODE)
- For now, only implemented for SQL storage.
Note: in current version, CMS_PAGE support is hard coded in the core,
(as opposed to be only supported by the node module.)
Commented/removed for now, the Web API code to update node summary, title, via REST request.
This commit is contained in:
19
library/model/src/user/cms_partial_user.e
Normal file
19
library/model/src/user/cms_partial_user.e
Normal file
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "Partial CMS USER."
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
CMS_PARTIAL_USER
|
||||
|
||||
inherit
|
||||
CMS_USER
|
||||
|
||||
create
|
||||
make,
|
||||
make_with_id -- MAYBE: export to CMS_STORAGE
|
||||
|
||||
note
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -71,6 +71,11 @@ feature -- Access
|
||||
last_login_date: detachable DATE_TIME
|
||||
-- User last login.
|
||||
|
||||
feature -- Roles
|
||||
|
||||
roles: detachable LIST [CMS_USER_ROLE]
|
||||
-- If set, list of roles for current user.
|
||||
|
||||
feature -- Access: data
|
||||
|
||||
data: detachable STRING_TABLE [detachable ANY]
|
||||
@@ -189,6 +194,14 @@ feature -- Change element
|
||||
set_last_login_date (create {DATE_TIME}.make_now_utc)
|
||||
end
|
||||
|
||||
feature -- Element change: roles
|
||||
|
||||
set_roles (lst: like roles)
|
||||
-- Set `roles' to `lst'.
|
||||
do
|
||||
roles := lst
|
||||
end
|
||||
|
||||
feature -- Change element: data
|
||||
|
||||
set_data_item (k: READABLE_STRING_GENERAL; d: like data_item)
|
||||
@@ -217,6 +230,6 @@ invariant
|
||||
id_or_name_set: id > 0 or else not name.is_whitespace
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
|
||||
@@ -22,15 +22,25 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_id (a_id: like id; a_name: like name)
|
||||
make_with_id (a_id: like id)
|
||||
-- Create current role with role id `a_id'.
|
||||
do
|
||||
id := a_id
|
||||
make (a_name)
|
||||
name := {STRING_32} ""
|
||||
initialize
|
||||
end
|
||||
|
||||
make (a_name: like name)
|
||||
-- Create current role with name `a_name'.
|
||||
require
|
||||
a_name_valid: not a_name.is_whitespace
|
||||
do
|
||||
name := a_name
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
create {ARRAYED_LIST [READABLE_STRING_8]} permissions.make (0)
|
||||
end
|
||||
|
||||
@@ -42,10 +52,10 @@ feature -- Status report
|
||||
Result := id > 0
|
||||
end
|
||||
|
||||
has_permission (p: READABLE_STRING_8): BOOLEAN
|
||||
has_permission (p: READABLE_STRING_GENERAL): BOOLEAN
|
||||
-- Has permission `p'?
|
||||
do
|
||||
Result := across permissions as c some c.item.is_case_insensitive_equal (p) end
|
||||
Result := across permissions as c some p.is_case_insensitive_equal (c.item) end
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
@@ -53,7 +63,7 @@ feature -- Access
|
||||
id: INTEGER
|
||||
-- Unique id associated with Current role.
|
||||
|
||||
name: READABLE_STRING_8
|
||||
name: READABLE_STRING_32
|
||||
-- Name of Current role.
|
||||
|
||||
permissions: LIST [READABLE_STRING_8]
|
||||
@@ -115,6 +125,6 @@ feature -- Permission change
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
|
||||
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, 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