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


C++ Principal类代码示例

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


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

示例1: lookupByDBName

 Principal* PrincipalSet::lookup(const UserName& name) const {
     Principal* principal = lookupByDBName(name.getDB());
     if (principal && principal->getName() == name) {
         return principal;
     }
     return NULL;
 }
开发者ID:328500920,项目名称:mongo,代码行数:7,代码来源:principal_set.cpp

示例2: logoutDatabase

 void AuthorizationManager::logoutDatabase(const std::string& dbname) {
     Principal* principal = _authenticatedPrincipals.lookupByDBName(dbname);
     if (!principal)
         return;
     _acquiredPrivileges.revokePrivilegesFromPrincipal(principal->getName());
     _authenticatedPrincipals.removeByDBName(dbname);
 }
开发者ID:chenbk85,项目名称:mongo,代码行数:7,代码来源:authorization_manager.cpp

示例3: logoutDatabase

 void AuthorizationSession::logoutDatabase(const std::string& dbname) {
     Principal* principal = _authenticatedPrincipals.lookupByDBName(dbname);
     if (!principal)
         return;
     _acquiredPrivileges.revokePrivilegesFromUser(principal->getName());
     _authenticatedPrincipals.removeByDBName(dbname);
     _externalState->onLogoutDatabase(dbname);
 }
开发者ID:citsoft,项目名称:mongo,代码行数:8,代码来源:authorization_session.cpp

示例4: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Principal w;
    w.show();
    
    return a.exec();
}
开发者ID:estarguars113,项目名称:Daisyworld,代码行数:8,代码来源:main.cpp

示例5: main

int main( int argc, char ** argv )
{
  QApplication a( argc, argv );
  Principal w;
  w.show();
  a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
  return a.exec();
}
开发者ID:msanroman,项目名称:opengl-idi,代码行数:8,代码来源:main.cpp

示例6: Principal

void vagregapasajero::on_btnVolver_clicked()
{
    Principal *p = new Principal();
    p->colaEspera = this->colaEspera;
    p->colaTicket = this->colaTicket;
    p->colaTrenes = this->colaTrenes;
    p->show();
    this->close();
}
开发者ID:andmadrigal,项目名称:Progra1-Datos,代码行数:9,代码来源:vagregapasajero.cpp

示例7: Principal

    void AuthorizationManager::grantInternalAuthorization(const std::string& principalName) {
        Principal* principal = new Principal(PrincipalName(principalName, "local"));
        ActionSet actions;
        actions.addAllActions();

        addAuthorizedPrincipal(principal);
        fassert(16581, acquirePrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE, actions),
                                    principal->getName()).isOK());
    }
开发者ID:chenbk85,项目名称:mongo,代码行数:9,代码来源:authorization_manager.cpp

示例8: Principal

    void AuthorizationSession::grantInternalAuthorization(const UserName& userName) {
        Principal* principal = new Principal(userName);
        ActionSet actions;
        actions.addAllActions();

        addAuthorizedPrincipal(principal);
        fassert(16581, acquirePrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE, actions),
                                    principal->getName()).isOK());
    }
开发者ID:citsoft,项目名称:mongo,代码行数:9,代码来源:authorization_session.cpp

示例9: removeByDBName

 void PrincipalSet::removeByDBName(const StringData& dbname) {
     for (std::vector<Principal*>::iterator it = _principals.begin();
             it != _principals.end(); ++it) {
         Principal* current = *it;
         if (current->getName().getDB() == dbname) {
             delete current;
             _principals.erase(it);
             break;
         }
     }
 }
开发者ID:328500920,项目名称:mongo,代码行数:11,代码来源:principal_set.cpp

示例10: _authorizePrincipal

        void _authorizePrincipal(const std::string& principalName, bool readOnly) {
            Principal* principal = new Principal(PrincipalName(principalName, "local"));
            ActionSet actions = AuthorizationManager::getActionsForOldStyleUser(
                    "admin", readOnly);

            AuthorizationManager* authorizationManager = cc().getAuthorizationManager();
            authorizationManager->addAuthorizedPrincipal(principal);
            Status status = authorizationManager->acquirePrivilege(
                    Privilege(PrivilegeSet::WILDCARD_RESOURCE, actions), principal->getName());
            verify (status == Status::OK());
        }
开发者ID:7segments,项目名称:mongo,代码行数:11,代码来源:dbwebserver.cpp

