changed: added Cur structure
we have there two pointers: Request * request; Session * session; these are the current request and the current session the session GC was moved to SessionManager (was in SessionContainer) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@708 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
#include "privchanger.h"
|
||||
|
||||
|
||||
void PrivChanger::SetRequest(Request * prequest)
|
||||
void PrivChanger::SetCur(Cur * pcur)
|
||||
{
|
||||
request = prequest;
|
||||
cur = pcur;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ bool PrivChanger::CheckAccess()
|
||||
// but we cannot use parameter 'r' on files
|
||||
// and only logged users can change permissions
|
||||
|
||||
if( !request->session->puser || (request->is_item && request->IsParam(L"r")) )
|
||||
if( !cur->session->puser || (cur->request->is_item && cur->request->IsParam(L"r")) )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ void PrivChanger::ChangePriv(Item & item, long user_id, long group_id, int privi
|
||||
return;
|
||||
}
|
||||
|
||||
request->status = db->EditPrivById(item, item.id);
|
||||
cur->request->status = db->EditPrivById(item, item.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,12 +174,12 @@ void PrivChanger::PrivFilesInDir(long parent_id)
|
||||
iq.WhereParentId(parent_id);
|
||||
iq.WhereType(Item::dir, false);
|
||||
|
||||
db->GetItems(request->item_tab, iq);
|
||||
db->GetItems(cur->request->item_tab, iq);
|
||||
|
||||
|
||||
std::vector<Item>::iterator i = request->item_tab.begin();
|
||||
std::vector<Item>::iterator i = cur->request->item_tab.begin();
|
||||
|
||||
for( ; i != request->item_tab.end() ; ++i)
|
||||
for( ; i != cur->request->item_tab.end() ; ++i)
|
||||
{
|
||||
PrivLog(L"changed file: ", -1, i->url);
|
||||
ChangePriv(*i, user_id_file, group_id_file, priv_file);
|
||||
@@ -210,9 +210,9 @@ void PrivChanger::PrivDir(long parent_id)
|
||||
void PrivChanger::ReadPriv(const wchar_t * user_in, const wchar_t * group_in, const wchar_t * priv_in,
|
||||
long & user_id, long & group_id, int & priv)
|
||||
{
|
||||
const std::wstring & user_str = request->PostVar(user_in);
|
||||
const std::wstring & group_str = request->PostVar(group_in);
|
||||
const std::wstring & priv_str = request->PostVar(priv_in);
|
||||
const std::wstring & user_str = cur->request->PostVar(user_in);
|
||||
const std::wstring & group_str = cur->request->PostVar(group_in);
|
||||
const std::wstring & priv_str = cur->request->PostVar(priv_in);
|
||||
|
||||
if( change_owner )
|
||||
{
|
||||
@@ -234,18 +234,18 @@ void PrivChanger::PrivDir()
|
||||
PrivLogStart(L"Content: changes for dirs: ", user_id_dir, group_id_dir, priv_dir);
|
||||
|
||||
|
||||
if( request->IsPostVar(L"changecurrentdir") )
|
||||
if( cur->request->IsPostVar(L"changecurrentdir") )
|
||||
{
|
||||
Item & last_dir = *request->dir_tab.back();
|
||||
Item & last_dir = *cur->request->dir_tab.back();
|
||||
PrivLog(L"changed dir: ", last_dir.id, last_dir.url);
|
||||
ChangePriv(*request->dir_tab.back(), user_id_dir, group_id_dir, priv_dir);
|
||||
ChangePriv(*cur->request->dir_tab.back(), user_id_dir, group_id_dir, priv_dir);
|
||||
}
|
||||
|
||||
|
||||
subdirectories = request->IsPostVar(L"changesubdirs");
|
||||
subdirectories = cur->request->IsPostVar(L"changesubdirs");
|
||||
|
||||
// go through all directories
|
||||
PrivDir(request->dir_tab.back()->id);
|
||||
PrivDir(cur->request->dir_tab.back()->id);
|
||||
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
@@ -258,14 +258,14 @@ void PrivChanger::PrivOneItem()
|
||||
ReadPriv(L"user", L"group", L"privileges", user_id_file, group_id_file, priv_file);
|
||||
PrivLogStart(L"Content: changes: ", user_id_file, group_id_file, priv_file);
|
||||
|
||||
if( request->is_item )
|
||||
if( cur->request->is_item )
|
||||
{
|
||||
ChangePriv(request->item, user_id_file, group_id_file, priv_file);
|
||||
system->RedirectTo(request->item);
|
||||
ChangePriv(cur->request->item, user_id_file, group_id_file, priv_file);
|
||||
system->RedirectTo(cur->request->item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChangePriv(*request->dir_tab.back(), user_id_file, group_id_file, priv_file);
|
||||
ChangePriv(*cur->request->dir_tab.back(), user_id_file, group_id_file, priv_file);
|
||||
system->RedirectToLastDir();
|
||||
}
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void PrivChanger::Change(bool change_owner_, bool change_priv_)
|
||||
change_owner = change_owner_;
|
||||
change_priv = change_priv_;
|
||||
|
||||
if( request->IsParam(L"r") )
|
||||
if( cur->request->IsParam(L"r") )
|
||||
{
|
||||
PrivDir();
|
||||
}
|
||||
|
Reference in New Issue
Block a user