本文整理汇总了C++中IdentityContainer类的典型用法代码示例。如果您正苦于以下问题:C++ IdentityContainer类的具体用法?C++ IdentityContainer怎么用?C++ IdentityContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IdentityContainer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PEG_METHOD_ENTER
//
// Invoke Method, used to modify user's password
//
void UserAuthProvider::invokeMethod(
const OperationContext & context,
const CIMObjectPath & ref,
const CIMName & methodName,
const Array<CIMParamValue> & inParams,
MethodResultResponseHandler & handler)
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::invokeMethod");
//
// get userName
//
String user;
try
{
IdentityContainer container = context.get(IdentityContainer::NAME);
user= container.getUserName();
}
catch (...)
{
user= String::EMPTY;
}
//
// verify user authorizations
//
if ( user != String::EMPTY || user != "" )
{
_verifyAuthorization(user);
}
#ifndef PEGASUS_NO_PASSWORDFILE
String userName;
String password;
String newPassword;
Array<CIMKeyBinding> kbArray;
// Begin processing the request
handler.processing();
// Check if the class name is PG_USER
if (!ref.getClassName().equal (CLASS_NAME_PG_USER))
{
handler.complete();
throw PEGASUS_CIM_EXCEPTION (CIM_ERR_NOT_SUPPORTED,
ref.getClassName().getString());
}
// Check if the method name is correct
if (!methodName.equal (METHOD_NAME_MODIFY_PASSWORD))
{
handler.complete();
PEG_METHOD_EXIT();
//l10n
//throw PEGASUS_CIM_EXCEPTION (
//CIM_ERR_FAILED,
//"Unsupported method name, " + methodName.getString());
MessageLoaderParms parms("ControlProviders.UserAuthProvider.UNSUPPORTED_METHOD_NAME",
"Unsupported method name, $0",
methodName.getString());
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_FAILED,parms);
}
// Check if all the input parameters are passed.
if ( inParams.size() < 2 )
{
handler.complete();
PEG_METHOD_EXIT();
//l10n
// throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER,
// "Input parameters are not valid.");
MessageLoaderParms parms("ControlProviders.UserAuthProvider.INPUT_PARAMETERS_NOT_VALID",
"Input parameters are not valid.");
throw PEGASUS_CIM_EXCEPTION_L( CIM_ERR_INVALID_PARAMETER, parms);
}
try
{
kbArray = ref.getKeyBindings();
if ( !kbArray.size() )
{
PEG_METHOD_EXIT();
//l10n
//throw PEGASUS_CIM_EXCEPTION( CIM_ERR_INVALID_PARAMETER,
// "Unable to find Key Property Username");
MessageLoaderParms parms("ControlProviders.UserAuthProvider.UNABLE_TO_FIND_KEY_PROPERTY_USERNAME",
"Unable to find Key Property Username");
throw PEGASUS_CIM_EXCEPTION_L( CIM_ERR_INVALID_PARAMETER,parms);
}
//
// Get the user name
//
if ( kbArray[0].getName() == PROPERTY_NAME_USERNAME )
{
userName = kbArray[0].getValue();
}
//.........这里部分代码省略.........
示例2: PEG_METHOD_ENTER
void NamespaceProvider::enumerateInstanceNames(
const OperationContext & context,
const CIMObjectPath & classReference,
ObjectPathResponseHandler & handler)
{
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
"NamespaceProvider::enumerateInstanceNames()");
// Verify that ClassName == __Namespace
if (!classReference.getClassName().equal(NAMESPACE_CLASSNAME))
{
PEG_METHOD_EXIT();
//l10n
//throw CIMNotSupportedException
//(classReference.getClassName().getString() +
//" not supported by Namespace Provider");
throw CIMNotSupportedException(MessageLoaderParms(
"ControlProviders.NamespaceProvider.NamespaceProvider.NOT_SUPPORTED_BY_NAMESPACEPROVIDER",
"$0 not supported by Namespace Provider",
classReference.getClassName().getString()));
}
//ATTN-DME-P3-20020522: ADD AUTHORIZATION CHECK TO __NAMESPACE PROVIDER
String userName;
try
{
IdentityContainer container = context.get(IdentityContainer::NAME);
userName = container.getUserName();
}
catch (...)
{
userName = String::EMPTY;
}
CIMNamespaceName parentNamespaceName = classReference.getNameSpace();
PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
"parentNamespaceName = " + parentNamespaceName.getString());
Array<CIMObjectPath> instanceRefs;
try
{
Array<CIMNamespaceName> namespaceNames =
_repository->enumerateNameSpaces();
Array<CIMKeyBinding> keyBindings;
// Build the instances. For now simply build the __Namespace instances
// Note that for the moment, the only property is name.
for (Uint32 i = 0; i < namespaceNames.size(); i++)
{
if (_isChild(parentNamespaceName, namespaceNames[i]))
{
keyBindings.clear();
keyBindings.append(CIMKeyBinding(NAMESPACE_PROPERTYNAME,
namespaceNames[i].getString().subString
(parentNamespaceName.getString().size()+1,
namespaceNames[i].getString().size()-
parentNamespaceName.getString().size()-1),
CIMKeyBinding::STRING));
CIMObjectPath ref(String::EMPTY, parentNamespaceName,
NAMESPACE_CLASSNAME, keyBindings);
instanceRefs.append(ref);
PEG_TRACE_STRING(TRC_CONTROLPROVIDER, Tracer::LEVEL4,
"childNamespace = " + namespaceNames[i].getString());
}
}
}
catch(const CIMException&)
{
PEG_METHOD_EXIT();
throw;
}
catch(const Exception&)
{
PEG_METHOD_EXIT();
throw;
}
handler.deliver(instanceRefs);
handler.complete();
PEG_METHOD_EXIT();
}
示例3: PEG_METHOD_ENTER
void ConfigSettingProvider::_modifyInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance& modifiedIns,
const CIMPropertyList& propertyList,
Uint32 timeoutSeconds)
{
PEG_METHOD_ENTER(TRC_CONFIG,
"ConfigSettingProvider::_modifyInstance()");
//
// get userName
//
String userName;
try
{
IdentityContainer container = context.get(IdentityContainer::NAME);
userName = container.getUserName();
}
catch (...)
{
userName = String::EMPTY;
}
//
// verify user authorizations
// z/OS: authorization check is done in CIMOpReqAuth already
//
#ifndef PEGASUS_OS_ZOS
if (userName != String::EMPTY)
{
_verifyAuthorization(userName);
}
#endif
// NOTE: Qualifiers are not processed by this provider, so the
// IncludeQualifiers flag is ignored.
//
// check if the class name requested is PG_ConfigSetting
//
if (!instanceReference.getClassName().equal (PG_CONFIG_SETTING))
{
PEG_METHOD_EXIT();
throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
instanceReference.getClassName().getString());
}
//
// validate key bindings
//
Array<CIMKeyBinding> kbArray = instanceReference.getKeyBindings();
if ( (kbArray.size() != 1) ||
(!kbArray[0].getName().equal (PROPERTY_NAME)))
{
PEG_METHOD_EXIT();
throw PEGASUS_CIM_EXCEPTION_L(
CIM_ERR_INVALID_PARAMETER,
MessageLoaderParms(
"ControlProviders.ConfigSettingProvider."
"ConfigSettingProvider."
"INVALID_INSTANCE_NAME",
"Invalid instance name"));
}
String configPropertyName = kbArray[0].getValue();
// Modification of the entire instance is not supported by this provider
if (propertyList.isNull())
{
PEG_METHOD_EXIT();
//l10n
//throw PEGASUS_CIM_EXCEPTION(CIM_ERR_NOT_SUPPORTED,
//"Modification of entire instance");
throw PEGASUS_CIM_EXCEPTION_L(CIM_ERR_NOT_SUPPORTED,
MessageLoaderParms(
"ControlProviders.ConfigSettingProvider."
"ConfigSettingProvider."
"MODIFICATION_OF_ENTIRE_INSTANCE",
"Modification of entire instance"));
}
Boolean currentValueModified = false;
Boolean plannedValueModified = false;
for (Uint32 i = 0; i < propertyList.size(); ++i)
{
CIMName propertyName = propertyList[i];
if (propertyName.equal (CURRENT_VALUE))
{
currentValueModified = true;
}
else if (propertyName.equal (PLANNED_VALUE))
{
plannedValueModified = true;
}
else
{
PEG_METHOD_EXIT();
//.........这里部分代码省略.........