本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
示例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);
}
示例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();
}
示例8: hasInternalAuthorization
bool AuthorizationManager::hasInternalAuthorization() {
ActionSet allActions;
allActions.addAllActions();
return _acquiredPrivileges.hasPrivilege(Privilege(PrivilegeSet::WILDCARD_RESOURCE,
allActions));
}
示例9: generateUniversalPrivileges
void RoleGraph::generateUniversalPrivileges(PrivilegeVector* privileges) {
ActionSet allActions;
allActions.addAllActions();
privileges->push_back(Privilege(ResourcePattern::forAnyResource(), allActions));
}
示例10: hasInternalAuthorization
bool AuthorizationSession::hasInternalAuthorization() {
ActionSet allActions;
allActions.addAllActions();
return _checkAuthForPrivilegeHelper(
Privilege(AuthorizationManager::WILDCARD_RESOURCE_NAME, allActions)).isOK();
}