Index: image.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.install,v
retrieving revision 1.25
diff -u -p -r1.25 image.install
--- image.install	17 May 2009 02:17:47 -0000	1.25
+++ image.install	22 Jun 2009 16:18:32 -0000
@@ -334,3 +334,17 @@ function image_update_6102() {
   return $ret;
 }
 
+/**
+ * Rename permission "edit images" to "edit any images".
+ */
+function image_gallery_update_6103() {
+  $ret = array();
+  $result = db_query("SELECT rid, perm FROM {permission} ORDER BY rid");
+  while ($role = db_fetch_object($result)) {
+    $renamed_permission = strtr($role->perm, array('edit images' => 'edit any images'));
+    if ($renamed_permission != $role->perm) {
+      $ret[] = update_sql("UPDATE {permission} SET perm = '$renamed_permission' WHERE rid = $role->rid");
+    }
+  }
+  return $ret;
+}
Index: image.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.305
diff -u -p -r1.305 image.module
--- image.module	22 May 2009 19:32:29 -0000	1.305
+++ image.module	22 Jun 2009 16:17:58 -0000
@@ -81,7 +81,7 @@ function image_node_info() {
  * Implementation of hook_perm
  */
 function image_perm() {
-  return array('create images', 'view original images', 'edit own images', 'edit images');
+  return array('create images', 'delete own images', 'delete any images', 'edit own images', 'edit any images', 'view original images');
 }
 
 /**
@@ -92,14 +92,23 @@ function image_access($op, $node, $accou
     return TRUE;
   }
 
-  if ($op == 'update' || $op == 'delete') {
-    if (user_access('edit images', $account)) {
+  if ($op == 'update') {
+    if (user_access('edit any images', $account)) {
       return TRUE;
     }
     if (user_access('edit own images', $account) && ($account->uid == $node->uid)) {
       return TRUE;
     }
   }
+  
+  if ($op == 'delete') {
+    if (user_access('delete any images', $account)) {
+      return TRUE;
+    }
+    if (user_access('delete own images', $account) && ($account->uid == $node->uid)) {
+      return TRUE;
+    }
+  }  
 }
 
 /**
Index: contrib/image_gallery/tests/image_gallery.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/tests/image_gallery.test,v
retrieving revision 1.1
diff -u -p -r1.1 image_gallery.test
--- contrib/image_gallery/tests/image_gallery.test	8 Jun 2008 17:08:33 -0000	1.1
+++ contrib/image_gallery/tests/image_gallery.test	22 Jun 2009 16:20:02 -0000
@@ -1,99 +1,99 @@
-<?php
-
-class ImageGalleryTest extends DrupalTestCase {
-
-  protected $web_user;
-
-  function get_info() {
-    return array('name' => t('Image Gallery tests'), 'desc' => t('Test Image Gallery module functionality.'), 'group' => 'Image');
-  }
-
-  function setUp() {
-    parent::setUp();
-
-    // User to create image galleries.
-    $this->web_user = $this->drupalCreateUserRolePerm(array('create images', 'view original images', 'edit own images', 'edit images', 'administer images'));
-    $this->drupalGet('logout');
-    $this->drupalLoginUser($this->web_user);
-  }
-  
-  function testBasic() {
-    $galleries_count = 2;
-    $images_count = 5;
-    $galleries = array();
-    $images = array();
-    $this->drupalVariableSet('image_images_per_page', $images_count);
-    
-    $vid = _image_gallery_get_vid();
-
-    // Create several galleries.
-    for ($i = 0; $i < $galleries_count; $i++) {
-      $galleries[] = $this->createGallery();
-    }
-    
-    // Create images for galleries.
-    $images_misc = file_scan_directory('misc', '.png');
-    shuffle($images_misc);
-    $images_files = array_slice($images_misc, 0, $images_count);
-    for ($i = 0; $i < $images_count; $i++) {
-      $tid = $galleries[array_rand($galleries)];
-      $edit = array(
-        'taxonomy[' . $vid . ']' => $tid,
-        'files[image]' => realpath($images_files[$i]->filename),
-      );
-      $images[] = array(
-        'tid' => $tid,
-        'node' => $this->createImage($edit),
-      );
-    }
-
-    // Test view the gallery.
-    foreach ($galleries as $tid) {
-      $this->drupalGet('image/tid/' . $tid);
-      foreach ($images as $image) {
-        if ($image['tid'] == $tid) {
-          $this->assertWantedRaw($image['node']->title, 'Gallery '. $tid .': image ' . $image['node']->title . ' displayed. %s');
-        }
-        else {
-          $this->assertNoUnwantedRaw($image['node']->title, 'Gallery '. $tid .': image ' . $images['node']->title . ' not displayed. %s');
-        }
-      }
-    }
-
-    // Delete the gallery.
-    // This don't work, so use general taxonomy function:
-    // $this->drupalPost('admin/content/image/edit/' . $terms[0]->tid, array(), 'Delete');
-    foreach ($galleries as $tid) {
-      taxonomy_del_term($tid);
-    }
-  }
-  
-  function createGallery($edit = array()) {
-    $defaults = array(
-      'name' => $this->randomName(),
-      'parent[0]' => 0,
-    );
-    $edit = $edit + $defaults;
-    $this->drupalPost('admin/content/image/add', $edit, 'Submit');
-    $this->assertWantedRaw(t('Created new gallery %term.', array('%term' => $edit['name'])), 'Image gallery created. %s');
-    $terms = taxonomy_get_term_by_name($edit['name']);
-    return $terms[0]->tid;
-  }
-  
-  function createImage($edit = array()) {
-    $defaults = array(
-      'title' => $this->randomName(),
-      'body' => $this->randomName(),
-      'files[image]' => realpath('misc' . DIRECTORY_SEPARATOR . 'druplicon.png'),
-    );
-    $edit = $edit + $defaults;
-    $this->drupalPost('node/add/image', $edit, 'Save');
-    $this->assertWantedRaw(t('@type %title has been created.', array('@type' => 'Image', '%title' => $edit['title'])), 'Image created. %s');
-    if ($node = node_load(array('title' => $edit['title']))) {
-      $this->assertNotNull($node, 'Image found in database. %s');
-      return $node;
-    }
-    return FALSE;
-  }
-  
-}
+<?php
+
+class ImageGalleryTest extends DrupalTestCase {
+
+  protected $web_user;
+
+  function get_info() {
+    return array('name' => t('Image Gallery tests'), 'desc' => t('Test Image Gallery module functionality.'), 'group' => 'Image');
+  }
+
+  function setUp() {
+    parent::setUp();
+
+    // User to create image galleries.
+    $this->web_user = $this->drupalCreateUserRolePerm(array('create images', 'view original images', 'edit own images', 'edit any images', 'administer image galleries'));
+    $this->drupalGet('logout');
+    $this->drupalLoginUser($this->web_user);
+  }
+  
+  function testBasic() {
+    $galleries_count = 2;
+    $images_count = 5;
+    $galleries = array();
+    $images = array();
+    $this->drupalVariableSet('image_images_per_page', $images_count);
+    
+    $vid = _image_gallery_get_vid();
+
+    // Create several galleries.
+    for ($i = 0; $i < $galleries_count; $i++) {
+      $galleries[] = $this->createGallery();
+    }
+    
+    // Create images for galleries.
+    $images_misc = file_scan_directory('misc', '.png');
+    shuffle($images_misc);
+    $images_files = array_slice($images_misc, 0, $images_count);
+    for ($i = 0; $i < $images_count; $i++) {
+      $tid = $galleries[array_rand($galleries)];
+      $edit = array(
+        'taxonomy[' . $vid . ']' => $tid,
+        'files[image]' => realpath($images_files[$i]->filename),
+      );
+      $images[] = array(
+        'tid' => $tid,
+        'node' => $this->createImage($edit),
+      );
+    }
+
+    // Test view the gallery.
+    foreach ($galleries as $tid) {
+      $this->drupalGet('image/tid/' . $tid);
+      foreach ($images as $image) {
+        if ($image['tid'] == $tid) {
+          $this->assertWantedRaw($image['node']->title, 'Gallery '. $tid .': image ' . $image['node']->title . ' displayed. %s');
+        }
+        else {
+          $this->assertNoUnwantedRaw($image['node']->title, 'Gallery '. $tid .': image ' . $images['node']->title . ' not displayed. %s');
+        }
+      }
+    }
+
+    // Delete the gallery.
+    // This don't work, so use general taxonomy function:
+    // $this->drupalPost('admin/content/image/edit/' . $terms[0]->tid, array(), 'Delete');
+    foreach ($galleries as $tid) {
+      taxonomy_del_term($tid);
+    }
+  }
+  
+  function createGallery($edit = array()) {
+    $defaults = array(
+      'name' => $this->randomName(),
+      'parent[0]' => 0,
+    );
+    $edit = $edit + $defaults;
+    $this->drupalPost('admin/content/image/add', $edit, 'Submit');
+    $this->assertWantedRaw(t('Created new gallery %term.', array('%term' => $edit['name'])), 'Image gallery created. %s');
+    $terms = taxonomy_get_term_by_name($edit['name']);
+    return $terms[0]->tid;
+  }
+  
+  function createImage($edit = array()) {
+    $defaults = array(
+      'title' => $this->randomName(),
+      'body' => $this->randomName(),
+      'files[image]' => realpath('misc' . DIRECTORY_SEPARATOR . 'druplicon.png'),
+    );
+    $edit = $edit + $defaults;
+    $this->drupalPost('node/add/image', $edit, 'Save');
+    $this->assertWantedRaw(t('@type %title has been created.', array('@type' => 'Image', '%title' => $edit['title'])), 'Image created. %s');
+    if ($node = node_load(array('title' => $edit['title']))) {
+      $this->assertNotNull($node, 'Image found in database. %s');
+      return $node;
+    }
+    return FALSE;
+  }
+  
+}
Index: contrib/image_import/tests/image_import.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_import/tests/image_import.test,v
retrieving revision 1.1
diff -u -p -r1.1 image_import.test
--- contrib/image_import/tests/image_import.test	8 Jun 2008 17:12:13 -0000	1.1
+++ contrib/image_import/tests/image_import.test	22 Jun 2009 16:21:10 -0000
@@ -1,59 +1,59 @@
-<?php
-
-class ImageImportTest extends DrupalTestCase {
-
-
-  function get_info() {
-    return array('name' => t('Image Import tests'), 'desc' => t('Test Image Import module functionality.'), 'group' => 'Image');
-  }
-
-  function setUp() {
-    parent::setUp();
-    
-    // Set an image import patch.
-    $image_import_path = file_directory_path() . '/' . $this->randomName();
-    file_check_directory($image_import_path, FILE_CREATE_DIRECTORY);
-    $this->drupalVariableSet('image_import_path', $image_import_path);
-    
-    // User to create image galleries.
-    $this->web_user = $this->drupalCreateUserRolePerm(array('create images', 'view original images', 'edit own images', 'edit images', 'administer images', 'import images'));
-    $this->drupalGet('logout');
-    $this->drupalLoginUser($this->web_user);
-  }
-  
-
-  function testImport() {
-    // Get 10 random images from 'misc' directory.
-    $images_count = 10;
-    $images_misc = file_scan_directory('misc', '.png');
-    shuffle($images_misc);
-    $images = array_slice($images_misc, 0, $images_count);
-    
-    $image_prefix = $this->randomName();
-    $edit = array();
-    $i = 1;
-    foreach ($images as $image) {
-      // Copy each image to import directory with random names.
-      file_copy($image->filename, variable_get('image_import_path', '') . '/' . $image_prefix . $image->basename);
-      $edit['import_file['. $i .']'] = $i;
-      $edit['title['. $i .']'] = $image_prefix . $image->basename;
-      $edit['body['. $i .']'] = $image_prefix . $image->basename;
-      $i++;
-    }
-    $this->drupalPost('admin/content/image_import', $edit, 'Import');
-    $this->assertWantedRaw('Successfully imported', 'Successfully imported. %s');
-
-    // Check each image is a node now.
-    foreach ($images as $image) {
-      $node = node_load(array('title' => $image_prefix . $image->basename));
-      $this->assertTrue($node, 'Image '. $image_prefix . $image->basename .' successfully imported. %s');
-    }
-    // @todo import into a gallery.
-  }
-  
-  function tearDown() {
-    @rmdir(variable_get('image_import_path', ''));
-
-    parent::tearDown();
-  }
-}
+<?php
+
+class ImageImportTest extends DrupalTestCase {
+
+
+  function get_info() {
+    return array('name' => t('Image Import tests'), 'desc' => t('Test Image Import module functionality.'), 'group' => 'Image');
+  }
+
+  function setUp() {
+    parent::setUp();
+    
+    // Set an image import patch.
+    $image_import_path = file_directory_path() . '/' . $this->randomName();
+    file_check_directory($image_import_path, FILE_CREATE_DIRECTORY);
+    $this->drupalVariableSet('image_import_path', $image_import_path);
+    
+    // User to create image galleries.
+    $this->web_user = $this->drupalCreateUserRolePerm(array('create images', 'view original images', 'edit own images', 'edit any images', 'administer image galleries', 'import images'));
+    $this->drupalGet('logout');
+    $this->drupalLoginUser($this->web_user);
+  }
+  
+
+  function testImport() {
+    // Get 10 random images from 'misc' directory.
+    $images_count = 10;
+    $images_misc = file_scan_directory('misc', '.png');
+    shuffle($images_misc);
+    $images = array_slice($images_misc, 0, $images_count);
+    
+    $image_prefix = $this->randomName();
+    $edit = array();
+    $i = 1;
+    foreach ($images as $image) {
+      // Copy each image to import directory with random names.
+      file_copy($image->filename, variable_get('image_import_path', '') . '/' . $image_prefix . $image->basename);
+      $edit['import_file['. $i .']'] = $i;
+      $edit['title['. $i .']'] = $image_prefix . $image->basename;
+      $edit['body['. $i .']'] = $image_prefix . $image->basename;
+      $i++;
+    }
+    $this->drupalPost('admin/content/image_import', $edit, 'Import');
+    $this->assertWantedRaw('Successfully imported', 'Successfully imported. %s');
+
+    // Check each image is a node now.
+    foreach ($images as $image) {
+      $node = node_load(array('title' => $image_prefix . $image->basename));
+      $this->assertTrue($node, 'Image '. $image_prefix . $image->basename .' successfully imported. %s');
+    }
+    // @todo import into a gallery.
+  }
+  
+  function tearDown() {
+    @rmdir(variable_get('image_import_path', ''));
+
+    parent::tearDown();
+  }
+}
Index: tests/image.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/tests/image.test,v
retrieving revision 1.6
diff -u -p -r1.6 image.test
--- tests/image.test	22 May 2009 19:32:30 -0000	1.6
+++ tests/image.test	22 Jun 2009 16:18:56 -0000
@@ -21,7 +21,7 @@ class ImageTestCase extends DrupalWebTes
     parent::setUp('image');
 
     // User to create images.
-    $this->web_user = $this->drupalCreateUser(array('create images', 'view original images', 'edit own images', 'edit images'));
+    $this->web_user = $this->drupalCreateUser(array('create images', 'view original images', 'edit own images', 'edit any images'));
     $this->drupalLogin($this->web_user);
 
     // Uploadable image.
