Index: filefield_sources.module
===================================================================
--- filefield_sources.module	(revision 33)
+++ filefield_sources.module	(working copy)
@@ -7,6 +7,15 @@
  */
 
 /**
+ * Implementation of hook_perm().
+ */
+function filefield_sources_perm() {
+  $params = array();
+  return filefield_sources_invoke_all('perm', $params);
+  //return array('');
+}
+
+/**
  * Implementation of hook_menu().
  */
 function filefield_sources_menu() {
Index: sources/reference.inc
===================================================================
--- sources/reference.inc	(revision 33)
+++ sources/reference.inc	(working copy)
@@ -16,18 +16,29 @@
  * Implementation of hook_filefield_source_info().
  */
 function filefield_source_reference_info() {
-  $source = array();
-  $source['reference'] = array(
-    'name' => t('Autocomplete reference textfield'),
-    'label' => t('Reference existing'),
-    'description' => t('Reuse an existing file by entering its file name.'),
-    'process' => 'filefield_source_reference_process',
-    'value' => 'filefield_source_reference_value',
-  );
-  return $source;
+  // Make sure current user has permissions to use this widget.
+  if (user_access('use existing files as a source')) {
+    $source = array();
+    $source['reference'] = array(
+      'name' => t('Autocomplete reference textfield'),
+      'label' => t('Reference existing'),
+      'description' => t('Reuse an existing file by entering its file name.'),
+      'process' => 'filefield_source_reference_process',
+      'value' => 'filefield_source_reference_value',
+    );
+    return $source;
+  }
 }
 
 /**
+ * Implementation of hook_perm().
+ */
+function filefield_source_reference_perm() {
+  $perms = array('use existing files as a source');
+  return $perms;
+}
+
+/**
  * Implementation of hook_menu().
  */
 function filefield_source_reference_menu() {
@@ -103,7 +114,7 @@
     ),
   );
 
-  return $element;
+  return $element;  
 }
 
 /**
Index: sources/remote.inc
===================================================================
--- sources/remote.inc	(revision 33)
+++ sources/remote.inc	(working copy)
@@ -16,18 +16,29 @@
  * Implementation of hook_filefield_source_info().
  */
 function filefield_source_remote_info() {
-  $source = array();
-  $source['remote'] = array(
-    'name' => t('Remote URL textfield'),
-    'label' => t('Remote URL'),
-    'description' => t('Download a file from a remote server.'),
-    'process' => 'filefield_source_remote_process',
-    'value' => 'filefield_source_remote_value',
-  );
-  return $source;
+  // Make sure current user has permissions to use this widget.
+  if (user_access('use remote sources')) {
+    $source = array();
+    $source['remote'] = array(
+      'name' => t('Remote URL textfield'),
+      'label' => t('Remote URL'),
+      'description' => t('Download a file from a remote server.'),
+      'process' => 'filefield_source_remote_process',
+      'value' => 'filefield_source_remote_value',
+    );
+    return $source;
+  }
 }
 
 /**
+ * Implementation of hook_perm().
+ */
+function filefield_source_remote_perm() {
+  $perms = array('use remote sources');
+  return $perms;
+}
+
+/**
  * Implementation of hook_menu().
  */
 function filefield_source_remote_menu() {

