diff --git a/core/config.cpp b/core/config.cpp index 96c60e8..44b9774 100644 --- a/core/config.cpp +++ b/core/config.cpp @@ -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; diff --git a/core/system.cpp b/core/system.cpp index cec3c16..db4a241 100644 --- a/core/system.cpp +++ b/core/system.cpp @@ -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 ) diff --git a/core/system.h b/core/system.h index 85601f6..476a837 100644 --- a/core/system.h +++ b/core/system.h @@ -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)