Permalink
Browse files

MDL-32117 equella: Remove custom 'context tree' handling.

user_has_role_assignment will check parent contexts itself so there is
no need to do this manally
  • Loading branch information...
danpoltawski committed May 31, 2012
1 parent 3e3910a commit 32f7f8586262a185a44c0095ad1b86b7fcff5a79
Showing with 1 addition and 17 deletions.
  1. +1 −17 repository/equella/lib.php
View
@@ -259,25 +259,9 @@ function getssotoken($readwrite = 'read') {
global $USER, $COURSE;
if( $readwrite == 'write' ) {
$systemcontext = context_system::instance();
if (!empty($COURSE->category)) {
$categorycontext = context_coursecat::instance($COURSE->category);
}
$coursecontext = context_course::instance($COURSE->id);
foreach( self::get_all_editing_roles() as $role) {
//does user have this role?
$hasroleassignment = false;
if (user_has_role_assignment($USER->id, $role->id, $systemcontext->id)) {
$hasroleassignment = true;
}
if (!$hasroleassignment && !empty($categorycontext) && user_has_role_assignment($USER->id, $role->id, $categorycontext->id)) {
$hasroleassignment = true;
}
if (!$hasroleassignment && user_has_role_assignment($USER->id, $role->id, $coursecontext->id)) {
$hasroleassignment = true;
}
if ($hasroleassignment) {
if (user_has_role_assignment($USER->id, $role->id, $this->context->id)) {
//see if the user has a role that is linked to an equella role
$shareid = $this->get_option("equella_{$role->shortname}_shareid");
if( !empty($shareid) ) {

0 comments on commit 32f7f85

Please sign in to comment.