ImpersonationSessionGuard::ImpersonationSessionGuard(OperationContext* opCtx) : _opCtx(opCtx) { auto authSession = AuthorizationSession::get(_opCtx->getClient()); const auto impersonatedUsersAndRoles = rpc::getImpersonatedUserMetadata(opCtx); if (impersonatedUsersAndRoles) { uassert(ErrorCodes::Unauthorized, "Unauthorized use of impersonation metadata.", authSession->isAuthorizedForPrivilege( Privilege(ResourcePattern::forClusterResource(), ActionType::impersonate))); fassert(ErrorCodes::InternalError, !authSession->isImpersonating()); authSession->setImpersonatedUserData(impersonatedUsersAndRoles->getUsers(), impersonatedUsersAndRoles->getRoles()); _active = true; return; } }
CIMInstance ComputerSystem::buildInstance(const CIMName& className) { CIMInstance instance(className); CIMProperty p; //-- fill in properties for CIM_ComputerSystem if (getCaption(p)) instance.addProperty(p); if (getDescription(p)) instance.addProperty(p); if (getInstallDate(p)) instance.addProperty(p); if (getStatus(p)) instance.addProperty(p); if (getOperationalStatus(p)) instance.addProperty(p); if (getStatusDescriptions(p)) instance.addProperty(p); if (getElementName(p)) instance.addProperty(p); if (getCreationClassName(p)) instance.addProperty(p); if (getName(p)) instance.addProperty(p); if (getNameFormat(p)) instance.addProperty(p); if (getPrimaryOwnerName(p)) instance.addProperty(p); if (getPrimaryOwnerContact(p)) instance.addProperty(p); if (getRoles(p)) instance.addProperty(p); if (getOtherIdentifyingInfo(p)) instance.addProperty(p); if (getIdentifyingDescriptions(p)) instance.addProperty(p); if (getDedicated(p)) instance.addProperty(p); if (getResetCapability(p)) instance.addProperty(p); if (getPowerManagementCapabilities(p)) instance.addProperty(p); // Done if we are servicing CIM_ComputerSystem if (className.equal (CLASS_CIM_COMPUTER_SYSTEM)) return instance; // Fill in properties for CIM_UnitaryComputerSystem if (getInitialLoadInfo(p)) instance.addProperty(p); if (getLastLoadInfo(p)) instance.addProperty(p); if (getPowerManagementSupported(p)) instance.addProperty(p); if (getPowerState(p)) instance.addProperty(p); if (getWakeUpType(p)) instance.addProperty(p); // Done if we are servicing CIM_UnitaryComputerSystem if (className.equal (CLASS_CIM_UNITARY_COMPUTER_SYSTEM)) return instance; // Fill in properties for <Extended>_ComputerSystem if (className.equal (CLASS_EXTENDED_COMPUTER_SYSTEM)) { if(getPrimaryOwnerPager(p)) instance.addProperty(p); if(getSecondaryOwnerName(p)) instance.addProperty(p); if(getSecondaryOwnerContact(p)) instance.addProperty(p); if(getSecondaryOwnerPager(p)) instance.addProperty(p); if(getSerialNumber(p)) instance.addProperty(p); if(getIdentificationNumber(p)) instance.addProperty(p); } return instance; }
Boolean UNIX_ComputerSystem::getRoles(CIMProperty &p) const { p = CIMProperty(PROPERTY_ROLES, getRoles()); return true; }
Boolean UNIX_ApplicationSystem::getRoles(CIMProperty &p) const { p = CIMProperty(PROPERTY_ROLES, getRoles()); return true; }