Commit 1c07c4be authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1908858: Admin's profile page access not correct



When the admin is within an institution.
The institution name is being displayed as 'Shared with'

This is due to an error in the fix for Bug 1501133

Also an issue with stop/start dates - removing obsolete check

Change-Id: Iddf10abfe9b731d5571745811cbd7c3f792f687b
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 746b06f7
......@@ -99,12 +99,12 @@ function pieform_element_viewacl(Pieform $form, $element) {
$defaultaccesslist = ($accesslist) ? 0 : 1;
$myinstitutions = array();
if ($USER->get('admin')) {
$viewid = $form->get_property('viewid');
$view = new View($viewid);
if ($USER->get('admin') && $view->get('institution')) {
$institutions = array();
// Allow site admins to choose to share with the institution
// that the first selected view/collection belongs to
$viewid = $form->get_property('viewid');
$view = new View($viewid);
$institution = $view->get('institution');
if ($institution) {
$institutions = array(
......
......@@ -419,7 +419,6 @@ function editaccess_validate(Pieform $form, $values) {
'institution' => get_string('institution'),
);
$loggedinaccess = false;
if ($values['accesslist']) {
$dateformat = get_string('strftimedatetimeshort');
foreach ($values['accesslist'] as &$item) {
......@@ -436,10 +435,6 @@ function editaccess_validate(Pieform $form, $values) {
break;
}
if ($item['type'] == 'loggedin' && empty($item['startdate']) && empty($item['stopdate'])) {
$loggedinaccess = true;
}
$now = time();
if (!empty($item['stopdate']) && $now > $item['stopdate']) {
$SESSION->add_error_msg(get_string('newstopdatecannotbeinpast', 'view', $accesstypestrings[$item['type']]));
......
......@@ -352,7 +352,6 @@ function accessurl_validate(Pieform $form, $values) {
'institution' => get_string('institution'),
);
$loggedinaccess = false;
if ($values['accesslist']) {
$dateformat = get_string('strftimedatetimeshort');
foreach ($values['accesslist'] as &$item) {
......@@ -369,10 +368,6 @@ function accessurl_validate(Pieform $form, $values) {
break;
}
if ($item['type'] == 'loggedin' && !$item['startdate'] && !$item['stopdate']) {
$loggedinaccess = true;
}
$now = time();
if (!empty($item['stopdate']) && $item['stopdate'] && $now > $item['stopdate']) {
$SESSION->add_error_msg(get_string('newstopdatecannotbeinpast', 'view', $accesstypestrings[$item['type']]));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment