更新安全认证

This commit is contained in:
wlx 2014-07-16 08:24:16 +00:00
parent bcc7146f81
commit 8342437350
1 changed files with 8 additions and 5 deletions

View File

@ -2701,6 +2701,7 @@ class Admin_DataController extends Zend_Controller_Action
$uuid = $this->_getParam('uuid'); $uuid = $this->_getParam('uuid');
$this->view->uuid = $uuid; $this->view->uuid = $uuid;
$submd=$this->view->config->sub->metadata;
if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid)) if(empty($uuid) || !preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
{ {
@ -2710,10 +2711,10 @@ class Admin_DataController extends Zend_Controller_Action
$this->jsonexit($data); $this->jsonexit($data);
return true; return true;
} }
//安全检查: uuid必须是当前用户且为新建数据 //安全检查: uuid必须是当前子平台数据
$sql="select * from geonetworkmetadata where uuid=? and uuid not in (select uuid from metadata) and owner=?"; $sql="select * from $submd where uuid=?";
$sth=$this->db->prepare($sql); $sth=$this->db->prepare($sql);
$sth->execute(array($uuid,$u_id)); $sth->execute(array($uuid));
$row=$sth->fetch(); $row=$sth->fetch();
if (empty($row)) if (empty($row))
{ {
@ -2724,8 +2725,10 @@ class Admin_DataController extends Zend_Controller_Action
return true; return true;
} }
//ftp 用户名 //ftp admin 用户名
$uname = 'sjy'.$u_id.'upload'; $auth = Zend_Auth::getInstance();
$uid=$auth->->getIdentity()->id;
$uname = $submd.'admin'.$uid;
//ftp路径 //ftp路径
$homedir = "/data/upload/".$uuid."/"; $homedir = "/data/upload/".$uuid."/";