Forráskód Böngészése

Adds new permission for setting files permanent

Stephen Ficklin 3 éve
szülő
commit
e56e83a6c6

BIN
docs/user_guide/file_upload_permission.png


+ 7 - 4
tripal/includes/tripal.user.inc

@@ -519,10 +519,13 @@ function tripal_view_file($uid, $fid) {
 
 
   $actions = l('Delete', "user/$uid/files/$file->fid/delete") . '<br>' .
-      l('Download', "user/$uid/files/$file->fid/download") . '<br>' .
-      l('Renew Expiration', "user/$uid/files/$file->fid/renew") . '<br>';
-  if ($expiration_date != -1) {
-    $actions .= l('Make Permanent', "user/$uid/files/$file->fid/permanent");
+    l('Download', "user/$uid/files/$file->fid/download") . '<br>' .
+    l('Renew Expiration', "user/$uid/files/$file->fid/renew") . '<br>';
+
+  if (user_access('make files permanent')) {
+    if ($expiration_date != -1) {
+      $actions .= l('Make Permanent', "user/$uid/files/$file->fid/permanent");
+    }
   }
   $rows[] = [
     [

+ 6 - 0
tripal/tripal.module

@@ -747,6 +747,12 @@ function tripal_permission() {
       'title' => t('Upload Files'),
       'description' => t('Allows the user to upload files using Tripal\'s HTML5 loader.'),
     ),
+    'make files permanent' => array(
+      'title' => t('Make Files Permanent'),
+      'description' => t('Allows the user to make files they have access to ' .
+         'permanent. Files that are permanent will not expire and will not ' .
+         'be cleaned up.'),
+    ),
     'view dev helps' => array(
       'title' => t('View Developer Hints'),
       'description' => t('Tripal will provide blue shaded boxes that provide