mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-23302 Credit to Aparup. New cap moodle/user:manageownfiles to control private user files area
This commit is contained in:
parent
a2580005a5
commit
e4f413b4b3
4 changed files with 19 additions and 4 deletions
|
@ -60,7 +60,9 @@ class block_private_files extends block_base {
|
||||||
|
|
||||||
$renderer = $this->page->get_renderer('block_private_files');
|
$renderer = $this->page->get_renderer('block_private_files');
|
||||||
$this->content->text = $renderer->private_files_tree();
|
$this->content->text = $renderer->private_files_tree();
|
||||||
$this->content->text .= $OUTPUT->single_button(new moodle_url('/user/filesedit.php'), get_string('myfilesmanage'), 'get');
|
if (has_capability('moodle/user:manageownfiles', $this->context)) {
|
||||||
|
$this->content->text .= $OUTPUT->single_button(new moodle_url('/user/filesedit.php'), get_string('myfilesmanage'), 'get');
|
||||||
|
}
|
||||||
$this->content->footer = '';
|
$this->content->footer = '';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,6 +353,7 @@ $string['user:editprofile'] = 'Edit user profile';
|
||||||
$string['user:loginas'] = 'Login as other users';
|
$string['user:loginas'] = 'Login as other users';
|
||||||
$string['user:manageblocks'] = 'Manage blocks on user profile of other users';
|
$string['user:manageblocks'] = 'Manage blocks on user profile of other users';
|
||||||
$string['user:manageownblocks'] = 'Manage blocks on own public user profile';
|
$string['user:manageownblocks'] = 'Manage blocks on own public user profile';
|
||||||
|
$string['user:manageownfiles'] = 'Manage files on own private file areas';
|
||||||
$string['user:managesyspages'] = 'Configure default page layout for public user profiles';
|
$string['user:managesyspages'] = 'Configure default page layout for public user profiles';
|
||||||
$string['user:readuserblogs'] = 'See all user blogs';
|
$string['user:readuserblogs'] = 'See all user blogs';
|
||||||
$string['user:readuserposts'] = 'See all user posts';
|
$string['user:readuserposts'] = 'See all user posts';
|
||||||
|
|
|
@ -522,7 +522,19 @@ $capabilities = array(
|
||||||
'captype' => 'write',
|
'captype' => 'write',
|
||||||
'contextlevel' => CONTEXT_SYSTEM,
|
'contextlevel' => CONTEXT_SYSTEM,
|
||||||
'archetypes' => array(
|
'archetypes' => array(
|
||||||
'user' => CAP_ALLOW,
|
'user' => CAP_ALLOW
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
// can the user manage their own files?
|
||||||
|
'moodle/user:manageownfiles' => array(
|
||||||
|
|
||||||
|
'riskbitmap' => RISK_SPAM | RISK_PERSONAL,
|
||||||
|
|
||||||
|
'captype' => 'write',
|
||||||
|
'contextlevel' => CONTEXT_SYSTEM,
|
||||||
|
'archetypes' => array(
|
||||||
|
'user' => CAP_ALLOW
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,9 @@ require_login();
|
||||||
if (isguestuser()) {
|
if (isguestuser()) {
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
//TODO: add capability check here!
|
|
||||||
|
|
||||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||||
|
require_capability('moodle/user:manageownfiles', $context);
|
||||||
|
|
||||||
$title = get_string('myfiles');
|
$title = get_string('myfiles');
|
||||||
$struser = get_string('user');
|
$struser = get_string('user');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue