mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00: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:
parent
2364d4b217
commit
4103c99a86
6 changed files with 59 additions and 5 deletions
|
@ -251,6 +251,11 @@ class ucp_profile
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'profile_info':
|
case 'profile_info':
|
||||||
|
// Do not display profile information panel if not authed to do so
|
||||||
|
if (!$auth->acl_get('u_chgprofileinfo'))
|
||||||
|
{
|
||||||
|
trigger_error('NO_AUTH_PROFILEINFO');
|
||||||
|
}
|
||||||
|
|
||||||
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
||||||
|
|
||||||
|
|
|
@ -2731,8 +2731,6 @@ function change_database_data(&$no_updates, $version)
|
||||||
$config->set('display_last_subject', '1');
|
$config->set('display_last_subject', '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
$no_updates = false;
|
|
||||||
|
|
||||||
if (!isset($config['assets_version']))
|
if (!isset($config['assets_version']))
|
||||||
{
|
{
|
||||||
$config->set('assets_version', '1');
|
$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
|
// 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
|
// Get the category wanted while checking, at the same time, if this has already been applied
|
||||||
$sql = 'SELECT module_id, module_basename
|
$sql = 'SELECT module_id, module_basename
|
||||||
FROM ' . MODULES_TABLE . "
|
FROM ' . MODULES_TABLE . "
|
||||||
|
@ -2788,10 +2786,52 @@ function change_database_data(&$no_updates, $version)
|
||||||
SET module_basename = 'ucp_pm'
|
SET module_basename = 'ucp_pm'
|
||||||
WHERE module_id = " . (int) $row['module_id'];
|
WHERE module_id = " . (int) $row['module_id'];
|
||||||
|
|
||||||
_sql($sql, $errored, $error_ary);
|
_sql($sql, $errored, $error_ary);
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,6 +387,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgemail', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chggrp', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chggrp', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgname', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgpasswd', 1);
|
||||||
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_chgprofileinfo', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_download', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_hideonline', 1);
|
||||||
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('u_ignoreflood', 1);
|
||||||
|
@ -548,7 +549,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
|
||||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
|
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 22, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option NOT IN ('f_announce', 'f_attach', 'f_bump', 'f_delete', 'f_flash', 'f_icons', 'f_ignoreflood', 'f_sticky', 'f_user_lock', 'f_votechg');
|
||||||
|
|
||||||
# New Member (u_)
|
# New Member (u_)
|
||||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group');
|
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 23, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'u_%' AND auth_option IN ('u_sendpm', 'u_masspm', 'u_masspm_group', 'u_chgprofileinfo');
|
||||||
|
|
||||||
# New Member (f_)
|
# New Member (f_)
|
||||||
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 24, auth_option_id, 0 FROM phpbb_acl_options WHERE auth_option LIKE 'f_%' AND auth_option IN ('f_noapprove');
|
||||||
|
|
|
@ -102,6 +102,7 @@ $lang = array_merge($lang, array(
|
||||||
'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'),
|
'acl_u_chgemail' => array('lang' => 'Can change email address', 'cat' => 'profile'),
|
||||||
'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'),
|
'acl_u_chgavatar' => array('lang' => 'Can change avatar', 'cat' => 'profile'),
|
||||||
'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'),
|
'acl_u_chggrp' => array('lang' => 'Can change default usergroup', 'cat' => 'profile'),
|
||||||
|
'acl_u_chgprofileinfo' => array('lang' => 'Can change profile field information', 'cat' => 'profile'),
|
||||||
|
|
||||||
'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'),
|
'acl_u_attach' => array('lang' => 'Can attach files', 'cat' => 'post'),
|
||||||
'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'),
|
'acl_u_download' => array('lang' => 'Can download files', 'cat' => 'post'),
|
||||||
|
|
|
@ -318,6 +318,7 @@ $lang = array_merge($lang, array(
|
||||||
'NO_AUTH_FORWARD_MESSAGE' => 'You are not authorised to forward private messages.',
|
'NO_AUTH_FORWARD_MESSAGE' => 'You are not authorised to forward private messages.',
|
||||||
'NO_AUTH_GROUP_MESSAGE' => 'You are not authorised to send private messages to groups.',
|
'NO_AUTH_GROUP_MESSAGE' => 'You are not authorised to send private messages to groups.',
|
||||||
'NO_AUTH_PASSWORD_REMINDER' => 'You are not authorised to request a new password.',
|
'NO_AUTH_PASSWORD_REMINDER' => 'You are not authorised to request a new password.',
|
||||||
|
'NO_AUTH_PROFILEINFO' => 'You are not authorised to change your profile information.',
|
||||||
'NO_AUTH_READ_HOLD_MESSAGE' => 'You are not authorised to read private messages that are on hold.',
|
'NO_AUTH_READ_HOLD_MESSAGE' => 'You are not authorised to read private messages that are on hold.',
|
||||||
'NO_AUTH_READ_MESSAGE' => 'You are not authorised to read private messages.',
|
'NO_AUTH_READ_MESSAGE' => 'You are not authorised to read private messages.',
|
||||||
'NO_AUTH_READ_REMOVED_MESSAGE' => 'You are not able to read this message because it was removed by the author.',
|
'NO_AUTH_READ_REMOVED_MESSAGE' => 'You are not able to read this message because it was removed by the author.',
|
||||||
|
|
|
@ -334,6 +334,12 @@ if (!$config['allow_topic_notify'] && !$config['allow_forum_notify'])
|
||||||
$vars = array('module', 'id', 'mode');
|
$vars = array('module', 'id', 'mode');
|
||||||
extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars)));
|
extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars)));
|
||||||
|
|
||||||
|
// Do not display profile information panel if not authed to do so
|
||||||
|
if (!$auth->acl_get('u_chgprofileinfo'))
|
||||||
|
{
|
||||||
|
$module->set_display('profile', 'profile_info', false);
|
||||||
|
}
|
||||||
|
|
||||||
// Select the active module
|
// Select the active module
|
||||||
$module->set_active($id, $mode);
|
$module->set_active($id, $mode);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue