=== modified file 'revision_moderation/revision_moderation.install' --- revision_moderation/revision_moderation.install 2009-02-23 18:48:49 +0000 +++ revision_moderation/revision_moderation.install 2009-04-02 15:17:56 +0000 @@ -33,37 +33,37 @@ } } + /** - * Install revision_moderation table. + * Switching bypass permission from administer nodes to a new permission */ function revision_moderation_update_1() { $ret = array(); - - switch ($GLOBALS['db_type']) { - case 'mysql': - case 'mysqli': - $ret[] = update_sql(" - CREATE TABLE {revision_moderation} ( - nid int unsigned NOT NULL, - revision_moderation int NOT NULL default '0', - PRIMARY KEY(nid) - ) /*!40100 DEFAULT CHARACTER SET UTF8 */ - "); - break; - case 'pgsql': - $ret[] = update_sql(" - CREATE TABLE {revision_moderation} ( - nid int NOT NULL, - revision_moderation int NOT NULL default '0', - PRIMARY KEY(nid) - ); - "); - break; + if (variable_get('revision_moderation_exempt', 1)) { + switch ($GLOBALS['db_type']) { + case 'mysql': + case 'mysqli': + $ret[] = update_sql(" + UPDATE permission + SET perm = CONCAT(perm, ', bypass revision moderation') + WHERE perm LIKE '%administer nodes%' + "); + break; + case 'pgsql': + $ret[] = update_sql(" + UPDATE permission + SET perm = CONCAT(perm, ', bypass revision moderation') + WHERE perm LIKE '%administer nodes%' + "); + break; + } } - + // Delete the old admin setting variable: + variable_del('revision_moderation_exempt'); return $ret; } + /** * Implementation of hook_uninstall(). */ === modified file 'revision_moderation/revision_moderation.module' --- revision_moderation/revision_moderation.module 2009-02-23 18:48:49 +0000 +++ revision_moderation/revision_moderation.module 2009-04-02 15:25:14 +0000 @@ -75,17 +75,13 @@ } /** - * Menu callback; admin settings page. - */ -function revision_moderation_settings() { - $form['revision_moderation_exempt'] = array( - '#type' => 'checkbox', - '#title' => t('Exempt administrators from revision moderation'), - '#default_value' => variable_get('revision_moderation_exempt', 1), - '#description' => t('With this option enabled, users with the "administer nodes" privilege will bypass the moderation system, and their revisions will be published immediately.'), - ); - return system_settings_form($form); -} +* Implementation of hook_perm(). +* +*/ +function revision_moderation_perm() { + return array('bypass revision moderation'); +} + /** * Implementation of hook_form_alter(). @@ -181,7 +177,7 @@ // Only do this logic for non-admin users on nodes with revision moderation // turned on. - if ($node->nid && $node->revision_moderation == 1 && (!user_access('administer nodes') || !variable_get('revision_moderation_exempt', 1))) { + if ($node->nid && $node->revision_moderation == 1 && (!user_access('bypass revision moderation'))) { switch ($op) { case 'prepare': // If user has a pending revision for this node, load the latest version of