Updated table nodes to support soft deletes using the new field
'deleted_at' as Datetime and give us free metadata. Updated Sqlite builder to test different scenarios for users and roles. Updated NODE_FORM_RESPONSE.edit_form feature to add a delete operation iff there is a node ie node id >0 and the current user has delete permission on it. Updated NODE_HANDLER.do_post to handle the operation "DELETE". Updated queries to retrieve nodes filter by no logical deleted rows (ie. deleted_at is NULL). Updated CMS_USER_API.has_permissions. (authenticated_user_role seems to generic).
This commit is contained in:
@@ -48,16 +48,11 @@ feature -- Factory
|
||||
local
|
||||
u: CMS_USER
|
||||
r: CMS_USER_ROLE
|
||||
l: LIST[CMS_USER_ROLE]
|
||||
do
|
||||
-- Schema
|
||||
a_storage.sql_execute_file_script (a_setup.environment.path.extended ("scripts").extended ("core.sql"))
|
||||
|
||||
-- Data
|
||||
-- Users
|
||||
create u.make ("admin")
|
||||
u.set_password ("istrator#")
|
||||
u.set_email (a_setup.site_email)
|
||||
a_storage.new_user (u)
|
||||
|
||||
-- Roles
|
||||
create r.make ("anonymous")
|
||||
@@ -65,10 +60,40 @@ feature -- Factory
|
||||
create r.make ("authenticated")
|
||||
r.add_permission ("create page")
|
||||
r.add_permission ("edit page")
|
||||
r.add_permission ("delete page")
|
||||
a_storage.save_user_role (r)
|
||||
|
||||
-- Test custom value
|
||||
|
||||
create {ARRAYED_LIST[CMS_USER_ROLE]} l.make (1)
|
||||
l.force (r)
|
||||
|
||||
-- Users
|
||||
create u.make ("admin")
|
||||
u.set_password ("istrator#")
|
||||
u.set_email (a_setup.site_email)
|
||||
a_storage.new_user (u)
|
||||
|
||||
create u.make ("auth")
|
||||
u.set_password ("enticated#")
|
||||
u.set_email (a_setup.site_email)
|
||||
u.set_roles (l)
|
||||
a_storage.new_user (u)
|
||||
|
||||
-- Roles, view role for testing.
|
||||
create r.make ("view")
|
||||
r.add_permission ("view page")
|
||||
a_storage.save_user_role (r)
|
||||
|
||||
create {ARRAYED_LIST[CMS_USER_ROLE]} l.make (1)
|
||||
l.force (r)
|
||||
|
||||
create u.make ("view")
|
||||
u.set_password ("only#")
|
||||
u.set_email (a_setup.site_email)
|
||||
u.set_roles (l)
|
||||
a_storage.new_user (u)
|
||||
|
||||
-- Test custom value
|
||||
a_storage.set_custom_value ("abc", "123", "test")
|
||||
a_storage.set_custom_value ("abc", "OK", "test")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user