?? rights.h
字號:
//---------------------------------------------------------------------------
#if !defined(RightsH) && !defined(StdRightsH)
#define RightsH
#ifndef __NOSYSTEM_HPP
# include <system.hpp>
#endif
#include <strings.hpp>
//#define __SSPI_H__
//#include "SecurityCpp.h"
//) && defined(SecurityDlgH)
#if defined(__DLL__) && defined(SECURITYLIB_DLL)
# define _DLLPORT __export
#else
# define _DLLPORT __import
#endif
#define ParamValLen 16
#define FullNameLen 50
namespace Security {
class ESecExcept /*: public exception */ {};
#define defexcept(co, anc) class co : public anc {}
defexcept(EDBProviderError, ESecExcept);
defexcept(EDBProviderDModError, EDBProviderError);
//defexcept(EDBProvDestructError, EDBProviderError);
defexcept(ESecAutoLoginFailed , ESecExcept);
#undef defexcept
typedef smallstr<ParamValLen> SecString;
typedef smallstr<FullNameLen> FullString;
typedef pswdsstr<ParamValLen> PswdString;
class TSecurity;
enum SecPasswdOption { poFalse, poTrue, poGroup }; // compatible with TCheckBoxState and bool
enum SecRightsMask { rmView=1, rmInsert=2, rmModify=4, rmDelete=8 };
enum SecAutoLoginType { altNone, altFixedPasswd, altSimplePasswd, altPasswdDlg, altCustom };
typedef char * __stdcall (*SecDecodeFnc)(const char *enc, char *dec);
typedef PswdString __stdcall (*SecEncodeFnc)(const char *co1,const char *co2); // laczy ze soba oba stringi w jeden zakodowany, nie musza miec 16 dlugosci
// obsolete
// encodes main passwords
// encodes db editor password
typedef PswdString __stdcall (*SecDBEditEncodeFnc)(const char *co, int paramkey, int userkey);
typedef bool __stdcall (*SecOnLogin) (TSecurity *co, void *);
class _DLLPORT TSecParamEd;
#pragma anon_struct on
class _DLLPORT TSecRights {
public:
private:
TSecurity *s;
public:
union {
mutable SecRightsMask Rights;
struct {
mutable bool View :1;
mutable bool Insert:1;
mutable bool Modify:1;
mutable bool Delete:1;
};
};
bool getRight(int mask) { return Rights & mask; }
public:
__fastcall TSecRights() : s(0) {}
__fastcall TSecRights(TSecurity *co);
__fastcall TSecRights(const TSecRights &co);
__fastcall TSecRights(const char *co);
__fastcall ~TSecRights();
bool __fastcall PrepareLogin();
bool __fastcall PrepareLoginWindow(char *fullname);
void __fastcall PostLogin();
static bool __fastcall PrepareLogin(TSecurity *s);
static bool __fastcall PrepareLoginWindow(TSecurity *s,char *fullname);
static void __fastcall PostLogin(TSecurity *s);
bool __fastcall AutoLogin();
bool __fastcall Login(SecAutoLoginType t);
bool __fastcall Login();
bool __fastcall Login(const char *name,const char *passwd);
bool __fastcall Login(const char *error,const char *wrongpswd, const char *t, const char *fullname);
static bool __fastcall AutoLogin(TSecurity *);
static bool __fastcall Login(TSecurity *,SecAutoLoginType t);
static bool __fastcall Login(TSecurity *);
static bool __fastcall Login(TSecurity *, const char *name,const char *passwd);
static bool __fastcall Login(TSecurity *, const char *error,const char *wrongpswd, const char *t, const char *fullname);
void __fastcall Logout();
void __fastcall ShowDlg(SecDBEditEncodeFnc fnc = 0, bool mdichild =false);
void __fastcall ShowSmpDlg(SecDBEditEncodeFnc fnc = 0, bool mdichild =false);
bool __fastcall Logged() const;
bool __fastcall Binded() const;
bool __fastcall Bind(const char *);
void __fastcall Bind(TSecurity *);
TSecRights &operator=(TSecurity *co) { Bind(co); return *this; }
TSecRights & __fastcall operator=(const TSecRights &);
static void __fastcall Logout(TSecurity *);
static void __fastcall ShowDlg(TSecurity *, SecDBEditEncodeFnc fnc = 0, bool mdichild =false);
static void __fastcall ShowSmpDlg(TSecurity *, SecDBEditEncodeFnc fnc = 0, bool mdichild =false);
static bool __fastcall Logged(TSecurity *);
/**********************************/
int __fastcall GetRight(const char *name) const;
int __fastcall GetRight(int FormID) const;
SecString __fastcall GetParam(const char *name) const;
SecString __fastcall GetParam(int ParamID) const;
PswdString __fastcall GetPswdParam(const char *name) const;
PswdString __fastcall GetPswdParam(int ParamID) const;
bool __fastcall GetBoolParam(const char *name) const;
bool __fastcall GetBoolParam(int ParamID) const;
int __fastcall GetIntParam(const char *name) const;
int __fastcall GetIntParam(int ParamID) const;
SecString __fastcall GetDBParam(const char *name) const;
bool __fastcall GetBoolDBParam(const char *name) const;
PswdString __fastcall GetPswdDBParam(const char *name) const;
operator SecRightsMask&() const { return Rights; }
static TSecurity * __fastcall AddSecurity(const char *secname, const char *alias, const char *dbprov, const char *dbend, void * data, const char *secuser, const char *secencpswd, SecEncodeFnc f=0, bool autolog = true);
static TSecurity * __fastcall AddSecurity(const char *secname, const char *alias, const char *dbprov, const char *dbend, void * data, const char *secuser, const char *secencpswd,const char *fullname, SecEncodeFnc f=0, bool autolog = true);
static TSecurity * __fastcall AddSecurity(const char *secname, const char *alias, const char *dbprov, const char *dbend, void * data, const char *secuser, const char *secencpswd,const char *user, const char *pswd, SecEncodeFnc f=0, bool autolog = true);
static TSecurity * __fastcall AddSecurity(const char *secname, const char *alias, const char *dbprov, const char *dbend, void * data, const char *secuser, const char *secencpswd,const char *error, const char *wrongpswd, const char *t, const char *fullname, SecEncodeFnc f=0, bool autolog = true);
static TSecurity * __fastcall AddSecurity(const char *secname, const char *alias, const char *dbprov, const char *dbend, void * data, const char *secuser, const char *secencpswd, SecOnLogin onlogin, void *autodata, bool autolog = true);
static TSecurity * __fastcall DeleteSecurity(const char *secname);
static TSecurity * __fastcall FindSecurity(const char *name);
//security zaalokuje strlen(enc+1) bajt體 i poda ci je w dec. zwr骳 dec
static void __fastcall SetPasswdDecoder (SecDecodeFnc co );
SecString __fastcall YesString() const;
SecString __fastcall NoString() const;
// void __fastcall SetPass(char *co);
static void __fastcall SetAppHWnd(HWND app);
static void __fastcall SetMDIClient(HWND app);
static HWND __fastcall GetMDIClient();
public:
SecString __fastcall UserName() const;
FullString __fastcall UserFullName() const;
PswdString __fastcall UserPasswd() const;
int __fastcall UserID() const;
int __fastcall GroupID() const;
SecPasswdOption __fastcall UserAllowChangePswd() const;
SecPasswdOption __fastcall UserAllowNullPasswd() const;
SecPasswdOption __fastcall UserNoChPswdAtLogin() const;
SecPasswdOption __fastcall UserAccountEnabled() const;
SecPasswdOption __fastcall UserPasswdControl() const;
bool __fastcall GroupAllowChangePswd() const;
bool __fastcall GroupAllowNullPasswd() const;
bool __fastcall GroupNoChPswdAtLogin() const;
bool __fastcall GroupAccountEnabled () const;
bool __fastcall GroupPasswdControl () const;
bool __fastcall GroupForceAddMod() const;
bool __fastcall GetAllowChangePswd() const;
bool __fastcall GetAllowNullPasswd() const;
bool __fastcall GetNoChPswdAtLogin() const;
bool __fastcall GetAccountEnabled() const;
bool __fastcall GetPasswdControl() const;
TSecParamEd *__fastcall ModifyStart(const PswdString &key);
void __fastcall ModifyEnd(TSecParamEd *co);
};
} // namespace Security
using namespace Security;
//---------------------------------------------------------------------------
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -