changed: some refactoring in System: in IsMemberOfGroup method
changed: some log messages at startup (about non existing empty group for uploads directory) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1001 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
904f1e70f2
commit
af0e2a778d
|
@ -332,7 +332,10 @@ void Config::SetAdditionalVariables()
|
|||
if( locale_files.empty() )
|
||||
locale_files.push_back(L"en");
|
||||
|
||||
upload_group_int = GetGroupId(upload_group);
|
||||
if( !upload_group.empty() )
|
||||
upload_group_int = GetGroupId(upload_group);
|
||||
else
|
||||
upload_group_int = -1;
|
||||
|
||||
if( session_cookie_encode && session_keys_file.empty() )
|
||||
session_cookie_encode = false;
|
||||
|
|
|
@ -742,7 +742,7 @@ int System::NewDirPrivileges()
|
|||
|
||||
bool System::CanUseHtml(long user_id)
|
||||
{
|
||||
return IsMemberOfGroup(user_id, L"allow_html");
|
||||
return IsSuperUser(user_id) || IsMemberOfGroup(user_id, L"allow_html");
|
||||
}
|
||||
|
||||
|
||||
|
@ -755,11 +755,22 @@ bool System::CanUseBBCode(long user_id)
|
|||
|
||||
bool System::CanUseRaw(long user_id)
|
||||
{
|
||||
return IsMemberOfGroup(user_id, L"allow_raw");
|
||||
return IsSuperUser(user_id) || IsMemberOfGroup(user_id, L"allow_raw");
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool System::IsSuperUser(long user_id)
|
||||
{
|
||||
User * puser = users.GetUser(user_id);
|
||||
|
||||
if( !puser )
|
||||
return false;
|
||||
|
||||
return puser->super_user;
|
||||
}
|
||||
|
||||
|
||||
bool System::IsMemberOfGroup(long user_id, const wchar_t * group_name)
|
||||
{
|
||||
User * puser = users.GetUser(user_id);
|
||||
|
@ -767,9 +778,6 @@ bool System::IsMemberOfGroup(long user_id, const wchar_t * group_name)
|
|||
if( !puser )
|
||||
return false;
|
||||
|
||||
if( puser->super_user )
|
||||
return true; // !! ?? zakladamy ze administrator jest czlonkiem wszystkich grup? dlaczego?
|
||||
|
||||
long group = groups.GetGroupId(group_name);
|
||||
|
||||
if( group == -1 )
|
||||
|
|
|
@ -160,6 +160,7 @@ public:
|
|||
bool CanUseBBCode(long user_id);
|
||||
bool CanUseRaw(long user_id);
|
||||
|
||||
bool IsSuperUser(long user_id);
|
||||
bool IsMemberOfGroup(long user_id, const wchar_t * group_name);
|
||||
|
||||
// creating item.file_path and item.file_fs (the mountpoint where the item is located)
|
||||
|
|
Loading…
Reference in New Issue