? context-661094-13.patch
Index: context_ui/context_ui.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/context_ui.install,v
retrieving revision 1.4.2.10.2.3
diff -u -p -r1.4.2.10.2.3 context_ui.install
--- context_ui/context_ui.install	1 Sep 2009 02:34:31 -0000	1.4.2.10.2.3
+++ context_ui/context_ui.install	21 Jan 2011 17:53:30 -0000
@@ -8,3 +8,37 @@
 function context_ui_update_6004() {
   return array();
 }
+
+/**
+ * Grant the new permission 'create contexts' to all roles that
+ * currently have the 'administer site configuration' perm.
+ */
+function context_ui_update_6005() {
+  $ret = array();
+
+  $updated_roles = array();
+  $result = db_query("SELECT r.name, p.pid, p.perm
+    FROM {role} r
+    INNER JOIN {permission} p ON r.rid = p.rid
+    WHERE p.perm LIKE '%%administer site configuration%%'
+    ORDER BY r.name");
+
+  while ($row = db_fetch_object($result)) {
+    $perms = explode(', ', $row->perm);
+    // If the new perm does not already belong to this role, add it.
+    if (!in_array('create contexts', $perms)) {
+      $perms[] = 'create contexts';
+      db_query("UPDATE {permission} SET perm = '%s' WHERE pid = %d", implode(',', $perms), $row->pid);
+      $updated_roles[] = $row->name;
+    }
+  }
+
+  if (!empty($updated_roles)) {
+    $ret[] = array(
+      'success' => TRUE,
+      'query' => t("The new 'create contexts' permission has been added to the following roles: "). implode(',', $updated_roles) .'.',
+    );
+  }
+
+  return $ret;
+}
Index: context_ui/context_ui.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/context_ui.module,v
retrieving revision 1.13.2.48.2.1.2.19
diff -u -p -r1.13.2.48.2.1.2.19 context_ui.module
--- context_ui/context_ui.module	23 Aug 2010 16:40:56 -0000	1.13.2.48.2.1.2.19
+++ context_ui/context_ui.module	21 Jan 2011 17:53:31 -0000
@@ -11,6 +11,13 @@ function context_ui_ctools_plugin_direct
 }
 
 /**
+ * Implementation of hook_perm().
+ */
+function context_ui_perm() {
+  return array('create contexts');
+}
+
+/**
  * Implementation of hook_theme().
  */
 function context_ui_theme() {
Index: context_ui/export_ui/context.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/context/context_ui/export_ui/Attic/context.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 context.inc
--- context_ui/export_ui/context.inc	5 Aug 2010 16:46:26 -0000	1.1.2.1
+++ context_ui/export_ui/context.inc	21 Jan 2011 17:53:31 -0000
@@ -2,6 +2,7 @@
 // $Id: context.inc,v 1.1.2.1 2010/08/05 16:46:26 yhahn Exp $
 
 $plugin = array(
+  'access' => 'create contexts',
   'schema' => 'context',
   'menu' => array(
     'menu prefix' => 'admin/build',
