version 1.33, 2008/12/16 18:57:09
|
version 1.34, 2012/02/02 05:50:16
|
|
|
CIMName("DisableIndicationSubscription") | CIMName("DisableIndicationSubscription") |
}; | }; |
| |
|
static String _getAuthKey(const String &userName, const String &nameSpace) |
|
{ |
|
//Separator ":" is used to distinguish "a" +"bc" |
|
// and "ab"+"c" scenarios |
|
String key = nameSpace; |
|
key.append(Char16(':')); |
|
#ifdef PEGASUS_OS_TYPE_WINDOWS |
|
key.append(userName); |
|
key.toLower(); |
|
#else |
|
key.toLower(); |
|
key.append(userName); |
|
#endif |
|
|
|
return key; |
|
} |
| |
// | // |
// Constructor | // Constructor |
|
|
// | // |
// Add authorization to the table | // Add authorization to the table |
// | // |
if (!_authTable.insert(userName + nameSpace, auth)) |
if (!_authTable.insert(_getAuthKey(userName, nameSpace), auth)) |
{ | { |
throw AuthorizationCacheError(); | throw AuthorizationCacheError(); |
} | } |
|
|
PEG_METHOD_ENTER( | PEG_METHOD_ENTER( |
TRC_AUTHORIZATION, "AuthorizationHandler::setAuthorization()"); | TRC_AUTHORIZATION, "AuthorizationHandler::setAuthorization()"); |
| |
|
String key = _getAuthKey(userName, nameSpace.getString()); |
// | // |
// Remove auth if it already exists | // Remove auth if it already exists |
// | // |
_authTable.remove(userName + nameSpace.getString()); |
_authTable.remove(key); |
| |
// | // |
// Insert the specified authorization | // Insert the specified authorization |
// | // |
if (!_authTable.insert(userName + nameSpace.getString(), auth)) |
if (!_authTable.insert(key, auth)) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw AuthorizationCacheError(); | throw AuthorizationCacheError(); |
|
|
// | // |
// Remove the specified authorization | // Remove the specified authorization |
// | // |
if (!_authTable.remove(userName + nameSpace.getString())) |
if (!_authTable.remove(_getAuthKey(userName, nameSpace.getString()))) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw AuthorizationEntryNotFound(userName, nameSpace.getString()); | throw AuthorizationEntryNotFound(userName, nameSpace.getString()); |
|
|
// | // |
// Get authorization for the specified userName and nameSpace | // Get authorization for the specified userName and nameSpace |
// | // |
if (!_authTable.lookup(userName + nameSpace.getString(), auth)) |
if (!_authTable.lookup(_getAuthKey(userName, nameSpace.getString()), auth)) |
{ | { |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
throw AuthorizationEntryNotFound(userName, nameSpace.getString()); | throw AuthorizationEntryNotFound(userName, nameSpace.getString()); |