Beispiel #1
0
int CLuaACLDefs::aclGroupRemoveACL ( lua_State* luaVM )
{
    // Verify the arguents
    if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA &&
         lua_type ( luaVM, 2 ) == LUA_TLIGHTUSERDATA )
    {
        // Grab the arguments
        CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 );
        CAccessControlList* pACL = lua_toacl ( luaVM, 2 );

        // Verify the group and ACL
        if ( pGroup && pACL )
        {
            // Add the ACL to the group
            pGroup->RemoveACL ( pACL );
            CLogger::LogPrintf ( "ACL: %s: ACL '%s' removed from group '%s'\n", GetResourceName ( luaVM ), pACL->GetName (), pGroup->GetGroupName () );

            // Return success
            lua_pushboolean ( luaVM, true );
            return 1;
        }
    }
    else
        m_pScriptDebugging->LogBadType ( luaVM, "aclGroupRemoveACL" );

    lua_pushboolean ( luaVM, false );
    return 1;
}
int CLuaACLDefs::aclGroupRemoveACL ( lua_State* luaVM )
{
//  bool aclGroupRemoveACL ( aclgroup theGroup, acl theACL )
    CAccessControlListGroup* pGroup; CAccessControlList* pACL;
    
    CScriptArgReader argStream ( luaVM );
    argStream.ReadUserData ( pGroup );
    argStream.ReadUserData ( pACL );
    
    if ( !argStream.HasErrors () )
    {
        // Add the ACL to the group
        pGroup->RemoveACL ( pACL );
        CLogger::LogPrintf ( "ACL: %s: ACL '%s' removed from group '%s'\n", GetResourceName ( luaVM ), pACL->GetName (), pGroup->GetGroupName () );
        // Return success
        lua_pushboolean ( luaVM, true );
        return 1;
    }
    else
        m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );

    lua_pushboolean ( luaVM, false );
    return 1;
}