added: winix function: rmuser
changed: UGContainer<> now uses std::list as a storage
(previously it was using std::vector with pointers)
removed: now we don't have the operator[] for UGContainer<>
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@816 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -91,10 +91,11 @@ dir.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
|
||||
dir.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
|
||||
dir.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
dir.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
|
||||
dir.o: ../functions/rm.h ../functions/sort.h ../functions/specialdefault.h
|
||||
dir.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
|
||||
dir.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
dir.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
dir.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
||||
dir.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
dir.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
dir.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
dir.o: ../functions/who.h ../functions/vim.h
|
||||
doc.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
||||
doc.o: ../../ezc/src/pattern.h ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
doc.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h misc.h
|
||||
@@ -153,10 +154,11 @@ env.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
|
||||
env.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
|
||||
env.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
env.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
|
||||
env.o: ../functions/rm.h ../functions/sort.h ../functions/specialdefault.h
|
||||
env.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
|
||||
env.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
env.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
env.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
||||
env.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
env.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
env.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
env.o: ../functions/who.h ../functions/vim.h
|
||||
filters.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
||||
filters.o: ../../ezc/src/pattern.h ../../ezc/src/item.h
|
||||
filters.o: ../../ezc/src/funinfo.h ../../ezc/src/functions.h
|
||||
@@ -359,8 +361,8 @@ man.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
||||
man.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
|
||||
man.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
|
||||
man.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
|
||||
man.o: ../functions/reload.h ../functions/rm.h ../functions/sort.h
|
||||
man.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
man.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
|
||||
man.o: ../functions/sort.h ../functions/specialdefault.h ../functions/stat.h
|
||||
man.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
man.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
man.o: ../functions/who.h ../functions/vim.h
|
||||
@@ -488,8 +490,8 @@ priv.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
||||
priv.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
|
||||
priv.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
|
||||
priv.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
|
||||
priv.o: ../functions/reload.h ../functions/rm.h ../functions/sort.h
|
||||
priv.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
priv.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
|
||||
priv.o: ../functions/sort.h ../functions/specialdefault.h ../functions/stat.h
|
||||
priv.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
priv.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
priv.o: ../functions/who.h ../functions/vim.h
|
||||
@@ -601,8 +603,8 @@ sys.o: ../functions/logout.h ../functions/ln.h ../functions/ls.h
|
||||
sys.o: ../functions/man.h ../functions/meta.h ../functions/mkdir.h
|
||||
sys.o: ../functions/mv.h ../functions/nicedit.h ../functions/node.h
|
||||
sys.o: ../functions/passwd.h ../functions/priv.h ../functions/pw.h
|
||||
sys.o: ../functions/reload.h ../functions/rm.h ../functions/sort.h
|
||||
sys.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
sys.o: ../functions/reload.h ../functions/rm.h ../functions/rmuser.h
|
||||
sys.o: ../functions/sort.h ../functions/specialdefault.h ../functions/stat.h
|
||||
sys.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
sys.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
sys.o: ../functions/who.h ../functions/vim.h ../templates/templates.h
|
||||
@@ -672,7 +674,7 @@ templates.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
|
||||
templates.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
|
||||
templates.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
templates.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
|
||||
templates.o: ../functions/rm.h ../functions/sort.h
|
||||
templates.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
||||
templates.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
templates.o: ../functions/subject.h ../functions/template.h
|
||||
templates.o: ../functions/tinymce.h ../functions/uname.h
|
||||
@@ -813,8 +815,9 @@ winix.o: ../functions/ln.h ../functions/ls.h ../functions/man.h
|
||||
winix.o: ../functions/meta.h ../functions/mkdir.h ../functions/mv.h
|
||||
winix.o: ../functions/nicedit.h ../functions/node.h ../functions/passwd.h
|
||||
winix.o: ../functions/priv.h ../functions/pw.h ../functions/reload.h
|
||||
winix.o: ../functions/rm.h ../functions/sort.h ../functions/specialdefault.h
|
||||
winix.o: ../functions/stat.h ../functions/subject.h ../functions/template.h
|
||||
winix.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
||||
winix.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
winix.o: ../functions/subject.h ../functions/template.h
|
||||
winix.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
|
||||
winix.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
|
||||
winix.o: ../templates/templates.h ../core/misc.h
|
||||
|
||||
@@ -59,47 +59,65 @@ void env_user_name(Info & i)
|
||||
|
||||
|
||||
|
||||
static size_t user_index = 0;
|
||||
static Users::Iterator user_iter;
|
||||
static size_t user_reqid = 0;
|
||||
static size_t user_index; // only information
|
||||
|
||||
|
||||
bool env_user_tab_init()
|
||||
{
|
||||
if( user_reqid != cur->request->id )
|
||||
{
|
||||
user_reqid = cur->request->id;
|
||||
user_iter = system->users.End();
|
||||
}
|
||||
|
||||
return user_iter != system->users.End();
|
||||
}
|
||||
|
||||
|
||||
void env_user_tab(Info & i)
|
||||
{
|
||||
env_user_tab_init();
|
||||
|
||||
if( cur->session->puser && cur->session->puser->super_user )
|
||||
{
|
||||
user_index = i.iter;
|
||||
i.res = user_index < system->users.Size();
|
||||
|
||||
if( i.iter == 0 )
|
||||
user_iter = system->users.Begin();
|
||||
else
|
||||
if( user_iter != system->users.End() )
|
||||
++user_iter;
|
||||
|
||||
i.res = user_iter != system->users.End();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool evn_user_tab_has_access()
|
||||
{
|
||||
return cur->session->puser &&
|
||||
cur->session->puser->super_user &&
|
||||
user_index < system->users.Size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void env_user_tab_id(Info & i)
|
||||
{
|
||||
if( evn_user_tab_has_access() )
|
||||
i.out << system->users[user_index].id;
|
||||
if( env_user_tab_init() )
|
||||
i.out << user_iter->id;
|
||||
}
|
||||
|
||||
|
||||
void env_user_tab_name(Info & i)
|
||||
{
|
||||
if( evn_user_tab_has_access() )
|
||||
i.out << system->users[user_index].name;
|
||||
if( env_user_tab_init() )
|
||||
i.out << user_iter->name;
|
||||
}
|
||||
|
||||
|
||||
void env_user_tab_is_current(Info & i)
|
||||
{
|
||||
if( evn_user_tab_has_access() && functions->fun_env.GetUser() )
|
||||
i.res = (system->users[user_index].id == functions->fun_env.GetUser()->id );
|
||||
if( env_user_tab_init() )
|
||||
{
|
||||
User * puser = functions->fun_env.GetUser();
|
||||
|
||||
if( puser )
|
||||
i.res = (user_iter->id == puser->id );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ void priv_user_tab_init(Item & item)
|
||||
if( cur->session->puser->super_user )
|
||||
{
|
||||
// super user is allowed to change to any user
|
||||
for(size_t i=0 ; i<system->users.Size() ; ++i)
|
||||
priv_user_table.push_back( system->users[i].id );
|
||||
for(Users::Iterator i=system->users.Begin() ; i != system->users.End() ; ++i)
|
||||
priv_user_table.push_back(i->id);
|
||||
|
||||
// as well to nobody (-1)
|
||||
priv_user_table.push_back(-1);
|
||||
@@ -143,8 +143,8 @@ void priv_group_tab_init(Item & item)
|
||||
if( cur->session->puser->super_user )
|
||||
{
|
||||
// super user is allowed to change to any group
|
||||
for(size_t i=0 ; i<system->groups.Size() ; ++i)
|
||||
priv_group_table.push_back( system->groups[i].id );
|
||||
for(Groups::Iterator i=system->groups.Begin() ; i != system->groups.End() ; ++i)
|
||||
priv_group_table.push_back(i->id);
|
||||
|
||||
// as well to nogroup (-1)
|
||||
priv_group_table.push_back(-1);
|
||||
@@ -156,7 +156,7 @@ void priv_group_tab_init(Item & item)
|
||||
// owner of the item -- is allowed to change only to a group in which he belongs to
|
||||
for(size_t i=0 ; i<cur->session->puser->groups.size() ; ++i)
|
||||
{
|
||||
priv_group_table.push_back( cur->session->puser->groups[i] );
|
||||
priv_group_table.push_back(cur->session->puser->groups[i]);
|
||||
|
||||
if( item.group_id == cur->session->puser->groups[i] )
|
||||
was_current_group = true;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008-2011, Tomasz Sowa
|
||||
* Copyright (c) 2008-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -67,32 +67,6 @@ void sys_plugin_tab_name(Info & i)
|
||||
|
||||
|
||||
|
||||
static size_t sys_user_index = 0;
|
||||
|
||||
void sys_user_tab(Info & i)
|
||||
{
|
||||
sys_user_index = i.iter;
|
||||
i.res = sys_user_index < system->users.Size();
|
||||
}
|
||||
|
||||
|
||||
void sys_user_tab_is_current(Info & i)
|
||||
{
|
||||
if( !cur->session->puser )
|
||||
return;
|
||||
|
||||
if( sys_user_index < system->users.Size() )
|
||||
i.res = (cur->session->puser->id == system->users[sys_user_index].id);
|
||||
}
|
||||
|
||||
|
||||
void sys_user_tab_name(Info & i)
|
||||
{
|
||||
if( sys_user_index < system->users.Size() )
|
||||
i.out << system->users[sys_user_index].name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
@@ -472,9 +472,6 @@ void Templates::CreateFunctions()
|
||||
ezc_functions.Insert("sys_plugin_tab", sys_plugin_tab);
|
||||
ezc_functions.Insert("sys_plugin_tab_has_name", sys_plugin_tab_has_name);
|
||||
ezc_functions.Insert("sys_plugin_tab_name", sys_plugin_tab_name);
|
||||
ezc_functions.Insert("sys_user_tab", sys_user_tab);
|
||||
ezc_functions.Insert("sys_user_tab_is_current", sys_user_tab_is_current);
|
||||
ezc_functions.Insert("sys_user_tab_name", sys_user_tab_name);
|
||||
|
||||
|
||||
/*
|
||||
@@ -494,6 +491,7 @@ void Templates::CreateFunctions()
|
||||
/*
|
||||
user
|
||||
*/
|
||||
ezc_functions.Insert("user_id", user_id);
|
||||
ezc_functions.Insert("user_name", user_name);
|
||||
ezc_functions.Insert("user_logged", user_logged);
|
||||
ezc_functions.Insert("user_super_user", user_super_user);
|
||||
|
||||
@@ -390,9 +390,6 @@ namespace TemplatesFunctions
|
||||
void sys_plugin_tab(Info & i);
|
||||
void sys_plugin_tab_has_name(Info & i);
|
||||
void sys_plugin_tab_name(Info & i);
|
||||
void sys_user_tab(Info & i);
|
||||
void sys_user_tab_is_current(Info & i);
|
||||
void sys_user_tab_name(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
@@ -412,6 +409,7 @@ namespace TemplatesFunctions
|
||||
/*
|
||||
user
|
||||
*/
|
||||
void user_id(Info & i);
|
||||
void user_name(Info & i);
|
||||
void user_logged(Info & i);
|
||||
void user_super_user(Info & i);
|
||||
|
||||
@@ -25,12 +25,16 @@ void user_logged(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void user_id(Info & i)
|
||||
{
|
||||
if( cur->session->puser )
|
||||
i.out << cur->session->puser->id;
|
||||
}
|
||||
|
||||
void user_name(Info & i)
|
||||
{
|
||||
if( !cur->session->puser )
|
||||
return;
|
||||
|
||||
i.out << cur->session->puser->name;
|
||||
if( cur->session->puser )
|
||||
i.out << cur->session->puser->name;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,12 +112,35 @@ void user_can_use_raw(Info & i)
|
||||
|
||||
|
||||
|
||||
static size_t user_index = 0;
|
||||
static Users::Iterator user_iter;
|
||||
static size_t user_reqid = 0;
|
||||
static size_t user_index; // only information
|
||||
|
||||
|
||||
bool user_tab_init()
|
||||
{
|
||||
if( user_reqid != cur->request->id )
|
||||
{
|
||||
user_reqid = cur->request->id;
|
||||
user_iter = system->users.Begin();
|
||||
}
|
||||
|
||||
return user_iter != system->users.End();
|
||||
}
|
||||
|
||||
|
||||
void user_tab(Info & i)
|
||||
{
|
||||
user_tab_init();
|
||||
user_index = i.iter;
|
||||
i.res = user_index < system->users.Size();
|
||||
|
||||
if( i.iter == 0 )
|
||||
user_iter = system->users.Begin();
|
||||
else
|
||||
if( user_iter != system->users.End() )
|
||||
++user_iter;
|
||||
|
||||
i.res = user_iter != system->users.End();
|
||||
}
|
||||
|
||||
|
||||
@@ -124,49 +151,47 @@ void user_tab_index(Info & i)
|
||||
|
||||
void user_tab_id(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.out << system->users[user_index].id;
|
||||
if( user_tab_init() )
|
||||
i.out << user_iter->id;
|
||||
}
|
||||
|
||||
|
||||
void user_tab_name(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.out << system->users[user_index].name;
|
||||
if( user_tab_init() )
|
||||
i.out << user_iter->name;
|
||||
}
|
||||
|
||||
|
||||
void user_tab_is_super_user(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.res = system->users[user_index].super_user;
|
||||
if( user_tab_init() )
|
||||
i.res = user_iter->super_user;
|
||||
}
|
||||
|
||||
|
||||
void user_tab_is_active(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.res = system->users[user_index].status == WINIX_ACCOUNT_READY;
|
||||
if( user_tab_init() )
|
||||
i.res = user_iter->status == WINIX_ACCOUNT_READY;
|
||||
}
|
||||
|
||||
void user_tab_is_suspended(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.res = system->users[user_index].status == WINIX_ACCOUNT_SUSPENDED;
|
||||
if( user_tab_init() )
|
||||
i.res = user_iter->status == WINIX_ACCOUNT_SUSPENDED;
|
||||
}
|
||||
|
||||
void user_tab_is_blocked(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() )
|
||||
i.res = system->users[user_index].status == WINIX_ACCOUNT_BLOCKED;
|
||||
if( user_tab_init() )
|
||||
i.res = user_iter->status == WINIX_ACCOUNT_BLOCKED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void user_tab_is_current(Info & i)
|
||||
{
|
||||
if( user_index < system->users.Size() && cur->session->puser )
|
||||
i.res = (system->users[user_index].id == cur->session->puser->id);
|
||||
if( user_tab_init() && cur->session->puser )
|
||||
i.res = (user_iter->id == cur->session->puser->id);
|
||||
}
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
Reference in New Issue
Block a user