当前位置: 首页>>代码示例>>C++>>正文


C++ ISecUser::getPasswordDaysRemaining方法代码示例

本文整理汇总了C++中ISecUser::getPasswordDaysRemaining方法的典型用法代码示例。如果您正苦于以下问题:C++ ISecUser::getPasswordDaysRemaining方法的具体用法?C++ ISecUser::getPasswordDaysRemaining怎么用?C++ ISecUser::getPasswordDaysRemaining使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISecUser的用法示例。


在下文中一共展示了ISecUser::getPasswordDaysRemaining方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onMyAccount

bool Cws_accountEx::onMyAccount(IEspContext &context, IEspMyAccountRequest &req, IEspMyAccountResponse &resp)
{
    try
    {
        ISecUser* user = context.queryUser();
        if(user != NULL)
        {
            CDateTime dt;
            user->getPasswordExpiration(dt);
            StringBuffer sb;
            if (dt.isNull())
                sb.append("Never");
            else
            {
                dt.getString(sb);
                sb.replace('T', (char)0);//chop off timestring
            }
            resp.setPasswordExpiration(sb.str());
            resp.setPasswordDaysRemaining(user->getPasswordDaysRemaining());
            resp.setFirstName(user->getFirstName());
            resp.setLastName(user->getLastName());
            resp.setUsername(user->getName());
        }
    }
    catch(IException* e)
    {
        FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR);
    }
    return true;
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:30,代码来源:ws_accountService.cpp

示例2: MakeStringException

const StringBuffer &CEspApplicationPort::getAppFrameHtml(time_t &modified, const char *inner, StringBuffer &html, IEspContext* ctx)
{
    if (!xslp)
       throw MakeStringException(0,"Error - CEspApplicationPort XSLT processor not initialized");

    bool embedded_url=(inner&&*inner);

    StringBuffer params;
    bool needRefresh = true;
    if (!getUrlParams(ctx->queryRequestParameters(), params))
    {
        if (params.length()==0)
            needRefresh = false;
        if (ctx->getClientVersion()>0)
        {
            params.appendf("%cver_=%g", params.length()?'&':'?', ctx->getClientVersion());
            needRefresh = true;
        }
    }

    if (needRefresh || embedded_url || !appFrameHtml.length())
    {
        int passwordDaysRemaining = scPasswordExpired;//-1 means dont display change password screen
#ifdef _USE_OPENLDAP
        ISecUser* user = ctx->queryUser();
        ISecManager* secmgr = ctx->querySecManager();
        if(user && secmgr)
        {
            passwordDaysRemaining = user->getPasswordDaysRemaining();//-1 if expired, -2 if never expires
            int passwordExpirationDays = (int)secmgr->getPasswordExpirationWarningDays();
            if (passwordDaysRemaining == scPasswordNeverExpires || passwordDaysRemaining > passwordExpirationDays)
                passwordDaysRemaining = scPasswordExpired;
        }
#endif
        StringBuffer xml;
        StringBuffer encoded_inner;
        if(inner && *inner)
            encodeXML(inner, encoded_inner);

        // replace & with &amps;
        params.replaceString("&","&");

        xml.appendf("<EspApplicationFrame title=\"%s\" navWidth=\"%d\" navResize=\"%d\" navScroll=\"%d\" inner=\"%s\" params=\"%s\" passwordDays=\"%d\"/>",
            getESPContainer()->getFrameTitle(), navWidth, navResize, navScroll, (inner&&*inner) ? encoded_inner.str() : "?main", params.str(), passwordDaysRemaining);

        Owned<IXslTransform> xform = xslp->createXslTransform();
        xform->loadXslFromFile(StringBuffer(getCFD()).append("./xslt/appframe.xsl").str());
        xform->setXmlSource(xml.str(), xml.length()+1);
        xform->transform( (needRefresh || embedded_url) ? html.clear() : appFrameHtml.clear());
    }

    if (!needRefresh && !embedded_url)
        html.clear().append(appFrameHtml.str());

    static time_t startup_time = time(NULL);
    modified = startup_time;
    return html;
}
开发者ID:GordonSmith,项目名称:HPCC-Platform,代码行数:58,代码来源:espprotocol.cpp


注:本文中的ISecUser::getPasswordDaysRemaining方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。