]> git.mjollnir.org Git - moodle.git/commitdiff
merged implementing moodle/user:viewdetails
authortoyomoyo <toyomoyo>
Thu, 7 Dec 2006 06:14:52 +0000 (06:14 +0000)
committertoyomoyo <toyomoyo>
Thu, 7 Dec 2006 06:14:52 +0000 (06:14 +0000)
lib/db/access.php
lib/db/upgrade.php
user/index.php
version.php

index 48db1b00f05a92438519b30c3c89e24027a8082f..b68aa6c1999741876b8d27a21974f25ec9038267 100644 (file)
@@ -290,6 +290,11 @@ $moodle_capabilities = array(
         'captype' => 'read',
         'contextlevel' => CONTEXT_SYSTEM,
         'legacy' => array(
+            'guest' => CAP_ALLOW,
+            'student' => CAP_ALLOW,
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'coursecreator' => CAP_ALLOW,
             'admin' => CAP_ALLOW
         )
     ),
index 87ede9c1fc4048ceda4665c34a96e6ee0666f112..32f4161d13498252ecd4dcd6405c9ebfdf6df278 100644 (file)
@@ -121,6 +121,15 @@ function xmldb_main_upgrade($oldversion=0) {
     if ($oldversion < 2006120400) {    /// Remove secureforms config setting
         execute_sql("DELETE FROM {$CFG->prefix}config where name='secureforms' ;", true);
     }
+    
+    if ($oldversion < 2006120700) { // add moodle/user:viewdetails to all roles!
+        if ($roles = get_records('role')) {
+            $context = get_context_instance(CONTEXT_SYSTEM);
+            foreach ($roles as $roleid=>$role) {
+                assign_capability('moodle/user:viewdetails', CAP_ALLOW, $roleid, $context->id);
+            }
+        }
+    }
 
     return $result;
 
index df3203ddc973b31df921b94dd9dea20baff763a4..ba4f17a2e60ac28fd11ff310abe12e081e34d184 100644 (file)
                         $country = $countries[$user->country];
                     }
                 }
-
+                
+                $usercontext = get_context_instance(CONTEXT_USER, $user->id);
+                
+                if ($piclink = ($USER->id == $user->id || has_capability('moodle/user:viewdetails', $context) ||has_capability('moodle/user:viewdetails', $context))) {
+                    $profilelink = '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></strong>';
+                } else {
+                    $profilelink = '<strong>'.fullname($user).'</strong>';   
+                }
+                               
                 $data = array (
-                        print_user_picture($user->id, $course->id, $user->picture, false, true),
-                        '<strong><a href="'.$CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id.'">'.fullname($user).'</a></strong>'.$hidden);
+                        print_user_picture($user->id, $course->id, $user->picture, false, true, $piclink),
+                        $profilelink);
+
                 if (!isset($hiddenfields['city'])) {
                     $data[] = $user->city;
                 }
index e7b4ee608cb7b0c5c5389452baa31e11af5cbf17..d2ae624e6dcb7d9241a9e92c60e898bca7263a0d 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2006120400;  // YYYYMMDD = date
+   $version = 2006120700;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.8 dev';    // Human-friendly version name