本文整理汇总了C++中CAccessControlList::IterBegin方法的典型用法代码示例。如果您正苦于以下问题:C++ CAccessControlList::IterBegin方法的具体用法?C++ CAccessControlList::IterBegin怎么用?C++ CAccessControlList::IterBegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAccessControlList
的用法示例。
在下文中一共展示了CAccessControlList::IterBegin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAclRequests
///////////////////////////////////////////////////////////////
//
// CResource::GetAclRequests
//
// Get all acl requests for this resource
//
///////////////////////////////////////////////////////////////
void CResource::GetAclRequests ( std::vector < SAclRequest >& outResultList )
{
outResultList.clear ();
CAccessControlList* pAutoAcl = FindAutoAcl ();
if ( !pAutoAcl )
return;
// Get each right
for ( std::list < CAccessControlListRight* >::const_iterator iter = pAutoAcl->IterBegin () ; iter != pAutoAcl->IterEnd () ; ++iter )
{
CAccessControlListRight* pAclRight = *iter;
// Create SAclRequest from ACL
SAclRequest request ( CAclRightName ( pAclRight->GetRightType (), pAclRight->GetRightName () ) );
request.bAccess = StringToBool ( pAclRight->GetAttributeValue ( "access" ) );
request.bPending = StringToBool ( pAclRight->GetAttributeValue ( "pending" ) );
request.strWho = pAclRight->GetAttributeValue ( "who" );
request.strDate = pAclRight->GetAttributeValue ( "date" );
outResultList.push_back ( request );
}
}
示例2: aclListRights
int CLuaACLDefs::aclListRights ( lua_State* luaVM )
{
// table aclListRights ( acl theACL )
CAccessControlList* pACL; SString strType; bool bAll = true; CAccessControlListRight::ERightType eAllowed = (CAccessControlListRight::ERightType)-1;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pACL );
if ( argStream.NextIsString () )
{
argStream.ReadString ( strType );
bAll = false;
if ( strType == "command" )
eAllowed = CAccessControlListRight::RIGHT_TYPE_COMMAND;
else if ( strType == "function" )
eAllowed = CAccessControlListRight::RIGHT_TYPE_FUNCTION;
else if ( strType == "resource" )
eAllowed = CAccessControlListRight::RIGHT_TYPE_RESOURCE;
else if ( strType == "general" )
eAllowed = CAccessControlListRight::RIGHT_TYPE_GENERAL;
else
bAll = true;
}
if ( !argStream.HasErrors () )
{
// Create a table to return into
lua_newtable ( luaVM );
// Loop through ACL
char szRightName [128];
CAccessControlListRight::ERightType eType;
unsigned int uiIndex = 0;
list <CAccessControlListRight* > ::const_iterator iter = pACL->IterBegin ();
for ( ; iter != pACL->IterEnd (); ++iter )
{
// Type
eType = (*iter)->GetRightType ();
if ( !bAll && eType != eAllowed )
continue;
switch ( eType )
{
case CAccessControlListRight::RIGHT_TYPE_COMMAND:
strcpy ( szRightName, "command." );
break;
case CAccessControlListRight::RIGHT_TYPE_FUNCTION:
strcpy ( szRightName, "function." );
break;
case CAccessControlListRight::RIGHT_TYPE_RESOURCE:
strcpy ( szRightName, "resource." );
break;
case CAccessControlListRight::RIGHT_TYPE_GENERAL:
strcpy ( szRightName, "general." );
break;
default:
strcpy ( szRightName, "unknown." );
break;
}
// Append right name
strncat ( szRightName, (*iter)->GetRightName (), NUMELMS( szRightName ) - 1 );
// Push its name onto the table
lua_pushnumber ( luaVM, ++uiIndex );
lua_pushstring ( luaVM, szRightName );
lua_settable ( luaVM, -3 );
}
// Return the table
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}