added ezc function: user_is_in_all_groups
changed: ezc function user_is_in_group (we can provide more than one group now) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@691 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
9507b0b1ba
commit
7f77b6e3ec
|
@ -87,7 +87,7 @@ void BaseThread::BaseUninit()
|
||||||
|
|
||||||
bool BaseThread::BaseSignalReceived()
|
bool BaseThread::BaseSignalReceived()
|
||||||
{
|
{
|
||||||
bool make_do;
|
bool make_do = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
typedef typename Table::iterator Iterator;
|
typedef typename Table::iterator Iterator;
|
||||||
typedef typename Table::size_type SizeType;
|
typedef typename Table::size_type SizeType;
|
||||||
|
|
||||||
typedef typename std::map<long, SizeType> TableId;
|
typedef typename std::map<long, SizeType> TableId;
|
||||||
typedef typename std::map<std::wstring, SizeType> TableName;
|
typedef typename std::map<std::wstring, SizeType> TableName;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -351,6 +351,7 @@ void Templates::CreateFunctions()
|
||||||
ezc_functions.Insert("user_logged", user_logged);
|
ezc_functions.Insert("user_logged", user_logged);
|
||||||
ezc_functions.Insert("user_super_user", user_super_user);
|
ezc_functions.Insert("user_super_user", user_super_user);
|
||||||
ezc_functions.Insert("user_is_in_group", user_is_in_group);
|
ezc_functions.Insert("user_is_in_group", user_is_in_group);
|
||||||
|
ezc_functions.Insert("user_is_in_all_groups", user_is_in_all_groups);
|
||||||
ezc_functions.Insert("user_can_use_html", user_can_use_html);
|
ezc_functions.Insert("user_can_use_html", user_can_use_html);
|
||||||
ezc_functions.Insert("user_can_use_bbcode", user_can_use_bbcode);
|
ezc_functions.Insert("user_can_use_bbcode", user_can_use_bbcode);
|
||||||
ezc_functions.Insert("user_can_use_raw", user_can_use_raw);
|
ezc_functions.Insert("user_can_use_raw", user_can_use_raw);
|
||||||
|
|
|
@ -283,6 +283,7 @@ namespace TemplatesFunctions
|
||||||
void user_logged(Info & i);
|
void user_logged(Info & i);
|
||||||
void user_super_user(Info & i);
|
void user_super_user(Info & i);
|
||||||
void user_is_in_group(Info & i);
|
void user_is_in_group(Info & i);
|
||||||
|
void user_is_in_all_groups(Info & i);
|
||||||
void user_can_use_html(Info & i);
|
void user_can_use_html(Info & i);
|
||||||
void user_can_use_bbcode(Info & i);
|
void user_can_use_bbcode(Info & i);
|
||||||
void user_can_use_raw(Info & i);
|
void user_can_use_raw(Info & i);
|
||||||
|
|
|
@ -34,17 +34,43 @@ void user_name(Info & i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// should be at least in one group
|
||||||
|
// !! moze lepsza nazwa?
|
||||||
void user_is_in_group(Info & i)
|
void user_is_in_group(Info & i)
|
||||||
{
|
{
|
||||||
long gid = system->groups.GetGroupId(i.par);
|
if( !request->session->puser || i.params.empty() )
|
||||||
|
|
||||||
if( !request->session->puser || gid == -1 )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
i.res = request->session->puser->IsMemberOf(gid);
|
for(size_t a=0 ; a<i.params.size() ; ++a)
|
||||||
|
{
|
||||||
|
long gid = system->groups.GetGroupId(i.params[a]);
|
||||||
|
|
||||||
|
if( gid!=-1 && request->session->puser->IsMemberOf(gid) )
|
||||||
|
{
|
||||||
|
i.res = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// !! moze lepsza nazwa?
|
||||||
|
void user_is_in_all_groups(Info & i)
|
||||||
|
{
|
||||||
|
if( !request->session->puser || i.params.empty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(size_t a=0 ; a<i.params.size() ; ++a)
|
||||||
|
{
|
||||||
|
long gid = system->groups.GetGroupId(i.params[a]);
|
||||||
|
|
||||||
|
if( gid==-1 || !request->session->puser->IsMemberOf(gid) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i.res = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void user_super_user(Info & i)
|
void user_super_user(Info & i)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue