public static function deny_data_request($requestid) {
        $warnings = [];
        $params = external_api::validate_parameters(self::deny_data_request_parameters(), [
            'requestid' => $requestid
        ]);
        $requestid = $params['requestid'];

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);
        require_capability('tool/dataprivacy:managedatarequests', $context);

        // Ensure the request exists.
        $requestexists = data_request::record_exists($requestid);

        $result = false;
        if ($requestexists) {
            $result = api::deny_data_request($requestid);

            // Add notification in the session to be shown when the page is reloaded on the JS side.
            notification::success(get_string('requestdenied', 'tool_dataprivacy'));
        } else {
            $warnings[] = [
                'item' => $requestid,
                'warningcode' => 'errorrequestnotfound',
                'message' => get_string('errorrequestnotfound', 'tool_dataprivacy')
            ];
        }

        return [
            'result' => $result,
            'warnings' => $warnings
        ];
    }
public static function deny_data_request($requestid) {
        $warnings = [];
        $params = external_api::validate_parameters(self::deny_data_request_parameters(), [
            'requestid' => $requestid
        ]);
        $requestid = $params['requestid'];

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);
        require_capability('tool/dataprivacy:managedatarequests', $context);

        // Ensure the request exists.
        $requestexists = data_request::record_exists($requestid);

        $result = false;
        if ($requestexists) {
            $result = api::deny_data_request($requestid);

            // Add notification in the session to be shown when the page is reloaded on the JS side.
            notification::success(get_string('requestdenied', 'tool_dataprivacy'));
        } else {
            $warnings[] = [
                'item' => $requestid,
                'warningcode' => 'errorrequestnotfound',
                'message' => get_string('errorrequestnotfound', 'tool_dataprivacy')
            ];
        }

        return [
            'result' => $result,
            'warnings' => $warnings
        ];
    }
public static function deny_data_request ( $ requestid ) { $ warnings = [ ] ; $ params = external_api :: validate_parameters ( self :: deny_data_request_parameters ( ) , [ 'requestid' => $ requestid ] ) ; $ requestid = $ params [ 'requestid' ] ; // Validate context. $ context = context_system :: instance ( ) ; self :: validate_context ( $ context ) ; require_capability ( 'tool/dataprivacy:managedatarequests' , $ context ) ; // Ensure the request exists. $ requestexists = data_request :: record_exists ( $ requestid ) ; $ result = false ; if ( $ requestexists ) { $ result = api :: deny_data_request ( $ requestid ) ; // Add notification in the session to be shown when the page is reloaded on the JS side. notification :: success ( get_string ( 'requestdenied' , 'tool_dataprivacy' ) ) ; } else { $ warnings [ ] = [ 'item' => $ requestid , 'warningcode' => 'errorrequestnotfound' , 'message' => get_string ( 'errorrequestnotfound' , 'tool_dataprivacy' ) ] ; } return [ 'result' => $ result , 'warnings' => $ warnings ] ; }
Deny a data request.

@since Moodle 3.5
@param int $requestid The request ID.
@return array
@throws coding_exception
@throws dml_exception
@throws invalid_parameter_exception
@throws restricted_context_exception
@throws moodle_exception
Deny a data request .