public static function bulk_deny_data_requests($requestids) {
        $warnings = [];
        $result = false;
        $params = external_api::validate_parameters(self::bulk_deny_data_requests_parameters(), [
            'requestids' => $requestids
        ]);
        $requestids = $params['requestids'];

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

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

            if ($requestexists) {
                api::deny_data_request($requestid);
            } else {
                $warnings[] = [
                    'item' => $requestid,
                    'warningcode' => 'errorrequestnotfound',
                    'message' => get_string('errorrequestnotfound', 'tool_dataprivacy')
                ];
            }
        }

        if (empty($warnings)) {
            $result = true;
            // Add notification in the session to be shown when the page is reloaded on the JS side.
            notification::success(get_string('requestsdenied', 'tool_dataprivacy'));
        }

        return [
            'result' => $result,
            'warnings' => $warnings
        ];
    }
public static function bulk_deny_data_requests($requestids) {
        $warnings = [];
        $result = false;
        $params = external_api::validate_parameters(self::bulk_deny_data_requests_parameters(), [
            'requestids' => $requestids
        ]);
        $requestids = $params['requestids'];

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

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

            if ($requestexists) {
                api::deny_data_request($requestid);
            } else {
                $warnings[] = [
                    'item' => $requestid,
                    'warningcode' => 'errorrequestnotfound',
                    'message' => get_string('errorrequestnotfound', 'tool_dataprivacy')
                ];
            }
        }

        if (empty($warnings)) {
            $result = true;
            // Add notification in the session to be shown when the page is reloaded on the JS side.
            notification::success(get_string('requestsdenied', 'tool_dataprivacy'));
        }

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

@since Moodle 3.5
@param array $requestids Array consisting of request ID's.
@return array
@throws coding_exception
@throws dml_exception
@throws invalid_parameter_exception
@throws restricted_context_exception
@throws moodle_exception
Bulk deny data requests .