Commit 335fcfbb authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1957712: Adding peerassessment to ES5 artefactmap



And getting it to idex correct access rules

Also fixing issue with ES5 and indexing blocks

Change-Id: Id157ebad05c8cfe85eac88676fc2ccf2b777dfbd
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 27183389
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ membership|Resume|Text
mobilenumber|Profile|Text
occupation|Profile|Text
officialwebsite|Profile|Text
peerassessment|Peerassessment|Text
personalgoal|Resume|Text
personalinformation|Resume|Text
personalskill|Resume|Text
+10 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ class ElasticsearchType_artefact extends ElasticsearchType {

        return $record;
    }

    public static function getRecordDataById($type, $id) {
        global $USER;

@@ -445,8 +446,17 @@ class ElasticsearchType_artefact extends ElasticsearchType {
                WHERE   art.id = ?
                AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
                AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
                UNION
                SELECT vac.view AS view_id, vac.accesstype, vac.group, vac.role, vac.usr, vac.institution
                FROM {artefact} art
                INNER JOIN {artefact_peer_assessment} aps ON aps.assessment = art.id
                INNER JOIN {view_access} vac ON vac.view = aps.view
                WHERE art.id = ?
                AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
                AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
                ', array (
                $artefactid,
                $artefactid,
                $artefactid
        ) );

+1 −1
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ class ElasticsearchType_block_instance extends ElasticsearchType {
        // As block_instances do not have certain fields we need to get their
        // info either from the view they are on or from their configdata
        $record->ctime = parent::checkctime ( $data->ctime );
        $record->description = $data->description;
        $record->description = isset($data->description) ? $data->description : '';
        $record->owner = $data->owner;
        $record->group = $data->group;
        $record->institution = $data->institution;
+11 −0
Original line number Diff line number Diff line
@@ -447,10 +447,21 @@ class Elasticsearch7Type_artefact extends Elasticsearch7Type {
            WHERE   art.id = ?
                AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
                AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
            UNION
            SELECT vac.view AS view_id, vac.accesstype, vac.group, vac.role, vac.usr, vac.institution
            FROM {artefact} art
            INNER JOIN {artefact_peer_assessment} aps
                ON aps.assessment = art.id
            INNER JOIN {view_access} vac
                ON vac.view = aps.view
            WHERE art.id = ?
                AND (vac.startdate IS NULL OR vac.startdate < current_timestamp)
                AND (vac.stopdate IS NULL OR vac.stopdate > current_timestamp)
            ',
            [
                $artefactid,
                $artefactid,
                $artefactid
            ]
        );