Merge branch 'sprint/app10' into sprint/170

This commit is contained in:
王怡栋
2021-11-19 08:41:00 +08:00
63 changed files with 2603 additions and 338 deletions
+45 -1
View File
@@ -486,6 +486,8 @@ class baseEntry
$type = $field[1];
$isArray = false;
if(!isset($object->$key)) continue;
$pos = strpos($type, ']');
if($pos !== FALSE)
{
@@ -519,6 +521,48 @@ class baseEntry
}
}
/**
* Filter fields.
*
* @param object $object
* @param array $filters
* @access public
* @return object
*/
public function filterFields($object, $allowable = '')
{
if(empty($allowable)) return $object;
if(is_string($allowable)) $allowable = explode(',', $allowable);
$filtered = new stdclass();
foreach($allowable as $field)
{
$field = trim($field);
if(empty($field)) continue;
if(!isset($object->$field)) continue;
$filtered->$field = $object->$field;
}
return $filtered;
}
/**
* Format user.
*
* @param string $account
* @param array $users
* @access public
* @return array
*/
public function formatUser($account, $users)
{
$user = array();
$user['account'] = $account;
$user['realname'] = zget($users, $account);
return $user;
}
/**
* 类型转换.
* Typecasting.
@@ -589,7 +633,7 @@ class baseEntry
{
$module = $this->app->getModuleName();
$method = $this->app->getMethodName();
if($module and $method and !commonModel::hasPriv($module, $method))
if($module and $method and !$this->loadModel('common')->isOpenMethod($module, $method) and !commonModel::hasPriv($module, $method))
{
$this->send(403, array('error' => 'Access not allowed'));
}