Log a user in as admin. This is done without password checking. As the supplied m_Uname parameter is always a percent entity, this must be evaluated before use.
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hdsExec::Logon | (hzChain&,hzHttpEvent*,) |
Declared in file: hzDissemino.h
Defined in file : hdsExec.cpp
Function Logic:
Function body:
hzEcode hdsExec::Logon (hzChain& errorReport)hzHttpEvent* pE,
{
// Log a user in as admin. This is done without password checking. As the supplied m_Uname parameter is always a percent entity, this must be evaluated
// before use.
//
// Arguments: 1) error The error report chain
// 2) pE The HTTP event pointer
//
// Returns: E_NOTFOUND If there is no session or if the username is not established
// E_OK If the username is established
_hzfunc("hdsExec::Logon") ;
hdbObject uObj ; // User object
hzAtom atom ; // Atom for fetching values
hdsInfo* pInfo ; // Session
hdbObjRepos* pRepos ; // User class repos
// hdbMember* pMbr ; // Member (of subscriber class)
hzString tmpStr ; // Temp string
hzString m_Uname ; // Username resolved form percent entity
hzString unam ; // Username resolved form percent entity
uint32_t bAccess ; // Object id in the base user cache
uint32_t objId ; // Object id in the base user cache
hzEcode rc ; // Return code
m_Uname = m_pApp->m_ExecParams[m_FstParam] ;
pInfo = (hdsInfo*) pE->Session() ;
if (pInfo)
{ errorReport.Printf("Cannot logon user implied by %s as there is already a session in place\n", *m_Uname) ; return E_NOTFOUND ; }
if (m_Uname[0]!= CHAR_PERCENT)
unam = m_Uname ;
else
{
rc = m_pApp->PcEntConv(atom, m_Uname, pE) ;
if (rc != E_OK)
{
errorReport.Printf("Cannot logon user as %s does not evaluate\n", *m_Uname) ;
return E_NOTFOUND ;
}
unam = atom.Str() ;
}
errorReport.Printf("Trying username %s\n", *unam) ;
rc = m_pApp->m_ADP.m_pReposSubscriber->Exists(objId, m_pApp->m_ADP.m_pMbr_Subscriber_username, atom) ;
if (rc != E_OK)
{ errorReport.Printf("User %s not found\n", *unam) ; return E_NOTFOUND ; }
if (!objId)
{ errorReport.Printf("User %s not found case 2\n", *unam) ; return E_NOTFOUND ; }
// Log user in as a user of the appropriate class
pInfo->m_SubId = objId ;
m_pApp->m_SessCookie.Insert(pE->Cookie(), pInfo) ;
rc = m_pApp->m_ADP.m_pReposSubscriber->Fetch(uObj, objId) ;
if (rc != E_OK)
{
errorReport.Printf("Could not fetch subscriber user type with obj id %d\n", objId) ;
return rc ;
}
tmpStr = atom.Str() ;
bAccess = m_pApp->m_UserTypes[tmpStr] ;
pRepos = m_pApp->m_ADP.GetObjRepos(tmpStr) ;
if (!pRepos)
{ errorReport.Printf("User type [%s] not located\n", *tmpStr) ; return E_NOTFOUND ; }
pInfo->m_UserRepos = pRepos->DeltaId() ;
// Get user id from the subscriber object
uObj.GetValue(atom, m_pApp->m_ADP.m_pMbr_Subscriber_UID) ;
pInfo->m_UserId = atom.Int32() ;
if (rc == E_OK)
{
pInfo->m_Access &= ACCESS_ADMIN ;
pInfo->m_Access |= bAccess ;
}
return rc ;
}