示例11: add

 void PrincipalSet::add(Principal* principal) {
     for (std::vector<Principal*>::iterator it = _principals.begin();
             it != _principals.end(); ++it) {
         Principal* current = *it;
         if (current->getName().getDB() == principal->getName().getDB()) {
             // There can be only one principal per database.
             delete current;
             *it = principal;
             return;
         }
     }
     _principals.push_back(principal);
 }
开发者ID:328500920,项目名称:mongo,代码行数:13,代码来源:principal_set.cpp

示例12: Equipaje

void vagregaequipaje::on_btnAgregar_clicked()
{
    int peso = ui->txfPeso->text().toInt();
    bool isMano = ui->chxMano->checkState() == 1;

    Equipaje *nuevo = new Equipaje(peso, this->amo, isMano);
    this->amo->equipaje->insertar(nuevo);
    this->colaTicket->insertar(this->amo);

    Principal *p = new Principal();
    p->colaEspera = this->colaEspera;
    p->colaTicket = this->colaTicket;
    p->colaTrenes = this->colaTrenes;
    p->show();
    this->close();
}
开发者ID:andmadrigal,项目名称:Progra1-Datos,代码行数:16,代码来源:vagregaequipaje.cpp

示例13: getSSLManager

    bool CmdAuthenticate::authenticateX509(const string& dbname,
                                           BSONObj& cmdObj, 
                                           string& errmsg, 
                                           BSONObjBuilder& result) {
        if(dbname != "$external") {
            errmsg = "X.509 authentication must always use the $external database.";
            result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed);
            return false;
        }

        std::string user = cmdObj.getStringField("user");
        ClientBasic *client = ClientBasic::getCurrent();
        AuthorizationSession* authorizationSession = client->getAuthorizationSession();
        StringData subjectName = client->port()->getX509SubjectName();
        
        if (user != subjectName) {
            errmsg = "There is no x.509 client certificate matching the user.";
            result.append(saslCommandCodeFieldName, ErrorCodes::AuthenticationFailed);
            return false;
        }
        else {
            StringData srvSubjectName = getSSLManager()->getSubjectName();
            StringData srvClusterId = srvSubjectName.substr(0, srvSubjectName.find("/CN")+1);
            StringData peerClusterId = subjectName.substr(0, subjectName.find("/CN")+1);

            // Handle internal cluster member 
            if (srvClusterId == peerClusterId) {
                authorizationSession->grantInternalAuthorization(UserName(user, "$external"));
            }
            // Handle normal client authentication
            else {
                Principal* principal = new Principal(UserName(user, "$external"));
                principal->setImplicitPrivilegeAcquisition(true);
                authorizationSession->addAuthorizedPrincipal(principal);
            }
            result.append( "dbname" , dbname );
            result.append( "user" , user );
            return true;
        }
    }
开发者ID:MediaMath,项目名称:mongo,代码行数:40,代码来源:authentication_commands.cpp

示例14: _modifyPrivilegeForSpecialCases

    Status AuthorizationManager::_probeForPrivilege(const Privilege& privilege) {
        Privilege modifiedPrivilege = _modifyPrivilegeForSpecialCases(privilege);
        if (_acquiredPrivileges.hasPrivilege(modifiedPrivilege))
            return Status::OK();

        std::string dbname = nsToDatabase(modifiedPrivilege.getResource());
        for (PrincipalSet::iterator iter = _authenticatedPrincipals.begin(),
                 end = _authenticatedPrincipals.end();
             iter != end; ++iter) {

            Principal* principal = *iter;
            if (!principal->isImplicitPrivilegeAcquisitionEnabled())
                continue;
            if (principal->isDatabaseProbed(dbname))
                continue;
            _acquirePrivilegesForPrincipalFromDatabase(dbname, principal->getName());
            principal->markDatabaseAsProbed(dbname);
            if (_acquiredPrivileges.hasPrivilege(modifiedPrivilege))
                return Status::OK();
        }
        return Status(ErrorCodes::Unauthorized, "unauthorized", 0);
    }
开发者ID:chenbk85,项目名称:mongo,代码行数:22,代码来源:authorization_manager.cpp

示例15: afficher

void afficher(void *data)
{
    Principal *p = static_cast<Principal *>(data);
    p->affichage();
}
开发者ID:Neckara,项目名称:Patcher,代码行数:5,代码来源:Principal.cpp


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