function userprotect_update_6001 in User protect 6
Add protections for OpenID.
File
- ./
userprotect.install, line 119
Code
function userprotect_update_6001() {
$ret = array();
$spec = array(
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
'description' => t("OpenID protection."),
);
db_add_field($ret, 'userprotect', 'up_openid', $spec);
// Protect OpenID editing for the anonymous user and uid 1 by default, and
// allow uid 1 to bypass the protections.
$ret[] = update_sql("UPDATE {userprotect} SET up_openid = 1 WHERE up_type = 'user' AND uid IN (0, 1)");
$ret[] = update_sql("UPDATE {userprotect} SET up_openid = 1 WHERE up_type = 'admin' AND uid = 1");
// Allow users to edit their own OpenID identities by default.
$perms = db_result(db_query('SELECT perm FROM {permission} WHERE rid = %d', DRUPAL_AUTHENTICATED_RID));
db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $perms . ', change own openid', DRUPAL_AUTHENTICATED_RID);
$ret[] = array(
'success' => TRUE,
'query' => "Authenticated users have been granted the 'change own openid' permission by default.",
);
return $ret;
}