Index: javascript_aggregator.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/javascript_aggregator/javascript_aggregator.module,v
retrieving revision 1.15
diff -u -r1.15 javascript_aggregator.module
--- javascript_aggregator.module	19 Apr 2008 15:58:43 -0000	1.15
+++ javascript_aggregator.module	29 Oct 2008 17:15:19 -0000
@@ -10,6 +10,13 @@
  */
 
 /**
+ * Implementation of hook_perm().
+ */
+function javascript_aggregator_perm() {
+  return array('administer javascript aggregator');
+}
+
+/**
  * Main function that finds .js files in $scripts.
  */
 function javascript_aggregator_cache($scripts) {
@@ -89,8 +96,6 @@
   return $scripts;
 }
 
-
-
 /**
  * Delete all cached JS files.
  */
@@ -105,9 +110,6 @@
   drupal_goto('admin/settings/performance');
 }
 
-
-
-
 /**
  * Implementation of hook_form_alter().
  *
@@ -115,7 +117,7 @@
  */
 function javascript_aggregator_form_alter($form_id, &$form) {
 
-  if ($form_id == 'system_performance_settings') {
+  if ($form_id == 'system_performance_settings' && user_access('administer javascript aggregator')) {
     $directory = file_directory_path();
     $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC);
 
@@ -150,7 +152,6 @@
       '#default_value' => variable_get('javascript_aggregator_exclude_js', ''),
       '#disabled' => !$is_writable,
       '#description' => t('Enter one js file per line that should be excluded from js aggregation. Check your HTML source for paths. TinyMCE Example: <em>/sites/all/modules/tinymce/tinymce/jscripts/tiny_mce/tiny_mce.js</em> Partial paths are also possible, this does the same <em>tiny_mce.js</em>'),
-      
     );
 
   }
@@ -162,22 +163,12 @@
  * Adds a callback mapped on the clear_cache function.
  */
 function javascript_aggregator_menu($may_cache) {
-
   $items = array();
-  if (!$may_cache) {
-
-    global $user;
-    if ($user->uid == 1) { // TODO: make this a setting or something
-      $access = TRUE;
-    }
-    else {
-      $access = FALSE;
-    }
-
+  if ($may_cache) {
     $items[] = array(
       'path' => 'clearjscache',
       'callback' => 'javascript_aggregator_clear_cache',
-      'access' => $access,
+      'access' => user_access('administer javascript aggregator'),
       'type' => MENU_CALLBACK
     );
   }
Index: README.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/javascript_aggregator/README.txt,v
retrieving revision 1.6
diff -u -r1.6 README.txt
--- README.txt	19 Jan 2008 20:26:43 -0000	1.6
+++ README.txt	29 Oct 2008 17:15:18 -0000
@@ -16,6 +16,7 @@
 To aggregate .js files
 
    1. enable the module
+   2. enable the "administer javascript aggregator" permission in admin/user/acces for roles deserving administrator rights
    2. go to admin/settings/performance and enable the js cache (you'll also find an option to clear js cache)
    3. place the following code inside your page.tpl.php file just before <?php print $scripts; ?> 
 
