| | |
| | | { |
| | | $registry = JVB()->queue()->registry(); |
| | | $executor = new ContentTermExecutor(); |
| | | $taxonomies = Registrar::getFeatured('is_content', 'term'); |
| | | $taxonomies = Registrar::withFeature('is_content', 'term'); |
| | | |
| | | foreach($taxonomies as $taxonomy) { |
| | | $registry->register("{$taxonomy}_update", new TypeConfig( |
| | |
| | | */ |
| | | public function checkTermPermission(WP_REST_Request $request): bool |
| | | { |
| | | $userID = $request->get_param('user') ?? get_current_user_id(); |
| | | $userID = get_current_user_id(); |
| | | $termID = (int)$request->get_param('term_id'); |
| | | |
| | | if (!$this->checkUser($userID) || !term_exists($termID, jvbCheckBase($this->taxonomy))) { |
| | |
| | | |
| | | public function checkOwnerPermission(WP_REST_Request $request): bool |
| | | { |
| | | $userID = $request->get_param('user') ?? get_current_user_id(); |
| | | $userID = get_current_user_id(); |
| | | $termID = (int)$request->get_param('term_id'); |
| | | |
| | | if (!$this->checkUser($userID) || !term_exists($termID, jvbCheckBase($this->taxonomy))) { |
| | | if (!term_exists($termID, jvbCheckBase($this->taxonomy))) { |
| | | return false; |
| | | } |
| | | |
| | |
| | | public function updateSettings(WP_REST_Request $request): WP_REST_Response |
| | | { |
| | | $termID = (int)$request->get_param('term_id'); |
| | | $userID = $request->get_param('user'); |
| | | $userID = get_current_user_id(); |
| | | |
| | | $data = $request->get_params(); |
| | | unset($data['user'], $data['term_id']); |
| | |
| | | public function manageMember(WP_REST_Request $request): WP_REST_Response |
| | | { |
| | | $action = $request->get_param('action'); |
| | | $userID = $request->get_param('user'); |
| | | $userID = get_current_user_id(); |
| | | $termID = (int)$request->get_param('term_id'); |
| | | $targetUserID = (int)$request->get_param('target_user'); |
| | | |
| | | if (!$this->checkUser($targetUserID)) { |
| | | return $this->error('Invalid target user'); |
| | | } |
| | | |
| | | // Queue the operation |
| | | $op = JVB()->queue()->add( |
| | | "{$this->taxonomy}_member_{$action}", |
| | |
| | | public function handleRequest(WP_REST_Request $request): WP_REST_Response |
| | | { |
| | | $action = $request->get_param('action'); |
| | | $userID = $request->get_param('user'); |
| | | $userID = get_current_user_id(); |
| | | $termID = (int)$request->get_param('term_id'); |
| | | |
| | | return match($action) { |