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


C++ ActionSet::addAllActions方法代码示例

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


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

示例1: addAuthorizedPrincipal

    void AuthorizationSession::addAuthorizedPrincipal(Principal* principal) {

        // Log out any already-logged-in user on the same database as "principal".
        logoutDatabase(principal->getName().getDB().toString());  // See SERVER-8144.

        _authenticatedPrincipals.add(principal);
        if (!principal->isImplicitPrivilegeAcquisitionEnabled())
            return;

        const std::string dbname = principal->getName().getDB().toString();
        if (dbname == StringData("local", StringData::LiteralTag()) &&
            principal->getName().getUser() == internalSecurity.user) {

            // Grant full access to internal user
            ActionSet allActions;
            allActions.addAllActions();
            acquirePrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE, allActions),
                             principal->getName());
            return;
        }

        _acquirePrivilegesForPrincipalFromDatabase(ADMIN_DBNAME, principal->getName());
        principal->markDatabaseAsProbed(ADMIN_DBNAME);
        _acquirePrivilegesForPrincipalFromDatabase(dbname, principal->getName());
        principal->markDatabaseAsProbed(dbname);
        _externalState->onAddAuthorizedPrincipal(principal);
    }
开发者ID:citsoft,项目名称:mongo,代码行数:27,代码来源:authorization_session.cpp

示例2: grantInternalAuthorization

    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

示例3: grantInternalAuthorization

    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

示例4: grantInternalAuthorization

 void AuthorizationManager::grantInternalAuthorization() {
     Principal* internalPrincipal = new Principal("__system");
     _authenticatedPrincipals.add(internalPrincipal);
     ActionSet allActions;
     allActions.addAllActions();
     AcquiredPrivilege privilege(Privilege("*", allActions), internalPrincipal);
     Status status = acquirePrivilege(privilege);
     verify (status == Status::OK());
 }
开发者ID:abarriga,项目名称:mongo,代码行数:9,代码来源:authorization_manager.cpp

示例5: OK

    MONGO_INITIALIZER_WITH_PREREQUISITES(SetupInternalSecurityUser, MONGO_NO_PREREQUISITES)(
            InitializerContext* context) {

        User* user = new User(UserName("__system", "local"));

        user->incrementRefCount(); // Pin this user so the ref count never drops below 1.
        ActionSet allActions;
        allActions.addAllActions();
        PrivilegeVector privileges;
        RoleGraph::generateUniversalPrivileges(&privileges);
        user->addPrivileges(privileges);
        internalSecurity.user = user;

        return Status::OK();
    }
开发者ID:AndrewCEmil,项目名称:mongo,代码行数:15,代码来源:authorization_manager.cpp

示例6: acquirePrivilegesFromPrivilegeDocument

 Status AuthorizationManager::acquirePrivilegesFromPrivilegeDocument(
         const std::string& dbname, const PrincipalName& principal, const BSONObj& privilegeDocument) {
     if (!_authenticatedPrincipals.lookup(principal)) {
         return Status(ErrorCodes::UserNotFound,
                       mongoutils::str::stream()
                               << "No authenticated principle found with name: "
                               << principal.getUser()
                               << " from database "
                               << principal.getDB(),
                       0);
     }
     if (principal.getUser() == internalSecurity.user) {
         // Grant full access to internal user
         ActionSet allActions;
         allActions.addAllActions();
         return acquirePrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE, allActions),
                                 principal);
     }
     return buildPrivilegeSet(dbname, principal, privilegeDocument, &_acquiredPrivileges);
 }
开发者ID:chenbk85,项目名称:mongo,代码行数:20,代码来源:authorization_manager.cpp

示例7: parseActionSetFromStringVector

 Status ActionSet::parseActionSetFromStringVector(const std::vector<std::string>& actionsVector,
                                                  ActionSet* result) {
     ActionSet actions;
     for (size_t i = 0; i < actionsVector.size(); i++) {
         ActionType action;
         Status status = ActionType::parseActionFromString(actionsVector[i], &action);
         if (status != Status::OK()) {
             ActionSet empty;
             *result = empty;
             return status;
         }
         if (action == ActionType::anyAction) {
             actions.addAllActions();
             break;
         }
         actions.addAction(action);
     }
     *result = actions;
     return Status::OK();
 }
开发者ID:7segments,项目名称:mongo-1,代码行数:20,代码来源:action_set.cpp

示例8: hasInternalAuthorization

 bool AuthorizationManager::hasInternalAuthorization() {
     ActionSet allActions;
     allActions.addAllActions();
     return _acquiredPrivileges.hasPrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE,
                                                       allActions));
 }
开发者ID:chenbk85,项目名称:mongo,代码行数:6,代码来源:authorization_manager.cpp

示例9: generateUniversalPrivileges

 void RoleGraph::generateUniversalPrivileges(PrivilegeVector* privileges) {
     ActionSet allActions;
     allActions.addAllActions();
     privileges->push_back(Privilege(ResourcePattern::forAnyResource(), allActions));
 }
开发者ID:rzfish,项目名称:mongo,代码行数:5,代码来源:role_graph_builtin_roles.cpp

示例10: hasInternalAuthorization

bool AuthorizationSession::hasInternalAuthorization() {
    ActionSet allActions;
    allActions.addAllActions();
    return _checkAuthForPrivilegeHelper(
               Privilege(AuthorizationManager::WILDCARD_RESOURCE_NAME, allActions)).isOK();
}
开发者ID:kusora,项目名称:mongo,代码行数:6,代码来源:authorization_session.cpp


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