diff --git a/include/znc/User.h b/include/znc/User.h index 63dea4bc..8a338755 100644 --- a/include/znc/User.h +++ b/include/znc/User.h @@ -150,6 +150,7 @@ class CUser { void SetTimestampFormat(const CString& s) { m_sTimestampFormat = s; } void SetTimestampAppend(bool b) { m_bAppendTimestamp = b; } void SetTimestampPrepend(bool b) { m_bPrependTimestamp = b; } + void SetAuthOnlyViaModule(bool b) { m_bAuthOnlyViaModule = b; } void SetTimezone(const CString& s) { m_sTimezone = s; } void SetJoinTries(unsigned int i) { m_uMaxJoinTries = i; } void SetMaxJoins(unsigned int i) { m_uMaxJoins = i; } @@ -185,6 +186,7 @@ class CUser { bool IsAdmin() const; bool DenySetBindHost() const; bool MultiClients() const; + bool AuthOnlyViaModule() const; const CString& GetStatusPrefix() const; const CString& GetDefaultChanModes() const; /** How long must an IRC connection be idle before ZNC sends a ping */ @@ -250,6 +252,7 @@ class CUser { bool m_bBeingDeleted; bool m_bAppendTimestamp; bool m_bPrependTimestamp; + bool m_bAuthOnlyViaModule; CUserTimer* m_pUserTimer; diff --git a/include/znc/znc.h b/include/znc/znc.h index 80720d3d..4619a2b9 100644 --- a/include/znc/znc.h +++ b/include/znc/znc.h @@ -123,6 +123,7 @@ class CZNC { } void SetProtectWebSessions(bool b) { m_bProtectWebSessions = b; } void SetHideVersion(bool b) { m_bHideVersion = b; } + void SetAuthOnlyViaModule(bool b) { m_bAuthOnlyViaModule = b; } void SetConnectDelay(unsigned int i); void SetSSLCiphers(const CString& sCiphers) { m_sSSLCiphers = sCiphers; } bool SetSSLProtocols(const CString& sProtocols); @@ -166,6 +167,7 @@ class CZNC { unsigned int GetConnectDelay() const { return m_uiConnectDelay; } bool GetProtectWebSessions() const { return m_bProtectWebSessions; } bool GetHideVersion() const { return m_bHideVersion; } + bool GetAuthOnlyViaModule() const { return m_bAuthOnlyViaModule; } CString GetSSLCiphers() const { return m_sSSLCiphers; } CString GetSSLProtocols() const { return m_sSSLProtocols; } Csock::EDisableProtocol GetDisabledSSLProtocols() const { @@ -305,6 +307,7 @@ class CZNC { TCacheMap m_sConnectThrottle; bool m_bProtectWebSessions; bool m_bHideVersion; + bool m_bAuthOnlyViaModule; CTranslationDomainRefHolder m_Translation; unsigned int m_uiConfigWriteDelay; CConfigWriteTimer* m_pConfigTimer; diff --git a/modules/controlpanel.cpp b/modules/controlpanel.cpp index 7eb26422..d2c67910 100644 --- a/modules/controlpanel.cpp +++ b/modules/controlpanel.cpp @@ -108,6 +108,7 @@ class CAdminMod : public CModule { {"Admin", boolean}, {"AppendTimestamp", boolean}, {"PrependTimestamp", boolean}, + {"AuthOnlyViaModule", boolean}, {"TimestampFormat", str}, {"DCCBindHost", str}, {"StatusPrefix", str}, @@ -273,6 +274,9 @@ class CAdminMod : public CModule { else if (sVar == "prependtimestamp") PutModule("PrependTimestamp = " + CString(pUser->GetTimestampPrepend())); + else if (sVar == "authonlyviamodule") + PutModule("AuthOnlyViaModule = " + + CString(pUser->AuthOnlyViaModule())); else if (sVar == "timestampformat") PutModule("TimestampFormat = " + pUser->GetTimestampFormat()); else if (sVar == "dccbindhost") @@ -442,6 +446,14 @@ class CAdminMod : public CModule { bool b = sValue.ToBool(); pUser->SetTimestampAppend(b); PutModule("AppendTimestamp = " + CString(b)); + } else if (sVar == "authonlyviamodule") { + if (GetUser()->IsAdmin()) { + bool b = sValue.ToBool(); + pUser->SetAuthOnlyViaModule(b); + PutModule("AuthOnlyViaModule = " + CString(b)); + } else { + PutModule(t_s("Access denied!")); + } } else if (sVar == "timestampformat") { pUser->SetTimestampFormat(sValue); PutModule("TimestampFormat = " + sValue); diff --git a/modules/data/webadmin/tmpl/add_edit_user.tmpl b/modules/data/webadmin/tmpl/add_edit_user.tmpl index b6c08c86..ce8460ff 100644 --- a/modules/data/webadmin/tmpl/add_edit_user.tmpl +++ b/modules/data/webadmin/tmpl/add_edit_user.tmpl @@ -40,6 +40,12 @@ "/> +
+
+ " + checked="checked" disabled="disabled" /> +