removing perm check

This commit is contained in:
Jacson Passold 2018-01-09 10:42:14 -02:00
parent b95161792b
commit 9d8eb97a9d
2 changed files with 41 additions and 49 deletions

View File

@ -169,15 +169,12 @@ class Collections extends Repository {
* @return mixed|Collection
*/
public function delete($args){
if($this->can_delete($args[0])) {
if(!empty($args[1]) && $args[1]['is_permanently'] === true){
return new Entities\Collection(wp_delete_post($args[0], $args[1]['is_permanently']));
}
return new Entities\Collection(wp_trash_post($args[0]));
}
throw new \Exception('This user can not delete the entity');
}
/**
* fetch collection based on ID or WP_Query args

View File

@ -65,9 +65,6 @@ abstract class Repository {
* @throws \Exception
*/
public function insert($obj) {
if( $this->can_edit($obj))
{
// validate
if ( in_array($obj->get_status(), apply_filters('tainacan-status-validation', ['publish','future','private'])) && !$obj->get_validated()){
throw new \Exception('Entities must be validated before you can save them');
@ -106,8 +103,6 @@ abstract class Repository {
// return a brand new object
return new $this->entities_type($obj->WP_Post);
}
throw new \Exception('User cannot edit this post_type: '.$obj->get_post_type());
}
/**
* Insert object property stored as postmeta into the database