public function editRecordSharing(Request $request, $base_id, $record_id)
    {

        $record = new \record_adapter($this->app, \phrasea::sbasFromBas($this->app, $base_id), $record_id);
        $subdefName = (string)$request->request->get('name');
        $state = $request->request->get('state') == 'true' ? true : false;

        $acl = $this->getAclForUser();
        if (!$acl->has_right(\ACL::BAS_CHUPUB)
            || !$acl->has_right_on_base($record->getBaseId(), \ACL::CANMODIFRECORD)
            || !$acl->has_right_on_base($record->getBaseId(), \ACL::IMGTOOLS)
            || ('document' == $subdefName && !$acl->has_right_on_base($record->getBaseId(), \ACL::CANDWNLDHD))
            || ('document' != $subdefName && !$acl->has_access_to_subdef($record, $subdefName))
        ) {
            $this->app->abort(403);
        }

        $subdef = $record->get_subdef($subdefName);

        if (null === $permalink = $subdef->get_permalink()) {
            return $this->app->json(['success' => false, 'state' => false], 400);
        }

        try {
            $permalink->set_is_activated($state);
            $return = ['success' => true, 'state' => $permalink->get_is_activated()];
        } catch (\Exception $e) {
            $return = ['success' => false, 'state' => $permalink->get_is_activated()];
        }

        return $this->app->json($return);
    }