1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/10679] Add new permission for changing profile field information

The setting is copied from "Can use signature"

PHPBB3-10679
This commit is contained in:
Joas Schilling
2012-03-01 16:15:11 +01:00
parent 2364d4b217
commit 4103c99a86
6 changed files with 59 additions and 5 deletions

View File

@@ -2731,8 +2731,6 @@ function change_database_data(&$no_updates, $version)
$config->set('display_last_subject', '1');
}
$no_updates = false;
if (!isset($config['assets_version']))
{
$config->set('assets_version', '1');
@@ -2771,7 +2769,7 @@ function change_database_data(&$no_updates, $version)
}
// PHPBB3-10601: Make inbox default. Add basename to ucp's pm category
// Get the category wanted while checking, at the same time, if this has already been applied
$sql = 'SELECT module_id, module_basename
FROM ' . MODULES_TABLE . "
@@ -2788,10 +2786,52 @@ function change_database_data(&$no_updates, $version)
SET module_basename = 'ucp_pm'
WHERE module_id = " . (int) $row['module_id'];
_sql($sql, $errored, $error_ary);
_sql($sql, $errored, $error_ary);
}
$db->sql_freeresult($result);
// Add new permission u_chgprofileinfo and duplicate settings from u_sig
include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
$auth_admin = new auth_admin();
// Only add the new permission if it does not already exist
if (empty($auth_admin->acl_options['id']['u_chgprofileinfo']))
{
$auth_admin->acl_add_option(array('global' => array('u_chgprofileinfo')));
// Now the tricky part, filling the permission
$old_id = $auth_admin->acl_options['id']['u_sig'];
$new_id = $auth_admin->acl_options['id']['u_chgprofileinfo'];
$tables = array(ACL_GROUPS_TABLE, ACL_ROLES_DATA_TABLE, ACL_USERS_TABLE);
foreach ($tables as $table)
{
$sql = 'SELECT *
FROM ' . $table . '
WHERE auth_option_id = ' . $old_id;
$result = _sql($sql, $errored, $error_ary);
$sql_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$row['auth_option_id'] = $new_id;
$sql_ary[] = $row;
}
$db->sql_freeresult($result);
if (sizeof($sql_ary))
{
$db->sql_multi_insert($table, $sql_ary);
}
}
// Remove any old permission entries
$auth_admin->acl_clear_prefetch();
}
$no_updates = false;
break;
}
}