Item class has been moved to a new directory 'models', a new class has been added: ItemContent
and same fields from Item were moved to ItemContent Item - id - parent_id - type (file, dir, symlink) - url - subject - template (html template) - sort_index - content_id ItemContent - id - ref -> references (renamed) - user_id - modification_user_id - group_id - privileges - date_creation - date_modification - guest_name - link_to - link_redirect - file_path - file_fs - file_type - file_size - has_thumb -> file_has_thumb (renamed) - hash -> file_hash (renamed) - hash_type -> file_hash_type (renamed) - content -> content_raw (renamed) - content_type -> content_raw_type (renamed) - content_parsed - content_parsed_type - meta - ameta -> meta_admin (renamed) - modify_index (removed) WIP: #4
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* Copyright (c) 2010-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -78,7 +78,7 @@ return true;
|
||||
|
||||
bool PrivChanger::ChangeOwner(Item & item, long user_id, long group_id)
|
||||
{
|
||||
if( user_id!=item.user_id || group_id!=item.group_id )
|
||||
if( user_id!=item.item_content.user_id || group_id!=item.item_content.group_id )
|
||||
{
|
||||
if( !system->CanChangeUser(item, user_id) )
|
||||
{
|
||||
@@ -93,8 +93,8 @@ bool PrivChanger::ChangeOwner(Item & item, long user_id, long group_id)
|
||||
}
|
||||
}
|
||||
|
||||
item.user_id = user_id;
|
||||
item.group_id = group_id;
|
||||
item.item_content.user_id = user_id;
|
||||
item.item_content.group_id = group_id;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ return true;
|
||||
|
||||
bool PrivChanger::ChangePrivileges(Item & item, int privileges)
|
||||
{
|
||||
if( privileges != item.privileges )
|
||||
if( privileges != item.item_content.privileges )
|
||||
{
|
||||
if( !system->CanChangePrivileges(item, privileges) )
|
||||
{
|
||||
@@ -112,7 +112,7 @@ bool PrivChanger::ChangePrivileges(Item & item, int privileges)
|
||||
}
|
||||
}
|
||||
|
||||
item.privileges = privileges;
|
||||
item.item_content.privileges = privileges;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -133,7 +133,11 @@ void PrivChanger::ChangePriv(Item & item, long user_id, long group_id, int privi
|
||||
return;
|
||||
}
|
||||
|
||||
cur->request->status = db->EditPrivById(item, item.id);
|
||||
//cur->request->status = db->EditPrivById(item, item.id);
|
||||
if( !item.update(false, true) )
|
||||
{
|
||||
// IMPROVEME put some log here, and slog too
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -197,16 +201,24 @@ Item * root = 0;
|
||||
|
||||
void PrivChanger::PrivFilesInDir(long parent_id)
|
||||
{
|
||||
DbItemQuery iq;
|
||||
// DbItemQuery iq;
|
||||
//
|
||||
// iq.SetAll(false, false);
|
||||
// iq.sel_user_id = iq.sel_group_id = iq.sel_guest_name = iq.sel_privileges = iq.sel_url = true;
|
||||
//
|
||||
// iq.WhereParentId(parent_id);
|
||||
// iq.WhereType(Item::dir, false);
|
||||
|
||||
iq.SetAll(false, false);
|
||||
iq.sel_user_id = iq.sel_group_id = iq.sel_guest_name = iq.sel_privileges = iq.sel_url = true;
|
||||
morm::Finder<Item> finder(model_connector);
|
||||
|
||||
iq.WhereParentId(parent_id);
|
||||
iq.WhereType(Item::dir, false);
|
||||
|
||||
db->GetItems(cur->request->item_tab, iq);
|
||||
finder.
|
||||
select().
|
||||
where().
|
||||
eq(L"parent_id", parent_id).
|
||||
neq(L"type", static_cast<int>(Item::dir)).
|
||||
get_vector(cur->request->item_tab);
|
||||
|
||||
//db->GetItems(cur->request->item_tab, iq);
|
||||
|
||||
std::vector<Item>::iterator i = cur->request->item_tab.begin();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user