Commit 8aae65b7 authored by Robert Lyon's avatar Robert Lyon Committed by Cecilia Vela Gurovic
Browse files

Bug 1758733: Allow non-admin to see correct legal page when logged in



behatnotneeded

Change-Id: I0da3f8a12d62ff5142974e0f068ddf591c75979d
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit c9209bcf)
parent 060d18c1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ if (!is_logged_in()) {
    throw new AccessDeniedException();
}

$form = privacy_form();
$form = privacy_form(!get_config('institutionstrictprivacy'), !get_config('institutionstrictprivacy'));

// JQuery logic for panel hide/show submit button.
$js = <<< EOF
@@ -39,5 +39,5 @@ setpageicon($smarty, 'icon-umbrella');

$smarty->assign('form', $form);
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('description', get_string('userprivacypagedescription', 'admin'));
$smarty->assign('description', get_string('userprivacypagedescription1', 'admin'));
$smarty->display('account/userprivacy.tpl');
+1 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ else {
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('results', $data);
$smarty->assign('selectedtab', $selectedtab);
$smarty->assign('latestVersions', $latestVersions);
$smarty->assign('versionid', $versionid);
$smarty->assign('link', "admin/site/privacy.php?id=");
+31 −24
Original line number Diff line number Diff line
@@ -745,11 +745,13 @@ function auth_get_available_auth_types($institution=null) {
/**
 * Build the agree with or withdraw consent to privacy statement
 *
 * @param ignoreagreevalue true when a new privacy statement needs to be accepted,
 * false when the form will be displayed to allow the consent withdraw.
 * @return form
 * @param ignoreagreevalue true  - when a new privacy statement needs to be accepted,
 *                         false - when the form will be displayed to allow the consent withdraw.
 * @param ignoreformswitch If true we do not show the form's switch fields. Useful if strict privacy is off.
 *
 * @return pieform form
 */
function privacy_form($ignoreagreevalue = false) {
function privacy_form($ignoreagreevalue = false, $ignoreformswitch = false) {
    global $USER;

    // Get all institutions of a user.
@@ -782,6 +784,7 @@ function privacy_form($ignoreagreevalue = false) {
        $smarty->assign('privacytitle', $title);
        $smarty->assign('privacytime', format_date(strtotime($privacy->ctime)));
        $smarty->assign('ignoreagreevalue', $ignoreagreevalue);
        $smarty->assign('ignoreformswitch', $ignoreformswitch);
        $htmlbegin = $smarty->fetch('privacy_panel_begin.tpl');

        //Build form elements.
@@ -793,7 +796,7 @@ function privacy_form($ignoreagreevalue = false) {
            'type' => 'hidden',
            'value' => $privacy->id,
        );

        if (!$ignoreformswitch) {
            $elements[$privacy->institution . $privacy->type] = array(
                'type'         => 'switchbox',
                'title'        => get_string('privacyagreement', 'admin', get_string($privacy->type . 'lowcase', 'admin')),
@@ -807,7 +810,7 @@ function privacy_form($ignoreagreevalue = false) {
                'type' => 'hidden',
                'value' => ($privacy->agreed && $ignoreagreevalue) ? 'disabled' : 'enabled',
            );

        }
        $smarty = smarty_core();
        $smarty->assign('ignoreagreevalue', $ignoreagreevalue);
        $htmlend = $smarty->fetch('privacy_panel_end.tpl');
@@ -818,15 +821,19 @@ function privacy_form($ignoreagreevalue = false) {

    }
    $classhidden = $ignoreagreevalue ? '' : 'js-hidden';
    if (!$ignoreformswitch) {
        $elements['submit'] = array(
            'class' => 'btn-primary ' . $classhidden,
            'type'  => 'submit',
            'value' => get_string('savechanges', 'admin')
        );
    }

    $form = pieform(array(
        'name'       => 'agreetoprivacy',
        'elements' => $elements,
    ));

    return $form;
}
/**
+1 −1
Original line number Diff line number Diff line
@@ -1366,7 +1366,7 @@ $string['institutionprivacystatement'] = 'Institution privacy statement';
$string['institutiontermsandconditions'] = 'Institution terms and conditions';
$string['institutionprivacyconsentdate'] = 'Institution privacy consent reviewed';
$string['institutiontermsconsentdate'] = 'Institution terms and conditions consent reviewed';
$string['userprivacypagedescription'] = 'Displayed are the current privacy statements and terms and conditions to which you consented.';
$string['userprivacypagedescription1'] = 'Displayed are the current privacy statements and terms and conditions.';
$string['lastupdated'] = 'Last updated on';
$string['newprivacy'] = 'Before entering your account, please read the information displayed below.';
$string['privacyagreement'] = 'I consent to the %s';
+7 −1
Original line number Diff line number Diff line
{include file="header.tpl"}
    {if $versionid && in_array($versionid, $latestVersions)}
        <div class="lead">{str tag="privacypagedescription" section="admin"}</div>
        <div class="lead">
        {if $selectedtab == 'termsandconditions'}
            {str tag="termspagedescription" section="admin"}
        {else}
            {str tag="privacypagedescription" section="admin"}
        {/if}
        </div>
            {if $pageeditform}
            <div class="col-md-9">
                <div class="panel panel-default">
Loading