int CLuaACLDefs::aclGroupRemoveObject ( lua_State* luaVM ) { // Verify the arguents if ( lua_type ( luaVM, 1 ) == LUA_TLIGHTUSERDATA && lua_type ( luaVM, 2 ) == LUA_TSTRING ) { // Grab the arguments CAccessControlListGroup* pGroup = lua_toaclgroup ( luaVM, 1 ); const char* szObject = lua_tostring ( luaVM, 2 ); // Verify the group and ACL if ( pGroup ) { // Figure out what type of object this is const char* szObjectAfterDot = szObject; CAccessControlListGroupObject::EObjectType eType; if ( StringBeginsWith ( szObject, "resource." ) ) { eType = CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE; szObjectAfterDot += 9; } else if ( StringBeginsWith ( szObject, "user." ) ) { eType = CAccessControlListGroupObject::OBJECT_TYPE_USER; szObjectAfterDot += 5; } else { lua_pushboolean ( luaVM, false ); return 1; } // Remove it if ( pGroup->RemoveObject ( szObjectAfterDot, eType ) ) { // Return success CLogger::LogPrintf ( "ACL: %s: Object '%s' removed from group '%s'\n", GetResourceName ( luaVM ), szObject, pGroup->GetGroupName () ); lua_pushboolean ( luaVM, true ); return 1; } } } else m_pScriptDebugging->LogBadType ( luaVM, "aclGroupRemoveObject" ); lua_pushboolean ( luaVM, false ); return 1; }
int CLuaACLDefs::aclGroupRemoveObject ( lua_State* luaVM ) { // bool aclGroupRemoveObject ( aclgroup theGroup, string theObjectString ) CAccessControlListGroup* pGroup; SString strObject; CScriptArgReader argStream ( luaVM ); argStream.ReadUserData ( pGroup ); argStream.ReadString ( strObject ); if ( !argStream.HasErrors () ) { // Figure out what type of object this is const char* szObjectAfterDot = strObject; CAccessControlListGroupObject::EObjectType eType; if ( StringBeginsWith ( strObject, "resource." ) ) { eType = CAccessControlListGroupObject::OBJECT_TYPE_RESOURCE; szObjectAfterDot += 9; } else if ( StringBeginsWith ( strObject, "user." ) ) { eType = CAccessControlListGroupObject::OBJECT_TYPE_USER; szObjectAfterDot += 5; } else { lua_pushboolean ( luaVM, false ); return 1; } // Remove it if ( pGroup->RemoveObject ( szObjectAfterDot, eType ) ) { // Return success CLogger::LogPrintf ( "ACL: %s: Object '%s' removed from group '%s'\n", GetResourceName ( luaVM ), strObject.c_str (), pGroup->GetGroupName () ); lua_pushboolean ( luaVM, true ); return 1; } } else m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () ); lua_pushboolean ( luaVM, false ); return 1; }