Merge branch 'develop' of https://github.com/tainacan/tainacan into develop
This commit is contained in:
commit
481ae36532
|
@ -16,7 +16,15 @@ class Admin {
|
|||
}
|
||||
|
||||
function add_admin_menu() {
|
||||
$page_suffix = add_menu_page( __('Tainacan', 'tainacan'), __('Tainacan', 'tainacan'), 'edit_posts', $this->menu_slug, array(&$this, 'admin_page'), plugin_dir_url(__FILE__) . 'images/tainacan_logo_symbol.svg' );
|
||||
$page_suffix = add_menu_page(
|
||||
__('Tainacan', 'tainacan'),
|
||||
__('Tainacan', 'tainacan'),
|
||||
'edit_posts',
|
||||
$this->menu_slug,
|
||||
array(&$this, 'admin_page'),
|
||||
plugin_dir_url(__FILE__) . 'images/tainacan_logo_symbol.svg'
|
||||
);
|
||||
|
||||
add_action( 'load-' . $page_suffix, array(&$this, 'load_admin_page'));
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="4mm"
|
||||
height="4mm"
|
||||
width="4.4mm"
|
||||
height="4.3mm"
|
||||
viewBox="0 0 17.510353 17.55353"
|
||||
version="1.1"
|
||||
id="svg1507"
|
||||
|
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
@ -174,8 +174,12 @@ class TAINACAN_REST_Collections_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_item_permissions_check($request){
|
||||
$collection = $this->collections_repository->fetch($request['collection_id']);
|
||||
|
||||
if($collection instanceof Entities\Collection) {
|
||||
return $collection->can_read();
|
||||
if(($collection instanceof Entities\Collection)) {
|
||||
if('edit' === $request['context'] && !$collection->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -306,7 +306,11 @@ class TAINACAN_REST_Filters_Controller extends TAINACAN_REST_Controller {
|
|||
* @return bool|WP_Error
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
return $this->filter_repository->can_read($this->filter);
|
||||
if('edit' === $request['context'] && !$this->filter_repository->can_read($this->filter)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -330,8 +334,12 @@ class TAINACAN_REST_Filters_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_item_permissions_check( $request ) {
|
||||
$filter = $this->filter_repository->fetch($request['filter_id']);
|
||||
|
||||
if ($filter instanceof Entities\Filter) {
|
||||
return $filter->can_read();
|
||||
if(($filter instanceof Entities\Filter)) {
|
||||
if('edit' === $request['context'] && !$filter->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -123,13 +123,14 @@ class TAINACAN_REST_Item_Metadata_Controller extends TAINACAN_REST_Controller {
|
|||
* @throws Exception
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
if(isset($request['item_id'])){
|
||||
$item = $this->item_repository->fetch($request['item_id']);
|
||||
$item = $this->item_repository->fetch($request['item_id']);
|
||||
|
||||
if($item instanceof Entities\Item) {
|
||||
return $item->can_read();
|
||||
if(($item instanceof Entities\Item)) {
|
||||
if('edit' === $request['context'] && !$item->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -79,6 +79,12 @@ class TAINACAN_REST_Items_Controller extends TAINACAN_REST_Controller {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $item_object
|
||||
* @param $item_array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function add_terms_to_item($item_object, $item_array){
|
||||
$item_terms = $item_object->get_terms();
|
||||
|
||||
|
@ -93,6 +99,12 @@ class TAINACAN_REST_Items_Controller extends TAINACAN_REST_Controller {
|
|||
return $item_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $item_object
|
||||
* @param $item_array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function add_metadata_to_item($item_object, $item_array){
|
||||
$item_metadata = $item_object->get_fields();
|
||||
|
||||
|
@ -193,18 +205,31 @@ class TAINACAN_REST_Items_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_item_permissions_check( $request ) {
|
||||
$item = $this->items_repository->fetch($request['item_id']);
|
||||
|
||||
if ($item instanceof Entities\Item) {
|
||||
return $item->can_read();
|
||||
if(($item instanceof Entities\Item)) {
|
||||
if('edit' === $request['context'] && !$item->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param WP_REST_Request $request
|
||||
*
|
||||
* @return bool|WP_Error
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
$collection = $this->collections_repository->fetch($request['collection_id']);
|
||||
|
||||
if ($collection instanceof Entities\Collection) {
|
||||
return $collection->can_read();
|
||||
if(($collection instanceof Entities\Collection)) {
|
||||
if('edit' === $request['context'] && !$collection->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -129,8 +129,12 @@ class TAINACAN_REST_Taxonomies_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_item_permissions_check( $request ) {
|
||||
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
|
||||
|
||||
if ($taxonomy instanceof Entities\Taxonomy) {
|
||||
return $taxonomy->can_read();
|
||||
if(($taxonomy instanceof Entities\Taxonomy)) {
|
||||
if('edit' === $request['context'] && !$taxonomy->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -222,7 +226,11 @@ class TAINACAN_REST_Taxonomies_Controller extends TAINACAN_REST_Controller {
|
|||
* @return bool|WP_Error
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
return $this->taxonomy_repository->can_read($this->taxonomy);
|
||||
if('edit' === $request['context'] && !$this->taxonomy_repository->can_read($this->taxonomy)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -295,8 +295,12 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_items_permissions_check( $request ) {
|
||||
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
|
||||
|
||||
if ($taxonomy instanceof Entities\Taxonomy) {
|
||||
return $taxonomy->can_read();
|
||||
if(($taxonomy instanceof Entities\Taxonomy)) {
|
||||
if('edit' === $request['context'] && !$taxonomy->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -326,8 +330,12 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_REST_Controller {
|
|||
public function get_item_permissions_check( $request ) {
|
||||
$taxonomy = $this->taxonomy_repository->fetch($request['taxonomy_id']);
|
||||
|
||||
if ($taxonomy instanceof Entities\Taxonomy) {
|
||||
return $taxonomy->can_read();
|
||||
if(($taxonomy instanceof Entities\Taxonomy)) {
|
||||
if('edit' === $request['context'] && !$taxonomy->can_read()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue