Change ClientApplication to DomainId in permission table
This commit is contained in:
parent
b1af237e5a
commit
55d2685aca
14 changed files with 286 additions and 343 deletions
|
@ -28,9 +28,7 @@
|
|||
#ifndef <xsl:value-of select="@header_tag"/>
|
||||
#define <xsl:value-of select="@header_tag"/>
|
||||
#include "nel/misc/types_nl.h"
|
||||
#ifdef NL_COMP_VC8
|
||||
#include <memory>
|
||||
#endif
|
||||
#include <memory>
|
||||
#include "nel/misc/hierarchical_timer.h"
|
||||
#include "nel/misc/string_conversion.h"
|
||||
#include "nel/net/message.h"
|
||||
|
@ -45,7 +43,7 @@
|
|||
</xsl:if>
|
||||
<xsl:if test="//class/database">
|
||||
#include "nel/misc/string_common.h"
|
||||
#include "game_share/mysql_wrapper.h"
|
||||
#include "server_share/mysql_wrapper.h"
|
||||
</xsl:if>
|
||||
<xsl:if test="//class/message">
|
||||
#include "game_share/synchronised_message.h"
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// WARNING : this is a generated file, don't change it !
|
||||
|
@ -99,7 +84,7 @@ namespace RSMGR
|
|||
{
|
||||
nlwarning("ERROR : someone try to delete this object, but there are still ptr on it !");
|
||||
CNelUserPtr *ptr = _PtrList;
|
||||
do
|
||||
do
|
||||
{
|
||||
nlwarning(" Pointer created from '%s', line %u", ptr->_FileName, ptr->_LineNum);
|
||||
ptr = _PtrList->getNextPtr();
|
||||
|
@ -107,7 +92,7 @@ namespace RSMGR
|
|||
nlstop;
|
||||
}
|
||||
// remove object from cache map
|
||||
if (_UserId != NOPE::INVALID_OBJECT_ID
|
||||
if (_UserId != NOPE::INVALID_OBJECT_ID
|
||||
&& _ObjectState != NOPE::os_removed
|
||||
&& _ObjectState != NOPE::os_transient)
|
||||
{
|
||||
|
@ -318,7 +303,7 @@ namespace RSMGR
|
|||
}
|
||||
else if (cmd == NOPE::cc_instance_count)
|
||||
{
|
||||
return (uint32)_ObjectCache.size();
|
||||
return _ObjectCache.size();
|
||||
}
|
||||
|
||||
// default return value
|
||||
|
@ -336,7 +321,7 @@ namespace RSMGR
|
|||
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
nbReleased += (uint32)first->second.size();
|
||||
nbReleased += first->second.size();
|
||||
}
|
||||
|
||||
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
||||
|
@ -424,7 +409,7 @@ namespace RSMGR
|
|||
if(_ObjectState == NOPE::os_released && state == NOPE::os_removed)
|
||||
{
|
||||
// a release object gets removed (e.g. by remove by id)
|
||||
|
||||
|
||||
// delete the object
|
||||
delete this;
|
||||
|
||||
|
@ -578,7 +563,7 @@ namespace RSMGR
|
|||
{
|
||||
nlwarning("ERROR : someone try to delete this object, but there are still ptr on it !");
|
||||
CNelPermissionPtr *ptr = _PtrList;
|
||||
do
|
||||
do
|
||||
{
|
||||
nlwarning(" Pointer created from '%s', line %u", ptr->_FileName, ptr->_LineNum);
|
||||
ptr = _PtrList->getNextPtr();
|
||||
|
@ -586,16 +571,16 @@ namespace RSMGR
|
|||
nlstop;
|
||||
}
|
||||
// remove object from cache map
|
||||
if (_Prim != NOPE::INVALID_OBJECT_ID
|
||||
if (_PermissionId != NOPE::INVALID_OBJECT_ID
|
||||
&& _ObjectState != NOPE::os_removed
|
||||
&& _ObjectState != NOPE::os_transient)
|
||||
{
|
||||
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_Prim));
|
||||
nlverify(_ObjectCache.erase(_Prim) == 1);
|
||||
nldebug("NOPE: clearing CNelPermission @%p from cache with id %u", this, static_cast<uint32>(_PermissionId));
|
||||
nlverify(_ObjectCache.erase(_PermissionId) == 1);
|
||||
}
|
||||
else if (_ObjectState != NOPE::os_transient)
|
||||
{
|
||||
nlassert(_ObjectCache.find(_Prim) == _ObjectCache.end());
|
||||
nlassert(_ObjectCache.find(_PermissionId) == _ObjectCache.end());
|
||||
}
|
||||
if (_ObjectState == NOPE::os_released)
|
||||
{
|
||||
|
@ -626,18 +611,18 @@ namespace RSMGR
|
|||
{
|
||||
nlassert(getPersistentState() == NOPE::os_transient);
|
||||
|
||||
nlassert(_Prim != 0);
|
||||
nlassert(_PermissionId != 0);
|
||||
std::string qs;
|
||||
qs = "INSERT INTO permission (";
|
||||
|
||||
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
|
||||
qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
|
||||
qs += ") VALUES (";
|
||||
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "'"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
||||
qs += ", ";
|
||||
|
@ -670,17 +655,17 @@ namespace RSMGR
|
|||
std::string qs;
|
||||
qs = "UPDATE permission SET ";
|
||||
|
||||
qs += "prim = '"+MSW::escapeString(NLMISC::toString(_Prim), connection)+"'";
|
||||
qs += "PermissionId = '"+MSW::escapeString(NLMISC::toString(_PermissionId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "UId = '"+MSW::escapeString(NLMISC::toString(_UserId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "ClientApplication = '"+MSW::escapeString(NLMISC::toString(_DomainName), connection)+"'";
|
||||
qs += "DomainId = '"+MSW::escapeString(NLMISC::toString(_DomainId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "ShardId = '"+MSW::escapeString(NLMISC::toString(_ShardId), connection)+"'";
|
||||
qs += ", ";
|
||||
qs += "AccessPrivilege = '"+MSW::escapeString(NLMISC::toString(_AccessPriv), connection)+"'";
|
||||
|
||||
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
|
||||
qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
|
||||
|
||||
|
||||
if (connection.query(qs))
|
||||
|
@ -702,7 +687,7 @@ namespace RSMGR
|
|||
std::string qs;
|
||||
qs = "DELETE FROM permission ";
|
||||
|
||||
qs += " WHERE prim = '"+NLMISC::toString(_Prim)+"'";
|
||||
qs += " WHERE PermissionId = '"+NLMISC::toString(_PermissionId)+"'";
|
||||
|
||||
|
||||
if (connection.query(qs))
|
||||
|
@ -736,7 +721,7 @@ namespace RSMGR
|
|||
std::string qs;
|
||||
qs = "DELETE FROM permission ";
|
||||
|
||||
qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
|
||||
qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
|
||||
|
||||
|
||||
if (connection.query(qs))
|
||||
|
@ -796,7 +781,7 @@ namespace RSMGR
|
|||
}
|
||||
else if (cmd == NOPE::cc_instance_count)
|
||||
{
|
||||
return (uint32)_ObjectCache.size();
|
||||
return _ObjectCache.size();
|
||||
}
|
||||
|
||||
// default return value
|
||||
|
@ -814,7 +799,7 @@ namespace RSMGR
|
|||
TReleasedObject::iterator first(_ReleasedObject.begin()), last(_ReleasedObject.end());
|
||||
for (; first != last; ++first)
|
||||
{
|
||||
nbReleased += (uint32)first->second.size();
|
||||
nbReleased += first->second.size();
|
||||
}
|
||||
|
||||
nlinfo(" There are %u object instances in cache not referenced (waiting deletion or re-use))", nbReleased);
|
||||
|
@ -902,7 +887,7 @@ namespace RSMGR
|
|||
if(_ObjectState == NOPE::os_released && state == NOPE::os_removed)
|
||||
{
|
||||
// a release object gets removed (e.g. by remove by id)
|
||||
|
||||
|
||||
// delete the object
|
||||
delete this;
|
||||
|
||||
|
@ -912,12 +897,12 @@ namespace RSMGR
|
|||
|
||||
if (_ObjectState == NOPE::os_transient && state != NOPE::os_transient)
|
||||
{
|
||||
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim));
|
||||
nlverify(_ObjectCache.insert(std::make_pair(_Prim, this)).second);
|
||||
nldebug("NOPE: inserting CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
|
||||
nlverify(_ObjectCache.insert(std::make_pair(_PermissionId, this)).second);
|
||||
}
|
||||
|
||||
if (_ObjectState != NOPE::os_transient)
|
||||
nlassert(_ObjectCache.find(_Prim) != _ObjectCache.end());
|
||||
nlassert(_ObjectCache.find(_PermissionId) != _ObjectCache.end());
|
||||
|
||||
_ObjectState = state;
|
||||
|
||||
|
@ -928,8 +913,8 @@ namespace RSMGR
|
|||
}
|
||||
else if (state == NOPE::os_removed)
|
||||
{
|
||||
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_Prim));
|
||||
nlverify(_ObjectCache.erase(_Prim) == 1);
|
||||
nldebug("NOPE: erasing CNelPermission @%p in cache with id %u", this, static_cast<uint32>(_PermissionId));
|
||||
nlverify(_ObjectCache.erase(_PermissionId) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -945,11 +930,11 @@ namespace RSMGR
|
|||
std::string qs;
|
||||
qs = "SELECT ";
|
||||
|
||||
qs += "prim, UId, ClientApplication, ShardId, AccessPrivilege";
|
||||
qs += "PermissionId, UId, DomainId, ShardId, AccessPrivilege";
|
||||
|
||||
qs += " FROM permission";
|
||||
|
||||
qs += " WHERE prim = '"+NLMISC::toString(id)+"'";
|
||||
qs += " WHERE PermissionId = '"+NLMISC::toString(id)+"'";
|
||||
CNelPermissionPtr ret;
|
||||
if (!connection.query(qs))
|
||||
{
|
||||
|
@ -965,9 +950,9 @@ namespace RSMGR
|
|||
// ok, we have an object
|
||||
result->fetchRow();
|
||||
|
||||
result->getField(0, ret->_Prim);
|
||||
result->getField(0, ret->_PermissionId);
|
||||
result->getField(1, ret->_UserId);
|
||||
result->getField(2, ret->_DomainName);
|
||||
result->getField(2, ret->_DomainId);
|
||||
result->getField(3, ret->_ShardId);
|
||||
result->getField(4, ret->_AccessPriv);
|
||||
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// WARNING : this is a generated file, don't change it !
|
||||
|
@ -107,7 +92,7 @@ namespace RSMGR
|
|||
_PrevPtr(NULL)
|
||||
{
|
||||
_Ptr = objectPtr;
|
||||
|
||||
|
||||
linkPtr();
|
||||
}
|
||||
|
||||
|
@ -247,7 +232,7 @@ namespace RSMGR
|
|||
_PrevPtr(NULL)
|
||||
{
|
||||
_Ptr = objectPtr;
|
||||
|
||||
|
||||
linkPtr();
|
||||
}
|
||||
|
||||
|
@ -556,7 +541,7 @@ namespace RSMGR
|
|||
time_t _ReleaseDate;
|
||||
|
||||
/// The linked list of pointer on this object
|
||||
CNelUserPtr *_PtrList;
|
||||
CNelUserPtr *_PtrList;
|
||||
|
||||
// Try to load the specified object from the memory cache, return NULL if the object is not in the cache
|
||||
static CNelUser *loadFromCache(uint32 objectId, bool unrelease);
|
||||
|
@ -583,7 +568,7 @@ namespace RSMGR
|
|||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/** Return the object identifier (witch is unique)
|
||||
* You can only call this method on a persistent instance.
|
||||
* (because transient instance can have invalid id)
|
||||
|
@ -632,11 +617,11 @@ namespace RSMGR
|
|||
{
|
||||
protected:
|
||||
//
|
||||
uint32 _Prim;
|
||||
uint32 _PermissionId;
|
||||
//
|
||||
uint32 _UserId;
|
||||
//
|
||||
std::string _DomainName;
|
||||
uint32 _DomainId;
|
||||
//
|
||||
uint32 _ShardId;
|
||||
//
|
||||
|
@ -662,25 +647,21 @@ namespace RSMGR
|
|||
|
||||
}
|
||||
//
|
||||
const std::string &getDomainName() const
|
||||
uint32 getDomainId() const
|
||||
{
|
||||
return _DomainName;
|
||||
return _DomainId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void setDomainName(const std::string &value)
|
||||
void setDomainId(uint32 value)
|
||||
{
|
||||
|
||||
if (_DomainName != value)
|
||||
if (_DomainId != value)
|
||||
{
|
||||
if (getPersistentState() != NOPE::os_transient)
|
||||
setPersistentState(NOPE::os_dirty);
|
||||
|
||||
_DomainId = value;
|
||||
|
||||
_DomainName = value;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -729,9 +710,9 @@ namespace RSMGR
|
|||
|
||||
bool operator == (const CNelPermission &other) const
|
||||
{
|
||||
return _Prim == other._Prim
|
||||
return _PermissionId == other._PermissionId
|
||||
&& _UserId == other._UserId
|
||||
&& _DomainName == other._DomainName
|
||||
&& _DomainId == other._DomainId
|
||||
&& _ShardId == other._ShardId
|
||||
&& _AccessPriv == other._AccessPriv;
|
||||
}
|
||||
|
@ -742,7 +723,7 @@ namespace RSMGR
|
|||
CNelPermission()
|
||||
: _PtrList(NULL),
|
||||
_ObjectState(NOPE::os_transient),
|
||||
_Prim(NOPE::INVALID_OBJECT_ID)
|
||||
_PermissionId(NOPE::INVALID_OBJECT_ID)
|
||||
{
|
||||
|
||||
// register the cache for this class (if not already done)
|
||||
|
@ -825,7 +806,7 @@ namespace RSMGR
|
|||
time_t _ReleaseDate;
|
||||
|
||||
/// The linked list of pointer on this object
|
||||
CNelPermissionPtr *_PtrList;
|
||||
CNelPermissionPtr *_PtrList;
|
||||
|
||||
// Try to load the specified object from the memory cache, return NULL if the object is not in the cache
|
||||
static CNelPermission *loadFromCache(uint32 objectId, bool unrelease);
|
||||
|
@ -852,7 +833,7 @@ namespace RSMGR
|
|||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/** Return the object identifier (witch is unique)
|
||||
* You can only call this method on a persistent instance.
|
||||
* (because transient instance can have invalid id)
|
||||
|
@ -860,7 +841,7 @@ namespace RSMGR
|
|||
uint32 getObjectId() const
|
||||
{
|
||||
|
||||
return _Prim;
|
||||
return _PermissionId;
|
||||
}
|
||||
|
||||
/** Set the object unique ID.
|
||||
|
@ -874,8 +855,8 @@ namespace RSMGR
|
|||
// can only be set when in transient state
|
||||
nlassert(getPersistentState() == NOPE::os_transient);
|
||||
// can only be set once
|
||||
nlassert(_Prim == NOPE::INVALID_OBJECT_ID);
|
||||
_Prim = objectId;
|
||||
nlassert(_PermissionId == NOPE::INVALID_OBJECT_ID);
|
||||
_PermissionId = objectId;
|
||||
}
|
||||
|
||||
/** Return the current persistent state of the object.*/
|
||||
|
|
|
@ -17,16 +17,16 @@
|
|||
<property type="std::string" name="Privilege" db_col="Privilege" byref="true"/>
|
||||
<property type="std::string" name="ExtendedPrivilege" db_col="ExtendedPrivilege" byref="true"/>
|
||||
<property type="uint32" name="GMId" db_col="GMId"/>
|
||||
|
||||
|
||||
</class>
|
||||
|
||||
<class name="CNelPermission">
|
||||
<!-- activate database code generation -->
|
||||
<database table="permission"/>
|
||||
|
||||
<property type="uint32" name="Prim" db_col="prim" unique_id="true"/>
|
||||
<property type="uint32" name="PermissionId" db_col="PermissionId" unique_id="true"/>
|
||||
<property type="uint32" name="UserId" db_col="UId"/>
|
||||
<property type="std::string" name="DomainName" db_col="ClientApplication" byref="true"/>
|
||||
<property type="uint32" name="DomainId" db_col="DomainId"/>
|
||||
<property type="uint32" name="ShardId" db_col="ShardId"/>
|
||||
<property type="std::string" name="AccessPriv" db_col="AccessPrivilege" byref="true"/>
|
||||
|
||||
|
|
2
code/ryzom/server/src/shard_unifier_service/readme.txt
Normal file
2
code/ryzom/server/src/shard_unifier_service/readme.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
xsltproc -o nel_database_mapping.cpp --stringparam output cpp --stringparam filename nel_database_mapping ../../../common/src/game_share/generate_module_interface.xslt nel_database_mapping.xml
|
||||
xsltproc -o nel_database_mapping.h --stringparam output header --stringparam filename nel_database_mapping ../../../common/src/game_share/generate_module_interface.xslt nel_database_mapping.xml
|
File diff suppressed because it is too large
Load diff
|
@ -659,12 +659,12 @@ function createPermissions($values) {
|
|||
$sth = $dbh->prepare("SELECT UId FROM user WHERE Login='" . $values[0] . "';");
|
||||
$sth->execute();
|
||||
$result = $sth->fetchAll();
|
||||
foreach ($result as $UId) {
|
||||
/*foreach ($result as $UId) {
|
||||
$statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'r2', 'OPEN');");
|
||||
$statement->execute($values);
|
||||
$statement = $dbh->prepare("INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('" . $UId['UId'] . "', 'ryzom_open', 'OPEN');");
|
||||
$statement->execute($values);
|
||||
}
|
||||
}*///FIXME: GARBAGE
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
watchdog('ryzommanage', $e->getMessage(), NULL, WATCHDOG_ERROR);
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
* @author Daan Janssens, mentored by Matthew Lagoe
|
||||
*/
|
||||
class Sync{
|
||||
|
||||
|
||||
const OS_UNKNOWN = 1;
|
||||
const OS_WIN = 2;
|
||||
const OS_LINUX = 3;
|
||||
const OS_OSX = 4;
|
||||
|
||||
|
||||
/**
|
||||
* performs the actions listed in the querycache.
|
||||
* All entries in the querycache will be read and performed depending on their type.
|
||||
|
@ -19,13 +19,13 @@ class Sync{
|
|||
* These changes are: createPermissions, createUser, change_pass, change_mail
|
||||
*/
|
||||
static public function syncdata ($display = false) {
|
||||
|
||||
|
||||
if (function_exists('pcntl_fork')) {
|
||||
$pid = pcntl_fork();
|
||||
}
|
||||
global $AMS_TMPDIR;
|
||||
$pidfile = $AMS_TMPDIR.'/ams_cron_pid';
|
||||
|
||||
|
||||
if(isset($pid) and function_exists('pcntl_fork') ) {
|
||||
// We're the main process.
|
||||
} else {
|
||||
|
@ -43,9 +43,9 @@ class Sync{
|
|||
try {
|
||||
$dbl = new DBLayer("lib");
|
||||
$statement = $dbl->executeWithoutParams("SELECT * FROM ams_querycache");
|
||||
$rows = $statement->fetchAll();
|
||||
$rows = $statement->fetchAll();
|
||||
foreach ($rows as $record) {
|
||||
|
||||
|
||||
$db = new DBLayer($record['db']);
|
||||
switch($record['type']) {
|
||||
case 'createPermissions':
|
||||
|
@ -54,32 +54,32 @@ class Sync{
|
|||
//make connection with and put into shard db & delete from the lib
|
||||
$sth=$db->selectWithParameter("UId", "user", $values, "Login= :username" );
|
||||
$result = $sth->fetchAll();
|
||||
foreach ($result as $UId) {
|
||||
/*foreach ($result as $UId) {
|
||||
$ins_values = array('UId' => $UId['UId']);
|
||||
$ins_values['ClientApplication'] = "r2";
|
||||
$ins_values['AccessPrivilege'] = "OPEN";
|
||||
$db->insert("permission", $ins_values);
|
||||
$ins_values['ClientApplication'] = 'ryzom_open';
|
||||
$db->insert("permission",$ins_values);
|
||||
}
|
||||
}*/ // FIXME: GARBAGE
|
||||
break;
|
||||
case 'change_pass':
|
||||
$decode = json_decode($record['query']);
|
||||
$values = array('Password' => $decode[1]);
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$db->update("user", $values, "Login = '$decode[0]'");
|
||||
$db->update("user", $values, "Login = '$decode[0]'");
|
||||
break;
|
||||
case 'change_mail':
|
||||
$decode = json_decode($record['query']);
|
||||
$values = array('Email' => $decode[1]);
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$db->update("user", $values, "Login = '$decode[0]'");
|
||||
$db->update("user", $values, "Login = '$decode[0]'");
|
||||
break;
|
||||
case 'createUser':
|
||||
case 'createUser':
|
||||
$decode = json_decode($record['query']);
|
||||
$values = array('Login' => $decode[0], 'Password' => $decode[1], 'Email' => $decode[2] );
|
||||
//make connection with and put into shard db & delete from the lib
|
||||
$db->insert("user", $values);
|
||||
$db->insert("user", $values);
|
||||
break;
|
||||
}
|
||||
$dbl->delete("ams_querycache", array('SID' => $record['SID']), "SID=:SID");
|
||||
|
@ -99,11 +99,11 @@ class Sync{
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function check_pid($pid){
|
||||
|
||||
|
||||
$OS = Sync::getOS();
|
||||
|
||||
|
||||
if ($OS == 2) {
|
||||
$processes = explode( "\n", shell_exec( "tasklist.exe" ));
|
||||
foreach( $processes as $process )
|
||||
|
@ -117,7 +117,7 @@ class Sync{
|
|||
}
|
||||
} else {
|
||||
return file_exists( "/proc/$pid" );
|
||||
}
|
||||
}
|
||||
}
|
||||
static public function getOS() {
|
||||
switch (true) {
|
||||
|
|
|
@ -25,7 +25,7 @@ class Users{
|
|||
$cpass = "";
|
||||
$email = "";
|
||||
}
|
||||
|
||||
|
||||
if ( helpers :: check_if_game_client() or isset($FORCE_INGAME) ) {
|
||||
if ( isset( $_POST["TaC"] )) {
|
||||
$tac="success";
|
||||
|
@ -336,12 +336,12 @@ class Users{
|
|||
$dbs = new DBLayer("shard");
|
||||
$sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
|
||||
$result = $sth->fetchAll();
|
||||
foreach ($result as $UId) {
|
||||
/*foreach ($result as $UId) {
|
||||
$ins_values = array('UId' => $UId['UId'], 'clientApplication' => 'r2', 'AccessPrivilege' => 'OPEN');
|
||||
$dbs->insert("permission", $ins_values);
|
||||
$ins_values['clientApplication'] = 'ryzom_open';
|
||||
$dbs->insert("permission", $ins_values);
|
||||
}
|
||||
}*/ // FIXME: GARBAGE
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
//oh noooz, the shard is offline! Put it in query queue at ams_lib db!
|
||||
|
|
5
code/web/private_php/setup/sql/nel_00002.sql
Normal file
5
code/web/private_php/setup/sql/nel_00002.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE `permission` CHANGE `ClientApplication` `ClientApplication` CHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;
|
||||
ALTER TABLE `permission` DROP `prim` ;
|
||||
ALTER TABLE `permission` ADD `PermissionId` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;
|
||||
ALTER TABLE `permission` ADD `DomainId` INT NOT NULL DEFAULT '-1' AFTER `UId` ;
|
||||
ALTER TABLE `permission` DROP `ClientApplication` ;
|
|
@ -176,7 +176,6 @@
|
|||
// if we need to create missing ring info
|
||||
if ($AutoCreateRingInfo)
|
||||
{
|
||||
////////////// Temporary code alpha 0 only /////////////////////////////////////
|
||||
// check if the ring user exist, and create it if not
|
||||
$ringDb = mysqli_connect($DBHost, $RingDBUserName, $RingDBPassword) or die(errorMsgBlock(3004, 'Ring', $DBHost, $RingDBUserName));
|
||||
mysqli_select_db ($ringDb, $domainInfo['ring_db_name']) or die(errorMsgBlock(3005, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName));
|
||||
|
@ -190,17 +189,6 @@
|
|||
$query = "INSERT INTO ring_users SET user_id = '$id', user_name = '$login', user_type='ut_pioneer'";
|
||||
$result = mysqli_query ($ringDb, $query) or die(errorMsgBlock(3006, $query, 'Ring', $domainInfo['ring_db_name'], $DBHost, $RingDBUserName, mysqli_error($ringDb)));
|
||||
}
|
||||
|
||||
// // check that there is a character record (deprecated)
|
||||
// $query = "SELECT user_id FROM characters where user_id = '".$id."'";
|
||||
// $result = mysqli_query ($ringDb, $query) or die("Query ".$query." failed");
|
||||
// if (mysqli_num_rows($result) == 0)
|
||||
// {
|
||||
// // no characters record, build a default one
|
||||
// $charId = ($id * 16);
|
||||
// $query = "INSERT INTO characters SET char_id='".$charId."', char_name='".$_GET["login"]."_default', user_id = '".$id."'";
|
||||
// $result = mysqli_query ($ringDb, $query) or die("Query ".$query." failed");
|
||||
// }
|
||||
}
|
||||
|
||||
// // check domain status
|
||||
|
@ -324,7 +312,7 @@
|
|||
$extended = $row["ExtendedPrivilege"];
|
||||
|
||||
// add the default permission
|
||||
$query = "INSERT INTO permission (UId, ClientApplication, AccessPrivilege) VALUES ('$id', 'r2', '$accessPriv')";
|
||||
$query = "INSERT INTO permission (UId, DomainId, AccessPrivilege) VALUES ('$id', '$domainId', '$accessPriv')";
|
||||
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
|
||||
|
||||
$res = false;
|
||||
|
@ -338,40 +326,6 @@
|
|||
else
|
||||
{
|
||||
$reason = errorMsg(2001, $login, 'checkUserValidity');
|
||||
// Check if this is not an unconfirmed account
|
||||
/*
|
||||
$query = "SELECT GamePassword, Email, Language FROM signup_data WHERE login='$login'";
|
||||
$result = mysqli_query($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
|
||||
|
||||
if (mysqli_num_rows($result) == 0)
|
||||
{
|
||||
$reason = errorMsg(2001, $login, 'checkUserValidity');
|
||||
$res = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check password to avoid revealing email address to third-party
|
||||
$passwordMatchedRow = false;
|
||||
while ($row = mysqli_fetch_assoc($result))
|
||||
{
|
||||
$salt = substr($row['GamePassword'],0,2);
|
||||
if (($cp && $row['GamePassword'] == $password) || (!$cp && $row['GamePassword'] == crypt($password, $salt)))
|
||||
{
|
||||
$passwordMatchedRow = $row;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($passwordMatchedRow !== false)
|
||||
{
|
||||
if ($lang == 'unknown')
|
||||
setMsgLanguage($passwordMatchedRow['Language']);
|
||||
$reason = errorMsg(2002, $passwordMatchedRow['Email']);
|
||||
}
|
||||
else
|
||||
$reason = errorMsg(2004, 'db signup_data');
|
||||
$res = false;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -385,14 +339,14 @@
|
|||
// check if the user can use this application
|
||||
|
||||
$clientApplication = mysqli_real_escape_string($link, $clientApplication);
|
||||
$query = "SELECT * FROM permission WHERE UId='".$row["UId"]."' AND ClientApplication='$clientApplication'";
|
||||
$query = "SELECT * FROM permission WHERE UId='".$row["UId"]."' AND DomainId='$domainId'";
|
||||
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
|
||||
if (mysqli_num_rows ($result) == 0)
|
||||
{
|
||||
if ($AcceptUnknownUser)
|
||||
{
|
||||
// add default permission
|
||||
$query = "INSERT INTO permission (UId, ClientApplication, ShardId, AccessPrivilege) VALUES ('".$row["UId"]."', '$clientApplication', -1, '$domainStatus')";
|
||||
$query = "INSERT INTO permission (UId, DomainId, ShardId, AccessPrivilege) VALUES ('".$row["UId"]."', '$domainId', -1, '$domainStatus')";
|
||||
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
|
||||
|
||||
$reason = errorMsg(3010);
|
||||
|
@ -416,7 +370,7 @@
|
|||
if ($AcceptUnknownUser)
|
||||
{
|
||||
// set an additionnal privilege for this player
|
||||
$query = "UPDATE permission set AccessPrivilege='".$permission['AccessPrivilege'].",$accessPriv' WHERE prim=".$permission['prim'];
|
||||
$query = "UPDATE permission set AccessPrivilege='".$permission['AccessPrivilege'].",$accessPriv' WHERE PermissionId=".$permission['PermissionId'];
|
||||
$result = mysqli_query ($link, $query) or die (errorMsgBlock(3006, $query, 'main', $DBName, $DBHost, $DBUserName, mysqli_error($link)));
|
||||
|
||||
$reason = errorMsg(3012, $accessPriv);
|
||||
|
|
|
@ -57,6 +57,10 @@ function upgrade_service_databases($continue_r) {
|
|||
$continue = update_database_structure($continue, $con, "nel_00001.sql");
|
||||
$continue = set_db_version($continue, "shard", 1);
|
||||
}
|
||||
if ($continue && get_db_version("shard") < 2) {
|
||||
$continue = update_database_structure($continue, $con, "nel_00002.sql");
|
||||
$continue = set_db_version($continue, "shard", 2);
|
||||
}
|
||||
disconnect_database($con, "shard");
|
||||
|
||||
$con = null;
|
||||
|
|
|
@ -34,6 +34,13 @@ include('header.php');
|
|||
$continue = false;
|
||||
}
|
||||
|
||||
if ($continue) {
|
||||
if (!extension_loaded('mcrypt')) {
|
||||
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Validate basics
|
||||
if ($continue) {
|
||||
if (file_exists($_POST["privatePhpDirectory"])) {
|
||||
|
|
|
@ -28,6 +28,13 @@ if (!isset($NEL_SETUP_VERSION_CONFIGURED)) {
|
|||
|
||||
require_once('database.php');
|
||||
|
||||
if ($continue) {
|
||||
if (!extension_loaded('mcrypt')) {
|
||||
printalert("danger", "The mcrypt extension is missing. Please check your PHP configuration");
|
||||
$continue = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists("role_support")) {
|
||||
$continue = upgrade_support_databases($continue);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue