Added notion of author (owner) and editor to allow the editing of node by non owner users.

This commit is contained in:
2017-03-03 11:12:51 +01:00
parent 4cbdfeff06
commit 6cb6dd1609
18 changed files with 248 additions and 70 deletions

View File

@@ -275,7 +275,11 @@ feature -- Hooks
if l_entity.is_published then
if l_entity.author = Void then
-- FIXME!!!
l_entity.set_author (l_page_api.cms_api.user)
if attached l_entity.editor as l_editor then
l_entity.set_author (l_editor)
else
l_entity.set_author (l_page_api.cms_api.user)
end
a_import_ctx.log (l_node_type.name + " %"" + fp.utf_8_name + "%" WARNING (Author is unknown!)")
end
if attached l_entity.author as l_author then

View File

@@ -72,13 +72,13 @@ feature -- Access
feature {NONE} -- Queries
sql_select_available_parents_for_node : STRING = "[
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, publish, created, changed, status
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, editor, publish, created, changed, status
FROM nodes node LEFT JOIN page_nodes pn ON node.nid = pn.nid AND node.nid != :nid
WHERE node.nid != :nid AND pn.parent != :nid AND node.status != -1 GROUP BY node.nid, node.revision;
]"
sql_select_children_of_node: STRING = "[
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, publish, created, changed, status
SELECT node.nid, node.revision, node.type, title, summary, content, format, author, editor, publish, created, changed, status
FROM nodes node LEFT JOIN page_nodes pn ON node.nid = pn.nid
WHERE pn.parent = :nid AND node.status != -1 GROUP BY node.nid, node.revision;
]"