Commit 590c6a2f authored by Adrian Schlegel's avatar Adrian Schlegel Committed by Robert Lyon
Browse files

Allow users access to site files in subfolders (Bug #1223069)



This patch introduces a setting which, if turned on, allows users to
access linked site files which are placed in subfolders.

Linked site files are set up under Configure site -> Menus

Change-Id: Iae4b9e10ef6a921cbf5a3afd9881f33b4c9f280c
Signed-off-by: default avatarAdrian Schlegel <adrian@liip.ch>
parent ff1b04b9
......@@ -631,6 +631,13 @@ $siteoptionform = array(
'help' => true,
'disabled' => in_array('wysiwyg', $OVERRIDDEN),
),
'sitefilesaccess' => array(
'type' => 'checkbox',
'title' => get_string('sitefilesaccess', 'admin'),
'description' => get_string('sitefilesaccessdescription', 'admin'),
'defaultvalue' => get_config('sitefilesaccess'),
'disabled' => in_array('sitefilesaccess', $OVERRIDDEN),
),
),
),
'loggingsettings' => array(
......@@ -693,7 +700,7 @@ function siteoptions_submit(Pieform $form, $values) {
'registerterms', 'licensemetadata', 'licenseallowcustom', 'allowmobileuploads', 'creategroups', 'createpublicgroups', 'allowgroupcategories', 'wysiwyg',
'staffreports', 'staffstats', 'userscandisabledevicedetection',
'masqueradingreasonrequired', 'masqueradingnotified',
'eventloglevel', 'eventlogexpiry',
'eventloglevel', 'eventlogexpiry', 'sitefilesaccess',
);
$count = 0;
$where_sql = " WHERE admin = 0 AND id != 0";
......
......@@ -87,7 +87,10 @@ else {
// If the file is in the logged in menu and the user is logged in then
// they can view it
$fileinloggedinmenu = $file->get('institution') == 'mahara';
$fileinloggedinmenu = $fileinloggedinmenu && $file->get('parent') == null;
// check if users are allowed to access files in subfolders
if (!get_config('sitefilesaccess')) {
$fileinloggedinmenu = $fileinloggedinmenu && $file->get('parent') == null;
}
$fileinloggedinmenu = $fileinloggedinmenu && $USER->is_logged_in();
$fileinloggedinmenu = $fileinloggedinmenu && record_exists('site_menu', 'file', $fileid, 'public', 0);
......
......@@ -400,6 +400,8 @@ $string['eventlogexpirydescription'] = 'How long to keep the event log.';
$string['eventloglevelnone'] = 'None';
$string['eventloglevelmasq'] = 'Masquerading';
$string['eventloglevelall'] = 'All';
$string['sitefilesaccess'] = 'Access to site files';
$string['sitefilesaccessdescription'] = 'If checked, logged-in users will have access to site files in subfolders. By default, only files in the top level directory are accessible to them.';
// Site content
$string['about'] = 'About';
......
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