Added notion of author (owner) and editor to allow the editing of node by non owner users.
This commit is contained in:
@@ -276,7 +276,11 @@ feature -- Hooks
|
||||
if l_entity.is_published then
|
||||
if l_entity.author = Void then
|
||||
-- FIXME!!!
|
||||
l_entity.set_author (l_blog_api.cms_api.user)
|
||||
if attached l_entity.editor as l_last_editor then
|
||||
l_entity.set_author (l_last_editor)
|
||||
else
|
||||
l_entity.set_author (l_blog_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
|
||||
|
||||
@@ -159,16 +159,28 @@ feature {NONE} -- Queries
|
||||
-- Nodes count (Published and not Published)
|
||||
--| note: {CMS_NODE_API}.trashed = -1
|
||||
|
||||
sql_select_blogs_order_created_desc: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC;"
|
||||
sql_select_blogs_order_created_desc: STRING
|
||||
-- SQL Query to retrieve all nodes that are from the type "blog" ordered by descending creation date.
|
||||
once
|
||||
Result := sql_select_all_from_nodes + " WHERE status != -1 AND type = %"blog%" ORDER BY created DESC;"
|
||||
end
|
||||
|
||||
sql_blogs_limited: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
|
||||
sql_blogs_limited: STRING
|
||||
--- SQL Query to retrieve all nodes of type "blog" limited by limit and starting at offset
|
||||
once
|
||||
Result := sql_select_all_from_nodes + " WHERE status != -1 AND type = %"blog%" ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
|
||||
end
|
||||
|
||||
sql_blogs_from_user_limited: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" AND author = :user ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
|
||||
sql_blogs_from_user_limited: STRING
|
||||
--- SQL Query to retrieve all nodes of type "blog" from author with id limited by limit + offset
|
||||
once
|
||||
Result := sql_select_all_from_nodes + " WHERE status != -1 AND type = %"blog%" AND author = :user ORDER BY created DESC LIMIT :limit OFFSET :offset ;"
|
||||
end
|
||||
|
||||
sql_blogs_from_user_with_title: STRING = "SELECT * FROM nodes WHERE status != -1 AND type = %"blog%" AND author = :user AND title = :title ORDER BY created DESC;"
|
||||
sql_blogs_from_user_with_title: STRING
|
||||
--- SQL Query to retrieve all nodes of type "blog" from author with title .
|
||||
once
|
||||
Result := sql_select_all_from_nodes + " WHERE status != -1 AND type = %"blog%" AND author = :user AND title = :title ORDER BY created DESC;"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user