当前位置: 首页>>代码示例>>C++>>正文


C++ CAccessControlList::RemoveRight方法代码示例

本文整理汇总了C++中CAccessControlList::RemoveRight方法的典型用法代码示例。如果您正苦于以下问题:C++ CAccessControlList::RemoveRight方法的具体用法?C++ CAccessControlList::RemoveRight怎么用?C++ CAccessControlList::RemoveRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAccessControlList的用法示例。


在下文中一共展示了CAccessControlList::RemoveRight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: aclRemoveRight

int CLuaACLDefs::aclRemoveRight ( lua_State* luaVM )
{
//  bool aclRemoveRight ( acl theAcl, string rightName )
    CAccessControlList* pACL; SString strRight;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pACL );
    argStream.ReadString ( strRight );
    
    if ( !argStream.HasErrors () )
    {
        // Grab the type from the name passed
        const char* szRightAftedDot = strRight;
        CAccessControlListRight::ERightType eType;
        if ( StringBeginsWith ( strRight, "command." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_COMMAND;
            szRightAftedDot += 8;
        }
        else if ( StringBeginsWith ( strRight, "function." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_FUNCTION;
            szRightAftedDot += 9;
        }
        else if ( StringBeginsWith ( strRight, "resource." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_RESOURCE;
            szRightAftedDot += 9;
        }
        else if ( StringBeginsWith ( strRight, "general." ) )
        {
            eType = CAccessControlListRight::RIGHT_TYPE_GENERAL;
            szRightAftedDot += 8;
        }
        else
        {
            lua_pushboolean ( luaVM, false );
            return 1;
        }
        // Try removing the right
        CAccessControlListRight* pACLRight = pACL->GetRight ( szRightAftedDot, eType );
        bool bAccess = pACLRight && pACLRight->GetRightAccess ();
        if ( pACL->RemoveRight ( szRightAftedDot, eType ) )
        {
            CLogger::LogPrintf ( "ACL: %s: Right '%s' %s removed from ACL '%s'\n", GetResourceName ( luaVM ), strRight.c_str (), bAccess ? "ALLOW" : "DISALLOW", pACL->GetName () );
            // Return success
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}
开发者ID:superherohay4,项目名称:mtasa-blue,代码行数:56,代码来源:CLuaACLDefs.cpp


注:本文中的CAccessControlList::RemoveRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。