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


C++ UserServer::getAttribut方法代码示例

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


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

示例1: e

/**
 * \brief Function to connect the session
 * \param user The object which manipulates user information
 * \param host The object which manipulates client machine information
 * \param connectOpt The options data structure for connection
 * \return raises an exception on error
 */
int
SessionServer::connectSession(UserServer user, MachineClientServer host, UMS_Data::ConnectOptions* connectOpt) {
  std::string numSubstituteUserId;
  std::string numUserIdToconnect;

  //To record the connection identifier
  msession.setAuthenId(user.getData().getUserId());

  //if the user exist
  if (user.isAuthenticate()) {
    //if a user to substitute is defined
    if (connectOpt->getSubstituteUserId().size() != 0) {
      // if the user is admin
      if (user.isAdmin()) {
        numSubstituteUserId = user.getAttribut("where "
                                               "userid='"+mdatabaseVishnu->escapeData(connectOpt->getSubstituteUserId())+"'");
        //If the user to substitute exist
        if (! user.getNumUserId(connectOpt->getSubstituteUserId()).empty()) {
          numUserIdToconnect = numSubstituteUserId;
          msession.setUserId(connectOpt->getSubstituteUserId());
        } //End If the user to substitute exist
        else {
          UMSVishnuException e(ERRCODE_UNKNOWN_USERID);
          throw e;
        }
      } // END if the user is admin
      else {
        UMSVishnuException e(ERRCODE_NO_ADMIN);
        throw e;
      }
    } //End if a user to substitute is defined

    //if there is not a numSubstituteUserId
    if (numUserIdToconnect.size() == 0) {
      numUserIdToconnect = user.getAttribut("where userid='"+mdatabaseVishnu->escapeData(user.getData().getUserId())+"'"
                                            " and pwd='"+mdatabaseVishnu->escapeData(user.getData().getPassword())+"'");
      msession.setUserId(user.getData().getUserId());
    } //END if There is not a numSubstituteUserId

    generateSessionKey(user.getData().getUserId());
    generateSessionId(user.getData().getUserId());

    //To solve the connection mode
    solveConnectionMode(connectOpt, numUserIdToconnect);

    host.recordMachineClient();
    recordSessionServer(host.getId(), numUserIdToconnect);

  } // END if the user exist
  else {
    UMSVishnuException e(ERRCODE_UNKNOWN_USER);
    throw e;
  }
  return 0;
}//END: connectSession(UserServer, MachineClientServer, ConnectOptions*)
开发者ID:keoo,项目名称:vishnu,代码行数:62,代码来源:SessionServer.cpp

示例2:

/**
 * \brief Function to change the closure connection mode disconnet to timeout
 * \param user The object which manipulates user information
 * \return the new connection parameters are registered on the session data structure
 */
int
SessionServer::disconnetToTimeout(UserServer user) {

  OptionValueServer optionValueServer;
  std::string numuserId;

  //To change the session close policy on CLOSE_ON_TIMEOUT on the database
  mdatabaseVishnu->process("UPDATE vsession SET closepolicy=1"
                           " WHERE sessionkey='"+mdatabaseVishnu->escapeData(msession.getSessionKey())+"';");

  //To change the session close policy on CLOSE_ON_TIMEOUT on the msession object
  msession.setClosePolicy(1);

  numuserId = user.getAttribut("where userid='"+mdatabaseVishnu->escapeData(user.getData().getUserId())+"'"
                               " and pwd='"+mdatabaseVishnu->escapeData(user.getData().getPassword())+"'");

  //To get the timeout
  msession.setTimeout(optionValueServer.getOptionValueForUser(numuserId, TIMEOUT_OPT));
  mdatabaseVishnu->process("UPDATE vsession SET timeout="+convertToString(msession.getTimeout())+
                           " WHERE sessionkey='"+mdatabaseVishnu->escapeData(msession.getSessionKey())+"';");

  return 0;
}
开发者ID:keoo,项目名称:vishnu,代码行数:28,代码来源:SessionServer.cpp


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