Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -31,14 +31,31 @@ class _NodeController extends \IPS\Api\Controller
|
||||
protected function _list( $where = array() )
|
||||
{
|
||||
$class = $this->class;
|
||||
|
||||
if ( $this->member and in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
{
|
||||
$where[] = array( '(' . \IPS\Db::i()->findInSet( 'core_permission_index.perm_' . $class::$permissionMap['view'], $this->member->permissionArray() ) . ' OR ' . 'core_permission_index.perm_' . $class::$permissionMap['view'] . '=? )', '*' );
|
||||
if ( $class::$databaseColumnEnabledDisabled )
|
||||
{
|
||||
$where[] = array( $class::$databasePrefix . $class::$databaseColumnEnabledDisabled . '=1' );
|
||||
}
|
||||
}
|
||||
|
||||
$select = \IPS\Db::i()->select( '*', $class::$databaseTable, $where, $class::$databaseColumnOrder ? $class::$databasePrefix . $class::$databaseColumnOrder . " asc" : NULL, NULL, NULL, NULL, \IPS\Db::SELECT_SQL_CALC_FOUND_ROWS );
|
||||
if ( $this->member and in_array( 'IPS\Node\Permissions', class_implements( $class ) ) )
|
||||
{
|
||||
$select->join( 'core_permission_index', array( "core_permission_index.app=? AND core_permission_index.perm_type=? AND core_permission_index.perm_type_id=" . $class::$databaseTable . "." . $class::$databasePrefix . $class::$databaseColumnId, $class::$permApp, $class::$permType ) );
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return new \IPS\Api\PaginatedResponse(
|
||||
200,
|
||||
\IPS\Db::i()->select( '*', $class::$databaseTable, $where, $class::$databaseColumnOrder ? $class::$databaseColumnOrder . " asc" : NULL ),
|
||||
$select,
|
||||
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
|
||||
$class,
|
||||
\IPS\Db::i()->select( 'COUNT(*)', $class::$databaseTable, $where )->first()
|
||||
$select->count( TRUE ),
|
||||
$this->member,
|
||||
isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : NULL
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +68,14 @@ class _NodeController extends \IPS\Api\Controller
|
||||
protected function _view( $id )
|
||||
{
|
||||
$class = $this->class;
|
||||
return new \IPS\Api\Response( 200, $class::load( $id )->apiOutput() );
|
||||
|
||||
$node = $class::load( $id );
|
||||
if ( $this->member and !$node->can( 'view', $this->member ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
}
|
||||
|
||||
return new \IPS\Api\Response( 200, $node->apiOutput( $this->member ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +115,6 @@ class _NodeController extends \IPS\Api\Controller
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user